handling T.min the right way

David B. Held dheld at codelogicconsulting.com
Wed Mar 21 01:21:46 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.

Wow, that's almost correct transfinite arithmetic.  Technically 
speaking, 1 + oo == oo, but oo + 1 != oo.  IEEE should really fix that. ;>

Dave



More information about the Digitalmars-d mailing list