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

Re: (10^100)+1-(10^100)

i) Answer is 0 if you cancel out two expression (10^100)

ii) Answer is 1 if you compute 10^100 and then add 1 which is insignificant.

How do you even cater for these scenarios? This needs more than arithmetic.




Uh, what do you mean? The answer is very obviously 1 no matter what.


Obviously it is 1.

But try it on iOS calculator, answer is 0.

Reason is when computing large numbers e.g. 100000........n + 1 - 100000........n, addition of 1 is pretty in-significant.


Yes, if you use limited-precision data types. But you have it the wrong way, if you first cancel out the $BIGNUM (ie. reorder to $BIGNUM - $BIGNUM + 1) the answer is 1; if you first evaluate $BIGNUM+1, the answer is 0 because $BIGNUM+1 has no representation distinct from $BIGNUM. Limited-precision arithmetic is not, in general, associative. Still arithmetic, though, just not in the ring of integers. But the whole point of the article was that it's, of course, possible to do better and get exact results.


>The answer is very obviously 1 no matter what

no, because only in our imaginations and in no place in the universe can we ignore significance of measurements. If we are sending a spaceship to an interstellar object 1 light year away from earth, and the spaceship is currently 25 miles from earth (on the way), you are insisting that you know more about the distance from earth to the object than you do if you think that that distance from the spaceship to the galaxy is 587862819274.1 miles


You are discussing physics. Everyone else in this thread is discussing mathematics. Sorry but you are the one who's off topic.


why would a computer make the mistake that EVERYONE HERE CAN'T GROK?

for the reasons in my comment, and in, according to you, nobody else's.

also, the commment I was replying to said "1 no matter what" and I was pointing out where it would matter what.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: