3 ms·
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
by politician 14y ago
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.
- svachalek 14y agoYes, 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.
- nemetroid 14y agoDividing a float by zero yields infinity (or -infinity) in C# as well.