float precision loss during constant evaluation
Original Reporter info from Mantis: BeniBela @benibela
-
Reporter name: Benito van der Zander
Original Reporter info from Mantis: BeniBela @benibela
- Reporter name: Benito van der Zander
Description:
When constants are evaluated during compile time, it seems to ignore precision loss due to floating point conversions
Steps to reproduce:
All of these print false:
writeln(single(144115188075855877) = single(144115188075855872));
writeln(single(1 / 3.0) = single(0.33333333));
writeln(single(92233720368547758) = single(92233720000000000));
All of these print true:
var
s1, s2: single;
begin
s1 := 144115188075855877;
s2 := 144115188075855872;
writeln(s1 = s2);
s1 := 1 / 3.0;
s2 := 0.33333333;
writeln(s1 = s2);
s1 := 92233720368547758;
s2 := 92233720000000000;
writeln(s1 = s2);
Mantis conversion info:
- Mantis ID: 25121
- Build: 2013/03/23
- Version: 2.7.1
- Fixed in version: 3.1.1
- Fixed in revision: 37911 (#8cfe7e0a)