<div dir="ltr">Dear The Free Pascal Developers<br><br>Greetings from Perú!<br>First and foremost, I would like to thank you for the great work you have done and are currently doing in providing the world with a great compiler for the Pascal programming language: Free Pascal.<br><br>I am writing to you concerning an issue that I consider as being of the greatest importance since it affects two compiler modes of the Free Pascal Compiler. The round function in FPC (version 3.0.4) when the parameter is equidistant from the two nearest integers (.5) rounds the number towards the even number. This feature of the FPC's round transfer function when it comes to rounding (.5) integers hinders both compliance with the ISO 7185 standard and compatibility with Turbo Pascal.<br><br>The Pascal ISO 7185:1990 standard document states that "If x is positive or zero, round(x) shall be equivalent to trunc(x+0.5); otherwise, round(x) shall be equivalent to trunc(x-0.5)." (Pascal ISO7185:1990, (C)ISO/IEC 1991, online copy. Page 44). As for Turbo Pascal, in its version 6.0 library reference document one can read: "If X is exactly halfway between two whole numbers, the result is the number with the greatest absolute magnitude." (Turbo Pascal(R) Version 6.0 Library Reference. Copyright(C) 1983, 1990 by Borland International. Page 120).<br><br>I became aware of this issue when getting strange results for a program I wrote that involved the calculation of rounded numbers in a statement like this: round((upper - lower) / 2), where, for instance, a value that I expected to be 13 was calculated as 12. Since the next statements would take the values returned by the round function to do more calculations, the program would produce wrong results. Shortly afterwards I wanted to know what the results would be if I compiled the program with other Pascal compilers. I did so, GNU Pascal being one of them, and they all did yield the expected program results and the expected values calculated by the round function, that is 13 instead of 12 for the example above.<div><br>I would appreciate it if you did not suggest that I use GNU Pascal if I want an ISO 7185 standard compliant Pascal compiler. I do have both Free Pascal and GNU Pascal compilers installed on my machine and I have noticed there is a great difference in terms of execution speed when a program does a lot of calculations in numerical applications. In this respect Free Pascal is superior (thanks a lot, guys!). Furthermore, GNU Pascal development is halted while Free Pascal is rising to become the de facto ISO 7185 compliant compiler because of its ubiquitous nature, active development, and speed.<br><br>Hence, it will be advantageous to the whole community of Pascal programmers if FPC completely complies with the ISO 7185 standard, and in order to do so, a first great step will be providing an ISO 7185 compliant round function. Besides, in doing so, FPC will also be more compatible with Turbo Pascal.<br><br>Please, do not get me wrong. I do know I don't have the authority to demand anything at all. I don't want to do that. I am just a humble programming student who knows he has a lot to learn. I also know that you guys are for sure much more knowledgeable about computers and algorithms than I am, and I thank you again and congratulate you for the great job you have done in producing the Free Pascal Compiler. But, can I suggest something be made in order for the FPC round function to recognize (.5) numbers and treat them in accordance with the ISO 7185 standard, at least when compiling with the ISO mode?<br><br>I thank you in advance and look forward to hearing from you shortly.<br><br>Best regards<br><br>Juan C. Díaz<br><br></div></div><div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top:1px solid #d3d4de">
<tr>
<td style="width:55px;padding-top:13px"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;"></a></td>
<td style="width:470px;padding-top:12px;color:#41424e;font-size:13px;font-family:Arial,Helvetica,sans-serif;line-height:18px">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail" target="_blank" style="color:#4453ea">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"></a></div>