| OLD | NEW |
| 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * | 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
| 9 * | 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 var expect= ''; | 60 var expect= ''; |
| 61 var expectedvalues = []; | 61 var expectedvalues = []; |
| 62 var testNum = 5.123456; | 62 var testNum = 5.123456; |
| 63 | 63 |
| 64 | 64 |
| 65 status = 'Section A of test: no error intended!'; | 65 status = 'Section A of test: no error intended!'; |
| 66 actual = testNum.toPrecision(4); | 66 actual = testNum.toPrecision(4); |
| 67 expect = '5.123'; | 67 expect = '5.123'; |
| 68 captureThis(); | 68 captureThis(); |
| 69 | 69 |
| 70 status = 'Section B of test: Infinity.toPrecision() with out-of-range fractionDi
gits'; |
| 71 actual = Number.POSITIVE_INFINITY.toPrecision(-3); |
| 72 expect = 'Infinity'; |
| 73 captureThis(); |
| 74 |
| 75 status = 'Section C of test: -Infinity.toPrecision() with out-of-range fractionD
igits'; |
| 76 actual = Number.NEGATIVE_INFINITY.toPrecision(-3); |
| 77 expect = '-Infinity'; |
| 78 captureThis(); |
| 79 |
| 80 status = 'Section D of test: NaN.toPrecision() with out-of-range fractionDigits'
; |
| 81 actual = Number.NaN.toPrecision(-3); |
| 82 expect = 'NaN'; |
| 83 captureThis(); |
| 84 |
| 70 | 85 |
| 71 /////////////////////////// OOPS.... /////////////////////////////// | 86 /////////////////////////// OOPS.... /////////////////////////////// |
| 72 /************************************************************************* | 87 /************************************************************************* |
| 73 * 15.7.4.7 Number.prototype.toPrecision(precision) | 88 * 15.7.4.7 Number.prototype.toPrecision(precision) |
| 74 * | 89 * |
| 75 * An implementation is permitted to extend the behaviour of toPrecision | 90 * An implementation is permitted to extend the behaviour of toPrecision |
| 76 * for values of precision less than 1 or greater than 21. In this | 91 * for values of precision less than 1 or greater than 21. In this |
| 77 * case toPrecision would not necessarily throw RangeError for such values. | 92 * case toPrecision would not necessarily throw RangeError for such values. |
| 78 | 93 |
| 79 status = 'Section B of test: expect RangeError because precision < 1'; | 94 status = 'Section B of test: expect RangeError because precision < 1'; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return cnNoErrorCaught; | 145 return cnNoErrorCaught; |
| 131 } | 146 } |
| 132 | 147 |
| 133 | 148 |
| 134 function isRangeError(obj) | 149 function isRangeError(obj) |
| 135 { | 150 { |
| 136 if (obj instanceof RangeError) | 151 if (obj instanceof RangeError) |
| 137 return cnIsRangeError; | 152 return cnIsRangeError; |
| 138 return cnNotRangeError; | 153 return cnNotRangeError; |
| 139 } | 154 } |
| OLD | NEW |