int nan

bearophile bearophileHUGS at lycos.com
Sun Jun 28 12:57:18 PDT 2009


grauzone:
> That wasn't very explicit. Anyway, we need int.min for, you know, doing 
> useful stuff.

Like for what? Have you used a Lisp? Their tagged integers show that a smaller range is fine. And I'm just talking about 1 value in 4 billions, I don't think you will miss it much. And it's a value that has no symmetric positive.


>We can't just define a quite random number to be a special value.<

It's not a random value, is a specific one, and it's an asymmetric extrema too.


> Checking math operations for nullable integers would also be 
> quite expensive (you had to check both operands before the operation).

I was talking about a hardware-managed nan of ints, shorts, longs, tinys. That's why I have defined the original posts of musings.


> Although it's pointless to discuss about implementation details of a 
> feature that will never be implemented, what do you think?

Inventions sometimes come from dreams too :-)


> PS: I'd prefer "checked" math operations (as in C#, I think) over 
> int.nan. Overflows or illegal operations would just trigger exceptions.

I'll do my best to have them in LDC (LLVM supports them already!), it's probably the only new feature I'll ask to LDC developers. If necessary I may even create a personal version of LDC that has this single extra feature.

Bye,
bearophile



More information about the Digitalmars-d mailing list