[Lazarus] Problem with fpc-3.0.4 and double
Ralf Quint
freedos.la at gmail.com
Wed Jan 31 19:27:31 CET 2018
On 1/31/2018 10:18 AM, zeljko via Lazarus wrote:
> Hi all,
> In one of my applications I'm using someDouble1 <> someDouble2 for
> years, now got problem with fpc-3.0.4 (all previous fpc versions were
> ok (3.0.2, 3.0.0, 2.6.4, 2.6.2, 2.6.0...etc) + kylix + delphi7), so
> now must use IsSameValue(someDouble1,someDouble2) to get correct
> comparision of double types.
>
> What exactly have been changed in fpc-3.0.4 with double types (or
> generally with floats) ? Do I have to check all of my code now and
> change comparisions of doubles to use IsSameValue() ?
>
> Anyone boomed by such problem ?
Comparing any floating point value like this is pure luck when you claim
that it worked in the past. In any programming language, unless maybe
you are using one that by default utilizes BCD floats.
Using binary floats, there are just too many values that can't be
represented 100%, regardless of the length of the mantissa.
https://en.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems
Ralf
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the Lazarus
mailing list