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

Agreed, knowing how 1/x behaves for x in [null, 0, void 0] is helpful. Specifically, don't expect a "div by 0" error to be thrown. Instead, check for infinity. That's not something a C# developer would necessarily expect.


Yes, unfortunately many languages have borrowed C's rather bizarre ideas about what's permissible. 1/0 should crash but it's perfectly okay for 0xffffffffu + 1 to give different answers depending on your architecture.


Dividing a float by zero yields infinity (or -infinity) in C# as well.




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

Search: