handling T.min the right way

James Dennett jdennett at acm.org
Tue Mar 20 22:09:18 PDT 2007


Walter Bright wrote:
> 0ffh wrote:
>> Don Clugston wrote:
>>> completely different. (For example, I don't know why x++ is legal for
>>> floating point types; I think it's just a newbie trap; you have no
>>> guarantee that x++ is different to x).
>>
>> Nope, not at all.
>> Standard C defines that after "x++" x is incremented by one, exactly -
>> *even for fp types* !
> 
> For floating point types, if x happens to be +-infinity then x+1==x.

Or, most likely, even if x happens to be 1E100.  I've not
had the pleasure of working on hardware which supported
floating point accurate enough to distinguish 1E100 from
1+1E100.

-- James




More information about the Digitalmars-d mailing list