| 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 = 77.1234; | 62 var testNum = 77.1234; |
| 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.toExponential(4); | 66 actual = testNum.toExponential(4); |
| 67 expect = '7.7123e+1'; | 67 expect = '7.7123e+1'; |
| 68 captureThis(); | 68 captureThis(); |
| 69 | 69 |
| 70 status = 'Section B of test: Infinity.toExponential() with out-of-range fraction
Digits'; |
| 71 actual = Number.POSITIVE_INFINITY.toExponential(-3); |
| 72 expect = 'Infinity'; |
| 73 captureThis(); |
| 74 |
| 75 status = 'Section C of test: -Infinity.toExponential() with out-of-range fractio
nDigits'; |
| 76 actual = Number.NEGATIVE_INFINITY.toExponential(-3); |
| 77 expect = '-Infinity'; |
| 78 captureThis(); |
| 79 |
| 80 status = 'Section D of test: NaN.toExponential() with out-of-range fractionDigit
s'; |
| 81 actual = Number.NaN.toExponential(-3); |
| 82 expect = 'NaN'; |
| 83 captureThis(); |
| 84 |
| 70 | 85 |
| 71 /////////////////////////// OOPS.... /////////////////////////////// | 86 /////////////////////////// OOPS.... /////////////////////////////// |
| 72 /************************************************************************* | 87 /************************************************************************* |
| 73 * 15.7.4.6 Number.prototype.toExponential(fractionDigits) | 88 * 15.7.4.6 Number.prototype.toExponential(fractionDigits) |
| 74 * | 89 * |
| 75 * An implementation is permitted to extend the behaviour of toExponential | 90 * An implementation is permitted to extend the behaviour of toExponential |
| 76 * for values of fractionDigits less than 0 or greater than 20. In this | 91 * for values of fractionDigits less than 0 or greater than 20. In this |
| 77 * case toExponential would not necessarily throw RangeError for such values. | 92 * case toExponential would not necessarily throw RangeError for such values. |
| 78 | 93 |
| 79 status = 'Section B of test: expect RangeError because fractionDigits < 0'; | 94 status = 'Section B of test: expect RangeError because fractionDigits < 0'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return cnNoErrorCaught; | 140 return cnNoErrorCaught; |
| 126 } | 141 } |
| 127 | 142 |
| 128 | 143 |
| 129 function isRangeError(obj) | 144 function isRangeError(obj) |
| 130 { | 145 { |
| 131 if (obj instanceof RangeError) | 146 if (obj instanceof RangeError) |
| 132 return cnIsRangeError; | 147 return cnIsRangeError; |
| 133 return cnNotRangeError; | 148 return cnNotRangeError; |
| 134 } | 149 } |
| OLD | NEW |