Meaning of Float>>closeTo:
Bert Freudenberg
bert at freudenbergs.de
Fri Mar 2 13:43:20 UTC 2007
On Mar 2, 2007, at 13:56 , Damien Cassou wrote:
> 2007/3/2, Bert Freudenberg <bert at freudenbergs.de>:
>> On Mar 2, 2007, at 12:55 , Damien Cassou wrote:
>> > 999999 closeTo: 999899.00011. => true
>> > 999999 closeTo: 999899.0001. => false
>> >
>> > Is it a bug ? Is it a problem with how computer deal with floating
>> > point numbers ?
>>
>> No, one is just closer than the other. One is below the threshold and
>> one above.
>
> I don't understand. We are talking about 2 numbers close to 1 million.
> I don't see how adding 0.00001 to one number can totally change the
> result.
Huh? Should it answer "maybe"? There is a threshold, and you chose
your numbers right at that threshold.
- Bert -
More information about the Squeak-dev
mailing list
|