handling T.min the right way
Pragma
ericanderton at yahoo.removeme.com
Mon Mar 19 12:38:07 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
> 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
PS, the guy you really need to ask is Don. He seems to be the (if not one of a handful of) math/FP guru around here. ;)
--
- EricAnderton at yahoo
More information about the Digitalmars-d
mailing list