Ticket #524: Float_sign.patch
| File Float_sign.patch, 0.9 kB (added by Deewiant, 1 year ago) |
|---|
-
Float.d
old new 27 27 28 28 private import Integer = tango.text.convert.Integer; 29 29 30 private import tango.math.IEEE : signbit; 31 30 32 private alias real NumType; 31 33 32 34 private extern (C) NumType log10l(NumType x); … … 134 136 return digit + '0'; 135 137 } 136 138 137 if (x !<>= x)138 return "nan";139 140 if (x is x.infinity)141 return "inf";142 143 int exp;144 139 bool sign; 145 140 146 141 // extract the sign 147 if ( x < 0.0)142 if (signbit(x)) 148 143 { 149 144 x = -x; 150 145 sign = true; 151 146 } 152 147 148 if (x !<>= x) 149 return cast(T[])(sign ? "-nan" : "nan"); 150 151 if (x is x.infinity) 152 return cast(T[])(sign ? "-inf" : "inf"); 153 154 int exp; 155 153 156 // don't scale if zero 154 157 if (x > 0.0) 155 158 {










