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

Side by Side Diff: sdk/lib/core/int.dart

Issue 1209523002: Make modInv throw Exception on incompatible operands. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * An arbitrarily large integer. 8 * An arbitrarily large integer.
9 * 9 *
10 * **Note:** When compiling to JavaScript, integers are 10 * **Note:** When compiling to JavaScript, integers are
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 * The [exponent] must be non-negative and [modulus] must be 109 * The [exponent] must be non-negative and [modulus] must be
110 * positive. 110 * positive.
111 */ 111 */
112 int modPow(int exponent, int modulus); 112 int modPow(int exponent, int modulus);
113 113
114 /** 114 /**
115 * Returns the modular multiplicative inverse of this integer 115 * Returns the modular multiplicative inverse of this integer
116 * modulo [modulus]. 116 * modulo [modulus].
117 * 117 *
118 * The [modulus] must be positive. 118 * The [modulus] must be positive.
119 * Throws a RangeError if no modular inverse exists. 119 * Throws an [UnsupportedError] if no modular inverse exists.
regis 2015/06/24 15:40:43 It is an error if ...
Lasse Reichstein Nielsen 2015/06/25 07:22:21 As stated elsewhere, I think we might want to tell
regis 2015/06/25 16:51:45 It was my thinking in the first version, where I w
Lasse Reichstein Nielsen 2015/06/30 05:50:48 I can see that 0 can be seen as a valid answer. Af
120 */ 120 */
121 int modInverse(int modulus); 121 int modInverse(int modulus);
122 122
123 /** 123 /**
124 * Returns the greatest common divisor of the absolute value of 124 * Returns the greatest common divisor of the absolute value of
125 * this integer and the absolute value of [other]. 125 * this integer and the absolute value of [other].
126 * 126 *
127 * Both this and [other] must be non-zero. 127 * Both this and [other] must be non-zero.
128 */ 128 */
129 int gcd(int other); 129 int gcd(int other);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 * var value = int.parse(text, onError: (source) => null); 301 * var value = int.parse(text, onError: (source) => null);
302 * if (value == null) ... handle the problem 302 * if (value == null) ... handle the problem
303 * 303 *
304 * The [onError] function is only invoked if [source] is a [String]. It is 304 * The [onError] function is only invoked if [source] is a [String]. It is
305 * not invoked if the [source] is, for example, `null`. 305 * not invoked if the [source] is, for example, `null`.
306 */ 306 */
307 external static int parse(String source, 307 external static int parse(String source,
308 { int radix, 308 { int radix,
309 int onError(String source) }); 309 int onError(String source) });
310 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698