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

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

Issue 1211473002: Make int.gcd accept zero operands. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comment. 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 * 119 *
120 * It is an error if no modular inverse exists. 120 * It is an error if no modular inverse exists.
121 */ 121 */
122 int modInverse(int modulus); 122 int modInverse(int modulus);
123 123
124 /** 124 /**
125 * Returns the greatest common divisor of the absolute value of 125 * Returns the greatest common divisor of this integer and [other].
126 * this integer and the absolute value of [other].
127 * 126 *
128 * Both this and [other] must be non-zero. 127 * If either number is non-zero, the result is the numerically greatest
128 * integer dividing both `this` and `other`.
129 *
130 * The greatest common divisor is independent of the order,
131 * so `x.gcd(y)` is always the same as `y.gcd(x)`.
132 *
133 * For any integer `x`, `x.gcd(x)` is `x.abs()`.
134 *
135 * If both `this` and `other` is zero, the result is also zero.
129 */ 136 */
130 int gcd(int other); 137 int gcd(int other);
131 138
132 /** Returns true if and only if this integer is even. */ 139 /** Returns true if and only if this integer is even. */
133 bool get isEven; 140 bool get isEven;
134 141
135 /** Returns true if and only if this integer is odd. */ 142 /** Returns true if and only if this integer is odd. */
136 bool get isOdd; 143 bool get isOdd;
137 144
138 /** 145 /**
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 * var value = int.parse(text, onError: (source) => null); 311 * var value = int.parse(text, onError: (source) => null);
305 * if (value == null) ... handle the problem 312 * if (value == null) ... handle the problem
306 * 313 *
307 * The [onError] function is only invoked if [source] is a [String]. It is 314 * The [onError] function is only invoked if [source] is a [String]. It is
308 * not invoked if the [source] is, for example, `null`. 315 * not invoked if the [source] is, for example, `null`.
309 */ 316 */
310 external static int parse(String source, 317 external static int parse(String source,
311 { int radix, 318 { int radix,
312 int onError(String source) }); 319 int onError(String source) });
313 } 320 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/js_runtime/lib/js_number.dart ('k') | tests/corelib/big_integer_arith_vm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698