Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another caveat: for negative numbers, the bit-or rounds to zero while the floor rounds to negative infinity:

    > -0.5
    -0.5

    > (-0.5)|0
    0

    > Math.floor(-0.5)
    -1


A fine example why this sort of "who needs the specs, FULL SPEED AHEAD" hyper-optimization can get people into trouble.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: