|
From: Robert K. <rl...@al...> - 2021-09-11 15:51:31
|
On 9/9/21 7:58 AM, jsmeix wrote: > From my own experience about 30 years ago I remember > that in practice > "there is no such thing as 'equal' with float data types". > > I.e. code that is based on 'float1 == float2' cannot work > reliably in general because even if float1 and float2 > must me mathematically identical it does not mean their > representations as a limited sequences of bits are same. That's certainly true, but the converse (that inequality comparisons are safe) is not necessarily true (even strict inequality comparisons, e. g. < vs. <=, aren't always safe for numbers that can't be represented exactly). We may need to implement small fudge factors, maybe something like 0.000001 point, for things that aren't exact (i. e. dyesub) or round the check functions up to the larger integer number of points for comparison. |