Chromium Code Reviews| Index: sdk/lib/core/double.dart |
| diff --git a/sdk/lib/core/double.dart b/sdk/lib/core/double.dart |
| index 65b9c3096ed87dacce8d40d51f29c4892a466eca..ef0953f31d9fdb8770ab2440595e76916dfa6f80 100644 |
| --- a/sdk/lib/core/double.dart |
| +++ b/sdk/lib/core/double.dart |
| @@ -133,16 +133,31 @@ abstract class double extends num { |
| /** |
| * Parse [source] as an double literal and return its value. |
| * |
| - * Accepts the same format as double literals: |
| - * [: ['+'|'-'] [digit* '.'] digit+ [('e'|'E') ['+'|'-'] digit+] :] |
| + * Accepts an optional sign followed by either "Infinity", |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
.. optional sign (`+` or `-`) immediately followed
floitsch
2013/05/23 02:30:03
Done.
|
| + * "NaN" or a floating-point representation. A floating-point number is |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
"floating-point representation", then "floating po
floitsch
2013/05/23 02:30:03
Done.
|
| + * composed of the mantissa and and optional exponent part. The mantissa is |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
"the mantissa" -> "a mantissa"
"and and" -> "and a
floitsch
2013/05/23 02:30:03
Done.
|
| + * either a dot followed by a sequence of digits, or a sequence of digits |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
"dot" -> "decimal point (`.`)"
"digts" -> "(decima
floitsch
2013/05/23 02:30:03
Done.
|
| + * optionally followed by a dot and more digits. The (optional) exponent part |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
This disallows "4." (which I approve of!) but prob
floitsch
2013/05/23 02:30:03
Changed to "and optionally more digits. Did not re
|
| + * consists of the character "e" or "E", an optional sign, and the exponent |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
"and the exponent digit(s)" -> "and one or more di
floitsch
2013/05/23 02:30:03
Done.
|
| + * digit(s). |
| * |
| - * Also recognizes "NaN", "Infinity" and "-Infinity" as inputs and |
| - * returns the corresponding double value. |
| + * The whole string may be surrounded by whitespace. |
|
Lasse Reichstein Nielsen
2013/05/22 08:47:26
Refer to [String.trim] for a definition of "whitep
floitsch
2013/05/23 02:30:03
Changed to: "The input string is trimmed (see [Str
|
| * |
| - * If the [soure] is not a valid double literal, the [handleError] |
| + * If the [source] is not a valid double literal, the [handleError] |
| * is called with the [source] as argument, and its return value is |
| * used instead. If no handleError is provided, a [FormatException] |
| * is thrown. |
| + * |
| + * Examples of accepted strings: |
| + * |
| + * "3.14" |
| + * " 3.14 \xA0" |
| + * "0." |
| + * ".0" |
| + * "-1.e3" |
| + * "1234E+7" |
| + * "+.12e-9" |
| + * "-NaN" |
| */ |
| external static double parse(String source, |
| [double handleError(String source)]); |