fe icon indicating copy to clipboard operation
fe copied to clipboard

Is this a floating point problem?

Open stacksmith opened this issue 2 years ago • 1 comments

A simple loop locks up:

(= i 0)
(while (< i 19000000)
   (= i (+ i 1)))

Is there a preferred way to count?

stacksmith avatar Jun 12 '23 01:06 stacksmith

Yes, this is a problem related to floating point numbers. After number 16777216 for 4-byte float the accuracy drops, and incrementation has no effect.

ooichu avatar Jun 12 '23 10:06 ooichu