[fpc-pascal] Floating point question (Rafael Picanço)

James Richters james.richters at productionautomation.net
Tue Feb 6 16:51:55 CET 2024


This is my opinion from my testing, but others may have something else to say.
 
1) Does it affects constants only? 
Not really, if you set a variable with constant terms, it is affected, if you set a variable with other variables, it is not affected.
Cont
   Mycontant := 8432+33/1440.0;    //Is affected;
Var
   MyDoubleVariable:Double;
 
MyDoubleVariable := 8432+33/1440.0;   //Is affected
 
 
Var
   MyInteger : Ineger;
   MyByte :  Byte
   MySingle : Single;
   MyDouble : Double;
 
MyInteger := 8432;
MyByte := 33;
MySingle := 1440.0;
MyDouble := MyInteger + MyByte / MySingle; //   is NOT affected;
 
 
2) Does it affects the LargerFloat type?  
I don’t know what you mean by LargerFloat, but Double an d Extended are affected, and even Real if your platform defines Real as a Double.
Anything that is not Single precision is affected.
 
3) Should I use {$MINFPCONSTPREC 64} in {$mode objfpc} too to avoid it?   
Everyone should use {$MINFPCONSTPREC 64} in all programs until the bug is fixed, unless you use extended, then you have no good solution. Because you can’t set it to 80.


4) BONUS: Is the LargerFloat type really the larger, or should one do something else?  
I’m afraid I don’t qualify for the bonus, because I don’t know what LargerFloat is.
 
James
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20240206/b8e5b45e/attachment-0001.htm>


More information about the fpc-pascal mailing list