Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: frog/lib/math.dart

Issue 9568011: Unify Date.fromString and support more Iso 8601. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/lib/date_implementation.dart ('k') | runtime/lib/date.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Dart core library. 5 // Dart core library.
6 6
7 class Math native 'Math' { 7 class Math native 'Math' {
8 /** 8 /**
9 * Base of the natural logarithms. 9 * Base of the natural logarithms.
10 */ 10 */
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 /** 43 /**
44 * Square root of 2. 44 * Square root of 2.
45 */ 45 */
46 static final double SQRT2 = 1.4142135623730951; 46 static final double SQRT2 = 1.4142135623730951;
47 47
48 /** 48 /**
49 * Parses a [String] representation of an [int], and returns 49 * Parses a [String] representation of an [int], and returns
50 * an [int]. Throws a [BadNumberFormatException] if [str] 50 * an [int]. Throws a [BadNumberFormatException] if [str]
51 * cannot be parsed as an [int]. 51 * cannot be parsed as an [int].
52 */ 52 */
53 static int parseInt(String str) native '''var ret = parseInt(str); 53 static int parseInt(String str) native '''
54 var isHex = (str.length > 2) && str[0] == '0' &&
55 (str[1] == 'x' || str[1] == 'X');
56 var ret = parseInt(str, isHex ? 16 : 10);
54 if (isNaN(ret)) \$throw(new BadNumberFormatException(str)); 57 if (isNaN(ret)) \$throw(new BadNumberFormatException(str));
55 return ret;''' { throw new BadNumberFormatException(""); } 58 return ret;''' { throw new BadNumberFormatException(""); }
56 59
57 /** 60 /**
58 * Parses a [String] representation of a [double], and returns 61 * Parses a [String] representation of a [double], and returns
59 * a [double]. Throws a [BadNumberFormatException] if [str] cannot 62 * a [double]. Throws a [BadNumberFormatException] if [str] cannot
60 * be parsed as a [double]. 63 * be parsed as a [double].
61 */ 64 */
62 static double parseDouble(String str) native '''var ret = parseFloat(str); 65 static double parseDouble(String str) native '''var ret = parseFloat(str);
63 if (isNaN(ret) && str != 'NaN') \$throw(new BadNumberFormatException(str)); 66 if (isNaN(ret) && str != 'NaN') \$throw(new BadNumberFormatException(str));
(...skipping 29 matching lines...) Expand all
93 static double sin(num x) native; 96 static double sin(num x) native;
94 static double cos(num x) native; 97 static double cos(num x) native;
95 static double tan(num x) native; 98 static double tan(num x) native;
96 static double acos(num x) native; 99 static double acos(num x) native;
97 static double asin(num x) native; 100 static double asin(num x) native;
98 static double atan(num x) native; 101 static double atan(num x) native;
99 static double sqrt(num x) native; 102 static double sqrt(num x) native;
100 static double exp(num x) native; 103 static double exp(num x) native;
101 static double log(num x) native; 104 static double log(num x) native;
102 } 105 }
OLDNEW
« no previous file with comments | « frog/lib/date_implementation.dart ('k') | runtime/lib/date.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698