| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 function native_NumberImplementation_BIT_OR(other) { | 6 function native_NumberImplementation_BIT_OR(other) { |
| 7 native__NumberJsUtil__throwIllegalArgumentException(other); | 7 native__NumberJsUtil__throwIllegalArgumentException(other); |
| 8 } | 8 } |
| 9 | 9 |
| 10 function native_NumberImplementation_BIT_XOR(other) { | 10 function native_NumberImplementation_BIT_XOR(other) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 "use strict"; | 149 "use strict"; |
| 150 return (this == Infinity) || (this == -Infinity); | 150 return (this == Infinity) || (this == -Infinity); |
| 151 } | 151 } |
| 152 | 152 |
| 153 function native_NumberImplementation_toDouble() { | 153 function native_NumberImplementation_toDouble() { |
| 154 "use strict"; | 154 "use strict"; |
| 155 return +this; | 155 return +this; |
| 156 } | 156 } |
| 157 | 157 |
| 158 function native_NumberImplementation_toString() { | 158 function native_NumberImplementation_toString() { |
| 159 return this.toString(); | 159 "use strict"; |
| 160 var primitiveValue = +this; |
| 161 // TODO(floitsch): is there a faster way to detect -0? |
| 162 if (primitiveValue == 0 && (1 / primitiveValue) < 0) { |
| 163 return "-0.0"; |
| 164 } |
| 165 return "" + primitiveValue; |
| 160 } | 166 } |
| 161 | 167 |
| 162 function native_NumberImplementation_toStringAsFixed(fractionDigits) { | 168 function native_NumberImplementation_toStringAsFixed(fractionDigits) { |
| 169 var primitiveValue = +this; |
| 170 // TODO(floitsch): is there a faster way to detect -0? |
| 171 if (primitiveValue == 0 && (1 / primitiveValue) < 0) { |
| 172 return "-" + this.toFixed(fractionDigits); |
| 173 } |
| 163 return this.toFixed(fractionDigits); | 174 return this.toFixed(fractionDigits); |
| 164 } | 175 } |
| 165 | 176 |
| 166 function native_NumberImplementation_toStringAsPrecision(precision) { | 177 function native_NumberImplementation_toStringAsPrecision(precision) { |
| 178 var primitiveValue = +this; |
| 179 // TODO(floitsch): is there a faster way to detect -0? |
| 180 if (primitiveValue == 0 && (1 / primitiveValue) < 0) { |
| 181 return "-" + this.toPrecision(precision); |
| 182 } |
| 167 return this.toPrecision(precision); | 183 return this.toPrecision(precision); |
| 168 } | 184 } |
| 169 | 185 |
| 170 function native_NumberImplementation_toStringAsExponential(fractionDigits) { | 186 function native_NumberImplementation_toStringAsExponential(fractionDigits) { |
| 187 var primitiveValue = +this; |
| 188 // TODO(floitsch): is there a faster way to detect -0? |
| 189 if (primitiveValue == 0 && (1 / primitiveValue) < 0) { |
| 190 return "-" + this.toExponential(fractionDigits); |
| 191 } |
| 171 return this.toExponential(fractionDigits); | 192 return this.toExponential(fractionDigits); |
| 172 } | 193 } |
| 173 | 194 |
| 174 function native_NumberImplementation_toRadixString(radix) { | 195 function native_NumberImplementation_toRadixString(radix) { |
| 175 return this.toString(radix); | 196 return this.toString(radix); |
| 176 } | 197 } |
| 177 | 198 |
| 178 function native_NumberImplementation_hashCode() { | 199 function native_NumberImplementation_hashCode() { |
| 179 "use strict"; | 200 "use strict"; |
| 180 return this & 0xFFFFFFF; | 201 return this & 0xFFFFFFF; |
| 181 } | 202 } |
| OLD | NEW |