Need a std::numeric_limits<T>::lowest() equivalent

Xavier Bigand via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 21 07:55:35 PST 2017


Le 21/01/2017 à 10:54, John Colvin a écrit :
> On Saturday, 21 January 2017 at 00:03:11 UTC, Xavier Bigand wrote:
>> std::numeric_limits<T>::lowest() is describe as "A finite value x such
>> that there is no other finite value y
>>        *  where y < x."
>
> According to what I presume that definition means ("no other finite
> value" means "no other finite value representable in T"), that's just
> IntegerT.min or -FloatingT.max respectively. Shared numeric logic
> between integer and floating types is generally a bad idea in my
> experience, what's a compelling use-case for "lowest"?

I don't see any other use case than for initialized maths struct to an 
invalid state, and because it is generally in template that working with 
integers and floats it is easier to have same properties (when it have 
the same meaning).



More information about the Digitalmars-d mailing list