News for hackers. Stuff that matters.
Re:Excel_to_code – Converts some Excel spreadsheets to C by jscottmiller on Friday July 24, 2015 @08:27PM (#9946028)
Wow, didn't realize that about excel (though I have observed it in google sheets). I wonder how many hedge funds rely on sheets with catastrophic cancellation issues.
Re:Excel_to_code – Converts some Excel spreadsheets to C by ma2rten on Friday July 24, 2015 @11:39PM (#9946451)
I tried 0.1 + 0.2 in both google docs and excel. I got 0.3000000000000000000, not 0.30000000000000004, like you normally would using floating point.
Re:Excel_to_code – Converts some Excel spreadsheets to C by teraflop on Saturday July 25, 2015 @01:38AM (#9946684)
I think there's internal rounding that hides it. Try A1=1e50, B1=A1+1, and C1=B1-A1.

Excel definitely used floating point in the past (because you used to be able to use it to test for the Pentium FDIV bug) and according to the documentation, it still does: https://support.microsoft.com/en-us/kb/78113

Re:Excel_to_code – Converts some Excel spreadsheets to C by timrobinson on Saturday July 25, 2015 @03:05AM (#9946824)
Rounding happens when the value is displayed. To see the raw value, try: =(0.1+0.2)
Re:Excel_to_code – Converts some Excel spreadsheets to C by AceJohnny2 on Friday July 24, 2015 @08:42PM (#9946084)
I expect all financial math is fixed point.
Re:Excel_to_code – Converts some Excel spreadsheets to C by timrobinson on Saturday July 25, 2015 @03:10AM (#9946834)
It's absolutely not. Everything I've seen has been 64-bit double. If you need to, you round either intermediate or final calcs to a set precision.

I once worked on replicating a particular index, and the engine used fixed point internally. In order to get the values to match with the ones published officially, we had to emulate Excel floating point: our fixed point values wouldn't line up with theirs.

Re:Excel_to_code – Converts some Excel spreadsheets to C by chillingeffect on Friday July 24, 2015 @11:33PM (#9946446)
I'm not sure why ppl downvoted you. But from what I've heard - never implemented myself - what you're saying is common... At least as far as using separate fixed point values to represent the left and right sides of the decimal place.

Now I'm sure for things like computing interest by raising things to a power or even computing percentages, etc, floating point is used (and eventually reduced to fixed point values), so maybe someone found it too absolute to say "all" financial math is fixed point? Anyway, if someone with experience can confirm or deny, it would be neat...

Re:Excel_to_code – Converts some Excel spreadsheets to C by JupiterMoon on Saturday July 25, 2015 @07:50AM (#9947320)
Because he is wrong? Excel uses 64 bit floats.