Lease this WebApp and get rid of the ads.
Ok. Maybe not bug, but undesirable. I dug further...
Wed Mar 8, 2017 1:05am

So after seeing your post I dug further into it thinking that the Win 3.1 calculator would give the wrong answer as well. It does not. I guess they had fixed it by then. I also tried "1 / 3 * 3" and it did equate to 1.

Win3.1 calc answer

Then I opened up Borland C++ 4.5. It's uses a 16 bit C++ compiler so I figured possibly just the raw float addition would show the same results here.

The result was correct here as well. I did a "setprecision" just in case I did that in the original code as well. (It's been so long I have no idea what the original code looks like).

bcpp45 with correct result

Finally, I opened up Turbo C++ 3.0 for DOS. This is very close to the original IDE/compiler combo the code was written in. I might have actually used a slightly older version of TC for NEC as I don't remember any syntax highlighting...

I was able to recreate the results here: (Double output in the output window because I ran the code twice)
tc3 recreates results

Not sure if any of this info is actually useful, just thought it was interesting I was able to recreate it.

  • It's not a bug... sorry.Puckdropper, Mon Mar 6 3:53am
    It's just a case of floating point math. I got the same answer from a floating point calculator I found online. Windows Calculator might actually give you the same result if you've got Windows 3.1... more
    • Ok. Maybe not bug, but undesirable. I dug further... ☻ Erik, Wed Mar 8 1:05am
Click here to receive daily updates
"Don't quote me." - Erik