| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 | |
| 6 function native_NumberImplementation_BIT_OR(other) { | |
| 7 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 8 } | |
| 9 | |
| 10 function native_NumberImplementation_BIT_XOR(other) { | |
| 11 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 12 } | |
| 13 | |
| 14 function native_NumberImplementation_BIT_AND(other) { | |
| 15 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 16 } | |
| 17 | |
| 18 function native_NumberImplementation_SHL(other) { | |
| 19 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 20 } | |
| 21 | |
| 22 function native_NumberImplementation_SAR(other) { | |
| 23 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 24 } | |
| 25 | |
| 26 function native_NumberImplementation_BIT_NOT() { | |
| 27 throw Error('UNREACHABLE'); | |
| 28 } | |
| 29 | |
| 30 function native_NumberImplementation_ADD(other) { | |
| 31 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 32 } | |
| 33 | |
| 34 function native_NumberImplementation_SUB(other) { | |
| 35 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 36 } | |
| 37 | |
| 38 function native_NumberImplementation_MUL(other) { | |
| 39 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 40 } | |
| 41 | |
| 42 function native_NumberImplementation_DIV(other) { | |
| 43 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 44 } | |
| 45 | |
| 46 function native_NumberImplementation_TRUNC(other) { | |
| 47 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 48 } | |
| 49 | |
| 50 function native_NumberImplementation_MOD(other) { | |
| 51 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 52 } | |
| 53 | |
| 54 function native_NumberImplementation_negate() { | |
| 55 throw Error('UNREACHABLE'); | |
| 56 } | |
| 57 | |
| 58 function native_NumberImplementation_EQ(other) { | |
| 59 throw Error('UNREACHABLE'); | |
| 60 } | |
| 61 | |
| 62 function native_NumberImplementation_LT(other) { | |
| 63 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 64 } | |
| 65 | |
| 66 function native_NumberImplementation_GT(other) { | |
| 67 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 68 } | |
| 69 | |
| 70 function native_NumberImplementation_LTE(other) { | |
| 71 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 72 } | |
| 73 | |
| 74 function native_NumberImplementation_GTE(other) { | |
| 75 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 76 } | |
| 77 | |
| 78 | |
| 79 function number$euclideanModulo(a, b) { | |
| 80 var result = a % b; | |
| 81 if (result == 0) { | |
| 82 return 0; // Make sure we don't return -0.0. | |
| 83 } else if (result < 0) { | |
| 84 if (b < 0) { | |
| 85 return result - b; | |
| 86 } else { | |
| 87 return result + b; | |
| 88 } | |
| 89 } | |
| 90 return result; | |
| 91 } | |
| 92 | |
| 93 function native_NumberImplementation_remainder(other) { | |
| 94 "use strict"; | |
| 95 if (typeof other != 'number') { | |
| 96 native__NumberJsUtil__throwIllegalArgumentException(other); | |
| 97 } | |
| 98 return this % other; | |
| 99 } | |
| 100 | |
| 101 function native_NumberImplementation_abs() { | |
| 102 "use strict"; | |
| 103 return Math.abs(this); | |
| 104 } | |
| 105 | |
| 106 function native_NumberImplementation_round() { | |
| 107 "use strict"; | |
| 108 return Math.round(this); | |
| 109 } | |
| 110 | |
| 111 function native_NumberImplementation_floor() { | |
| 112 "use strict"; | |
| 113 return Math.floor(this); | |
| 114 } | |
| 115 | |
| 116 function native_NumberImplementation_ceil() { | |
| 117 "use strict"; | |
| 118 return Math.ceil(this); | |
| 119 } | |
| 120 | |
| 121 function native_NumberImplementation_truncate() { | |
| 122 "use strict"; | |
| 123 return (this < 0) ? Math.ceil(this) : Math.floor(this); | |
| 124 } | |
| 125 | |
| 126 function native_NumberImplementation_isNegative() { | |
| 127 "use strict"; | |
| 128 // TODO(floitsch): is there a faster way to detect -0? | |
| 129 if (this == 0) return (1 / this) < 0; | |
| 130 return this < 0; | |
| 131 } | |
| 132 | |
| 133 function native_NumberImplementation_isEven() { | |
| 134 "use strict"; | |
| 135 return ((this & 1) == 0); | |
| 136 } | |
| 137 | |
| 138 function native_NumberImplementation_isOdd() { | |
| 139 "use strict"; | |
| 140 return ((this & 1) == 1); | |
| 141 } | |
| 142 | |
| 143 function native_NumberImplementation_isNaN() { | |
| 144 "use strict"; | |
| 145 return isNaN(this); | |
| 146 } | |
| 147 | |
| 148 function native_NumberImplementation_isInfinite() { | |
| 149 "use strict"; | |
| 150 return (this == Infinity) || (this == -Infinity); | |
| 151 } | |
| 152 | |
| 153 function native_NumberImplementation_toDouble() { | |
| 154 "use strict"; | |
| 155 return +this; | |
| 156 } | |
| 157 | |
| 158 function native_NumberImplementation_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; | |
| 166 } | |
| 167 | |
| 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 } | |
| 174 return this.toFixed(fractionDigits); | |
| 175 } | |
| 176 | |
| 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 } | |
| 183 return this.toPrecision(precision); | |
| 184 } | |
| 185 | |
| 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 } | |
| 192 return this.toExponential(fractionDigits); | |
| 193 } | |
| 194 | |
| 195 function native_NumberImplementation_toRadixString(radix) { | |
| 196 return this.toString(radix); | |
| 197 } | |
| 198 | |
| 199 function native_NumberImplementation_hashCode() { | |
| 200 "use strict"; | |
| 201 return this & 0xFFFFFFF; | |
| 202 } | |
| OLD | NEW |