View Single Post
03/01/19, 07:41 PM   #6
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Arkadius View Post
It looks like you're right, votan. The error is triggered by misbehaving floor functions.
It's not misbehaving floor function. It's because 308.09 cannot be expressed exactly in base 2 (as a sum of powers of two), thus cannot be stored exactly as 64-bit floating-point number. The nearest number that can be stored in 64-bit floating point is less than 308.09. That's the error, it happens when the number is parsed from string "308.09" into 64-bit floating point; but from there everything works as it should. Multiply something less than 308.09 by 100 and you get a number less than 30809. Floor that and you get 30808 (correct).
  Reply With Quote