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

What's an example of 0 having a sign being useful?


If you're seriously interested, read Kahan's "Branch Cuts for Complex Elementary Functions (or: Much Ado About Nothing's Sign Bit)".

TLDR: there are some classes of problems for which the sign bit of zero preserves enough important information to get an accurate solution to a problem that would not be possible if you only had an unsigned zero. These happen to turn up in certain types of conformal mappings that are useful for solving certain PDEs.


1/(0-0) = -∞, 1/(0+0) = ∞


Actually, (0-0) evaluates to +0 in the default rounding mode, so both of those expressions will typically return +∞.

1/-0 will give you -∞, of course.


Well, I meant it as in math notation, not in C.

(Strictly speaking, 1/0 in C is kaboom! (undefined behaviour))




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

Search: