www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - .sign property for floating point types...

I was reading the D.pdf file, checked the Web site and was curious about why the
sign property would return "1 if -, and 0 if +"?  Is this the same for integral
types?

I would think that there should really be two sign properties for either integer
and floating point types.  Each with the following conditions,

sign returns -1 if <0, 0 if 0 and +1 if > 0.
sgn returns 0 if <0 and 1 if >= 0.

Part of the reason for this is because 0 is neither negative or positive, but 0

Peter  
May 02 2004