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

In float32 land, if

    x   = 0.5   (with bit pattern 0x3f000000)
    y   = 0.25  (with bit pattern 0x3e800000)
then

    x+y = 0.75  (with bit pattern 0x3f400000)
But if we just added the bit patterns like integers, we would get 0x7d800000 (with a float value of over 10^37). Just because they are discrete doesn't mean they are integers only that they can be mapped one-to-one with integers. The bit pattern is not the semantic meaning of the value, and you cannot perform correct operations if you ignore the semantics.


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

Search: