1

I finally got my infinitely zooming grid to work and tried out how much I can zoom. Everything worked fine until around 15,000,000,000,000x magnification where it got jerky and didn't move right anymore so I figured I had hit the limit of precision of whatever variable type its using. Then I tried zooming out and expected a similar limit but 5 minutes later, at magnification of 0.00000-insert 100 zeros here-0014829095701452545 it was still doing great. If 1 was 1m then that in relation would be Planck length inside a Planck length inside a Planck length. Crazy!

So not really a problem question but a curiosity one - What kind of types does javascript use for floats? and why is it capable of using much longer tiny numbers than big numbers?

3
  • Did you try several interpreters and see the same behaviour? Commented Jun 22, 2014 at 22:01
  • 1
    Google "floating point numbers". Commented Jun 22, 2014 at 22:03
  • yes I did, same thing on both opera 12 and chrome 35 Commented Jun 22, 2014 at 22:03

1 Answer 1

2

The problem is where the precision loss is.

When you have a huge number, you start losing precision around the units, which can cause huge problems.

With a really tiny number, your precision loss is at very low decimal places, where you'd have precision loss due to not having enough digits to store the number anyway. So there's no real problem here.

Does that make sense? Basically it's the difference between:

1234567890123457000 -- big precision loss (321)
0.00000001234567890123457 -- tiny precision loss (0.000000...0001)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.