Output: false :/

That got me stuck for quite a while..

Learned more about floating point arithmetic and representation 😊

  • 8
    That's a common issue when you have algorithms that iterate over a floating point interval (integration comes to mind). You either use steps of 1/8, 1/16 etc., that is the fastest solution. Or if you absolutely need 0.1, 0.01 etc. as steps, you take an integer as loop variable, and in the loop, you cast it to float and divide it by 10.0, 100.0 etc.
  • 2
    I did a rant about it once upon a time

  • 7
  • 0
    @FMashiro that is one sick domain
  • 1
    I don't know why people always mention javascript lol almost every language does it
  • 0
    @crisz To summon people like you 😎
  • 1
    @crisz because there's a lot more Javascript developers who don't have the slightest idea about how a computer deals with their programs on a lower level.

    Also because there's a lot more js developers.

    Btw, I'm not saying js developers are less competent or whatever, just that on average, they are less aware of low level stuff.
Your Job Suck?
Get a Better Job
Add Comment