Sep 06, 2023 01:59 PM
ROUNDUP is returning unexpected results.
See screenshots, there are 3 records where ROUNDUP is increasing the value rather than truncating a '0' (I was expecting 0.070 roundup to be 0.07) Is this an error, or am I not understanding ROUNDUP correctly?
2nd screenshot added the FLOOR function as suggested in this pos, but had no impact to the results.: Solved: Re: ROUNDUP(number, 2) Incorrect rounding - Airtable Community
thanks for any insights!
Solved! Go to Solution.
Sep 07, 2023 04:28 AM
All of them. This list demonstrates there is a preponderance of evidence that the Java floating point bug is what you may be encountering.
https://ellenaua.medium.com/floating-point-errors-in-javascript-node-js-21aadd897bf8
https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-java...
Sep 06, 2023 02:14 PM
The infamous Java floating point error?
Sep 06, 2023 05:59 PM
Are the "Crate Weight" numbers rounded off by format?
That would also change the result.
But why does ROUNDUP turn 0.55000 into 0.56?
I don't usually use ROUNDUP so it's not a problem, but is this a bug?
How about this ugly workaround?
Cut off to 3 decimal place and rounded up to 2 decimal place
ROUNDUP(INT({Num}*1000),-1)/1000
Cut off to 4 decimal place and rounded up to 2 decimal place
ROUNDUP(INT({Num}*10000),-2)/10000
Sep 06, 2023 08:18 PM
Sep 06, 2023 08:39 PM
No, there doesn't seem to be one that would be helpful, but which one specifically?
Sep 07, 2023 04:28 AM
All of them. This list demonstrates there is a preponderance of evidence that the Java floating point bug is what you may be encountering.
https://ellenaua.medium.com/floating-point-errors-in-javascript-node-js-21aadd897bf8
https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-java...
Sep 07, 2023 03:25 PM
Thanks for the article! The Stackoverflow article was especially helpful.
I don't know much about programming so I didn't know it was a common problem.
In Airtable's case, it seems like a better way to calculate it as an integer for now.