Bytes suck!



  • Could someone with more computer-arithmetic clout than I, explain why, in BLOCKED SCRIPT


    var pulse = 0.8;

    var pulseComplement =  1 - pulse;



    causes:

    pulseComplement == 0.19999999999999995





    Why does the thing treat 0.8 as 0.80000000000000005?



    PS.

    That's in IE. Firefox produces 0.1999999999999999[b]6[/b]



    How hard is it to store 0.8? When did 8e-1 become irrational? What am I missing?



    PSII

    It's a tiny, tiny error, and doesn't cause much trouble in the way of pixel-precision, so the question is largely academic.



  • Thank you.



  • If only you had thought of making the topic title a play on words..

    Bytes bite!



  • @elnerdo said:

    If only you had thought of making the topic title a play on words..

    Bytes bite!





    Byte me.


Log in to reply