handling T.min the right way

Lionello Lunesu lio at lunesu.remove.com
Tue Mar 20 14:37:27 PDT 2007


BCS wrote:
> Lionello Lunesu wrote:
>> Lionello Lunesu wrote:
>>
>>> Frits van Bommel wrote:
>>>
>>>> Lionello Lunesu wrote:
>>>>
>>>>> "Andrei Alexandrescu (See Website For Email)" 
>>>>> <SeeWebsiteForEmail at erdani.org> wrote in message 
>>>>> news:45FEE0BC.4000407 at erdani.org...
>>>>>
>>>>>> The right way is to have T.min always return the minimum value 
>>>>>> (duh) and define a separate property T.min_positive.
>>>>>
>>>>>
>>>>> Isn't this value sometimes also called "epsilon"? I think 
>>>>> double.epsilon sounds quite nice :)
>>>>
>>>>
>>>> Epsilon is already used for a related concept:
>>>> ".epsilon -- smallest increment to the value 1" 
>>>> (http://www.digitalmars.com/d/property.html)
>>>
>>>
>>> Huh, I thought it sounded familiar.
>>>
>>> So epsilon is such that 1.0+epsilon!=1.0, and the 'min' we're talking 
>>> about is such that 0.0+min_positive!=0.0 ? I didn't know these were 
>>> both useful values.... I wonder how they're actually being used.
>>>
>>> L.
>>
>>
>> Nevermind, I think I get it. epsilon reflects the smallest exponent, 
>> whereas min_positive represents the reflects the resolution of the 
>> mantissa.
> 
> Actually I think that is backwards. Epsilon reflects the number of bits 
> in the mantissa and min_positive reflects the smallest exponent.

I think you're right :) Goes to show how bad their names really are :)

L.



More information about the Digitalmars-d mailing list