Hacker News new | past | comments | ask | show | jobs | submit login

To bad it's the new one. I still recall the Win3.1 (or possibly 3.11 WFW) calc.exe returning 0 when calculating 2.11 - 2.1 . I've always been curious to know what could have triggered that error since it was too big to remain unnoticed for so much time.



I tried it in the "Archive.org Windows 3.11 in a browser" and it returns "0.01".

https://archive.org/details/win3_stock


Ah, now confirmed...exists in Windows 3.1, fixed in 3.11

You can try Windows 3.1 here: https://www.pcjs.org/software/pcx86/sys/windows/3.10/

And, indeed, 2.11 - 2.1 = 0.00

But, if you then add 1.0, you get 1.01. So the right value is there somewhere.


There was a dead comment from another HN person that was actually quite helpful here. Not sure why it was dead, so here's a copy/paste:

"It was fixed in this update for Windows 3.1, which switched away from floating point: https://jeffpar.github.io/kbarchive/kb/124/Q124345/"


It was fixed in this update for Windows 3.1, which switched away from floating point: https://jeffpar.github.io/kbarchive/kb/124/Q124345/


Here's another test I do with calculator apps (in radians): Pi - 4 * ATAN(1)

These apps really should produce 0 for this and avoid floating point issues. Most of us understand why it wouldn't. To me it's an experience/quality issue.

For what it's worth, the default Android calc app produces 0 (as well as nice RPN apps like Droid48).


My go to calculator is spotlight search on my mac. Pleased to announce that it gives 0 for this.


The macOS calculator, on the other hand, has a totally ridiculous bug: it displays "Not a number" for any negative number that you try to take e^x of. 2^x and 10^x work fine, as does using the x^y button with base e. Typing "e^(-whatever)" on the Spotlight search works, as does e^x of -whatever in the iOS calculator app.


I just use a wolframalpha for everything these days. It uses symbolic computation so there's no possibility for problems like this, and it's a lot more powerful than any built-in calculator app. Almost anything can be typed in one line with natural English directives like "300mi/14mpg * $2.7/gal to Euros". Especially convenient with a browser keyword.


Check out Qalculate![1] for a program that does that and much more (though obviously not as much as WA).

1: http://qalculate.github.io/


I usually use Google for quick calculations but get annoyed when it only returns large results in scientific notation. WolframAlpha gives results in just about every conceivable way, e.g. "7 trillion" or "7 000 000 000 000" instead of 7e+12. Much nicer for someone like me who isn't used to scientific notation.


But Spotlight is just cmd-space away at all times. My only complaint is that I can't get results for date-based queries like "days since 17 Jan 2021" or "50 days from today" and I have to go to Google for those although I can at least just hit return after entering the query to have the result pop up in Safari.


My biggest complaint after switching to Windows is how poorly the start menu does math. Half the time it tells me "results are unavailable" for simple arithmetic... I don't know if it makes a web query or something to calculate but it's frustrating.


Alfred also computes it to 0


Another comment suggested they switched from floating point to rational number representations after that version. Since 2.11 and 2.1 can't be represented exactly in floating point, it's possible that the issue was the difference was too small (smaller than just .01) and was being rounded off (or was below the limit for number of digits to display).


Try 2.11 - 2.1 here: http://weitz.de/ieee/ . I don't think they used 32-bit floating point, otherwise there should clearly be a large enough number to display.


in that era, you might or might not have had FPU hardware; where it didn't exist or was off there were a variety of libraries with their own quirks that got used.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: