Mod(2.01,int(2.01))=0.01 returns false
Hi @Brian, thanks for reporting. Really not a bug, but a hardware limitation, please take a look to https://bugs.freedesktop.org/show_bug.cgi?id=50299#c4.
Another symptom of floating-point arithmetic being imperfect. If you bump-up precision to 20 places, you see: Value: 2.01000000000000000000 INT(Value): 2.00000000000000000000 MOD(Value, INT(Value)): 0.00999999999999979000 When you compare 0.01000000000000000000 and 0.00999999999999979000, Calc (correctly) says that they're not the same. I'm not sure if Calc has a built-in EQUAL_WITHIN_TOLERANCE() function, but you can use this for the purpose: =(ABS($CELL_OF_FIRST_VALUE - $CELL_OF_SECOND_VALUE) < 0.0000000000001) Making sure that two values are less than 1e-12 different should be close enough for most purposes :-) See: Bug 67026 - Other: Limitations in Calc precision need to be documented
Created attachment 166070 [details] sample_that_correct_math_is_possible_in_calc @m.a.riosv: disagree ... see attached sheet, hardware limitation? no, weak, but doesn't forbid meaningful calculations, kohei: 'So it's a hardware problem.' - the software is responsible for what it does with the hardware, 'Anything we try to do at software level would be hacky and prone to other, more serious errors,' - anything? really anything??? who gives up can no longer win, 'including significant performance impact.' - si, but hardware and performance improve steadily, this statement is 8 years old, thus outdated by a performance factor of 16, 'IMO we should leave this alone.' - imho not, users won't let us alone with their correct questions about incorrect results, math is an exact science - tries to be - we should try to keep up ... this bug is! a bug as the result is mathematically incorrect, and it is! a bug as better results are possible, see attachement,
besides ... 50299 is! resolved / fixed ...
Dear Brian Prasse, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Still repro in Version: 7.5.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: ddb8a1a282aae74c1cee3a5e1f446abd0c00b116 CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win Locale: ru-RU (ru_RU); UI: en-US Calc: threaded