handling T.min the right way
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Mon Mar 19 12:13:00 PDT 2007
A while ago, C++ did the mistake of defining
std::numeric_limits<T>::min() with a different semantics for
floating-point types than for integral types. That hurt generic numeric
code a lot.
D has taken over the same mistake: T.min means the smallest value of the
type, except for floating-point types, where it means the smallest
positive value.
The right way is to have T.min always return the minimum value (duh) and
define a separate property T.min_positive.
The question is, would a lot of code be hurt by such a change?
Andrei
More information about the Digitalmars-d
mailing list