On 22 Feb 2013, at 13:30, [email protected] wrote:

s1,s2: extended;

s1:=291.022;
s2:=roundto(s1,-30);   //TRoundToRange = -37..37;

give me Invalid floating point operation.

I see that roundto goes to single instead of extended. But why ?

Because overload selection is based on parameter matching from right to left, and -30 can be exactly represented using "single" and hence is converted to that type by the compiler when it has to turn it into a floating point constant.


Jonas
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to