29

*Fun with Javascript
`Math.ceil(1.0000000000000001) // output = 1`
`Math.ceil(1.000000000000001) // output = 2`

I hope it'll lit a spark in your mind.

Comments
  • 10
    The first is 1, because 1.0000000000000001 is considered equal to 1, because of float precision.
  • 20
    "Those who use java script for floating point operations are doomed."
    - me, just now.
  • 27
    Not just JS. Any language that allows one to work with Floating Point values.

    People don't know how to work with floating point numbers. Stop blaming languages or platforms for this.
  • 14
    Learn to float.
  • 1
    Ppl that trash the language/platform for something they don't understand 🔪🔪
Add Comment