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

Today I learned:

SELECT 1 / 0 AS var_name;

yields a double with value infinite. Which is SQL spec. Must be fun times to actually use that :-)



IEEE 754 defines the result of divisions and multiplications involving NaN and Inf, which are used extensively in graphics programming.

For example, 'select 1.0/(1.0/0.0)' becomes 0.0 again. This allows for inf/nans to be canceled out instead of having to do error checking and exception handling every time one crops up.




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

Search: