10
crisz
7y

FUCK IEEE 754.
I've always thought that javascript's problem with floating points was just a good anecdote, but it couldn't have serious consequences in real life programming.

Until I've been stuck half an hour with a bug just because (2.8-0.8)%2 was falsy! FUCK, why don't decide to switch to a decent codification of numbers? Fuck them and fuck all programming languages like this

Comments
  • 1
    Why did you extract modulo of a possible fractial? :-D
    Anyway, it seems legit to be falsy. 2.8 - 0.8 => 2.000?
    That %2 => 0-ish => false :-D
  • 2
    Mr JavaScript, the good parts himself Douglas Crockford has touched on this himself and proposed a solution, not just for JavaScript but for programming languages in general: http://dec64.com/
  • 0
    @mt3o Yeah it *should* be falsy, but isn't:

    > (2.8-0.8)%2
    < 1.9999999999999998
    > !!((2.8-0.8)%2)
    < true
  • 0
    Sorry, my mistake, it was meant to be falsy*
  • 0
    That changes a lot!
Add Comment