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

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

Issue 1174513004: Implement modInverse (bigint version does not support even modulus yet). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 years, 6 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 int operator >>(int shiftAmount); 104 int operator >>(int shiftAmount);
105 105
106 /** 106 /**
107 * Returns this integer to the power of [exponent] modulo [modulus]. 107 * Returns this integer to the power of [exponent] modulo [modulus].
108 * 108 *
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 /**
115 * Returns the modular multiplicative inverse of this integer
116 * modulo [modulus].
117 *
118 * The [modulus] must be positive.
119 */
120 int modInverse(int modulus);
121
114 /** Returns true if and only if this integer is even. */ 122 /** Returns true if and only if this integer is even. */
115 bool get isEven; 123 bool get isEven;
116 124
117 /** Returns true if and only if this integer is odd. */ 125 /** Returns true if and only if this integer is odd. */
118 bool get isOdd; 126 bool get isOdd;
119 127
120 /** 128 /**
121 * Returns the minimum number of bits required to store this integer. 129 * Returns the minimum number of bits required to store this integer.
122 * 130 *
123 * The number of bits excludes the sign bit, which gives the natural length 131 * The number of bits excludes the sign bit, which gives the natural length
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 * var value = int.parse(text, onError: (source) => null); 292 * var value = int.parse(text, onError: (source) => null);
285 * if (value == null) ... handle the problem 293 * if (value == null) ... handle the problem
286 * 294 *
287 * The [onError] function is only invoked if [source] is a [String]. It is 295 * The [onError] function is only invoked if [source] is a [String]. It is
288 * not invoked if the [source] is, for example, `null`. 296 * not invoked if the [source] is, for example, `null`.
289 */ 297 */
290 external static int parse(String source, 298 external static int parse(String source,
291 { int radix, 299 { int radix,
292 int onError(String source) }); 300 int onError(String source) });
293 } 301 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/js_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