News for hackers. Stuff that matters.
Re:42 is found to be the sum of three cubes by whitehouse3 on Friday September 06, 2019 @10:47AM (#20896118)
Why doesn't this evaluate in Excel?

=(-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3

Returns 1.09785E+36

Re:42 is found to be the sum of three cubes by Tuna-Fish on Friday September 06, 2019 @10:54AM (#20896179)
Because the numbers cubed are way larger than the numbers that Excel can represent precisely. Excel uses 64-bit IEEE 754 floats for all arithmetic. They can be used to accurately describe integers smaller than 2^53, or ~10^16. The first number cubed is ~-5*10^50, so you are very clearly outside the range where excel is precise.

You should not use Excel to do any serious mathematics, or really anything else where numerical precision is important.

Re:42 is found to be the sum of three cubes by colejohnson66 on Friday September 06, 2019 @02:25PM (#20898313)
Why is it that a program that people use for accounting doesn’t use arbitrary precision arithmetic?
Re:42 is found to be the sum of three cubes by jz391 on Friday September 06, 2019 @02:44PM (#20898540)
Because for accounting the numbers easily fit in the supported range; even the US National Debt (https://www.usdebtclock.org/)...
Re:42 is found to be the sum of three cubes by julienchastang on Friday September 06, 2019 @12:05PM (#20896855)
No need to downvote this comment. It is a legitimate numerical computation question and one that has interesting answers as evidenced by this sub-thread. Not everyone knows about how computers do floating point arithmetic, handles large ints, or otherwise.
Re:42 is found to be the sum of three cubes by omaranto on Friday September 06, 2019 @11:06AM (#20896284)
You need more precision. Try this in your browser console instead, using the new BigInt type in JavaScript:

    (-80538738812075974n)**3n + 80435758145817515n**3n + 12602123297335631n**3n
Re:42 is found to be the sum of three cubes by conjectures on Friday September 06, 2019 @11:00AM (#20896239)
Welcome to numerical computing :D!

Btw:

julia> (-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3

42

Re:42 is found to be the sum of three cubes by wglb on Friday September 06, 2019 @12:16PM (#20896958)
Or

  CL-USER> (+ (expt -80538738812075974 3)  (expt 80435758145817515 3)  (expt 12602123297335631 3))
  42
Re:42 is found to be the sum of three cubes by pfd1986 on Friday September 06, 2019 @10:53AM (#20896175)
Re:42 is found to be the sum of three cubes by LandR on Friday September 06, 2019 @10:56AM (#20896199)
Re:42 is found to be the sum of three cubes by nathanm412 on Friday September 06, 2019 @11:02AM (#20896249)
Re:42 is found to be the sum of three cubes by timerol on Friday September 06, 2019 @11:14AM (#20896358)
Excel is probably coercing them to floating point, instead of using infinite-precision integers. Wolfram-Alpha gets it right: https://www.wolframalpha.com/input/?i=%28-80538738812075974%...
Re:42 is found to be the sum of three cubes by dagw on Friday September 06, 2019 @10:53AM (#20896163)
Excel can't to math on arbitrarly large ints, so tuncates all the numbers and gives you the wrong result
Re:42 is found to be the sum of three cubes by tejtm on Friday September 06, 2019 @02:19PM (#20898246)
Sadly `awk/gwak` fails as well returning

   198929873392615583518074640613244928
I take that back, needs the `M` flag

awk -M 'END{print (-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3}' /dev/null

42

but `bc` of course works

echo '(-80538738812075974)^3 + 80435758145817515^3 + 12602123297335631^3' | bc

42

Re:42 is found to be the sum of three cubes by outside1234 on Friday September 06, 2019 @10:52AM (#20896153)
Integer overflow?
Re:42 is found to be the sum of three cubes by tempWinHater on Friday September 06, 2019 @11:14AM (#20896367)
Works in Windows calculator.