OT: Leaving Rust gamedev after 3 years
bachmeier
no at spam.net
Mon Apr 29 14:58:00 UTC 2024
On Monday, 29 April 2024 at 13:29:40 UTC, Monkyyy wrote:
> So, if you live in the current world you should dislike nan?
Programming is a big world.
For the things I do, nan works well. I've had to point out many
times here and elsewhere that 0 is a great default if you're
going to calculate a sum. If you're taking a product, it's an
absolute disaster, and it's hard to detect unless you end up with
something like a division by zero. At least nan doesn't work its
way through the system silently, and it's easy to test for
errors, unlike the case of 0.
If nan is a problem, then `double x;` shouldn't compile. Setting
x to 0 is no better for correctness than setting it to a random
number. Either way, you're pretending the compiler knows what it
should be, and that's impossible.
More information about the Digitalmars-d
mailing list