| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Compute the longest prefix of Result(2), which might be Result(2) itself, |
| 7 |
which satisfies the syntax of a StrDecimalLiteral |
| 8 |
es5id: 15.1.2.3_A4_T2 |
| 9 |
es6id: 18.2.4 |
| 10 |
esid: sec-parsefloat-string |
| 11 |
description: With ExponentIndicator |
| 12 |
---*/ |
| 13 |
|
| 14 |
//CHECK#1 |
| 15 |
if (parseFloat("1ex") !== 1) { |
| 16 |
$ERROR('#1: parseFloat("1ex") === 1. Actual: ' + (parseFloat("1ex"))); |
| 17 |
} |
| 18 |
|
| 19 |
//CHECK#2 |
| 20 |
if (parseFloat("1e-x") !== 1) { |
| 21 |
$ERROR('#2: parseFloat("1e-x") === 1. Actual: ' + (parseFloat("1e-x"))); |
| 22 |
} |
| 23 |
|
| 24 |
//CHECK#3 |
| 25 |
if (parseFloat("1e1x") !== 10) { |
| 26 |
$ERROR('#3: parseFloat("1e1x") === 10. Actual: ' + (parseFloat("1e1x"))); |
| 27 |
} |
| 28 |
|
| 29 |
//CHECK#4 |
| 30 |
if (parseFloat("1e-1x") !== 0.1) { |
| 31 |
$ERROR('#4: parseFloat("1e-1x") === 0.1. Actual: ' + (parseFloat("1e-1x"))); |
| 32 |
} |
| 33 |
|
| 34 |
//CHECK#5 |
| 35 |
if (parseFloat("0.1e-1x") !== 0.01) { |
| 36 |
$ERROR('#5: parseFloat("0.1e-1x") === 0.01. Actual: ' + (parseFloat("0.1e-1x"))); |
| 37 |
} |