Issue #14259 has been updated by andrykonchin (Andrew Konchin).


Another example:

~~~
2.pow(61, 9213693951) # => 1
~~~

Expected following result:

~~~
(2 ** 61) % 9213693951 # => 5432161352
~~~

----------------------------------------
Bug #14259: Integer#pow returns a Invalid result with a large modulo
https://bugs.ruby-lang.org/issues/14259#change-69105

* Author: mrkn (Kenta Murata)
* Status: Closed
* Priority: Normal
* Assignee: mrkn (Kenta Murata)
* Target version: 
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: REQUIRED
----------------------------------------
```
irb(main):020:0> 12.pow(1, 10000000000)
=> 1
irb(main):021:0> 12.pow(1, 10000000001)
=> 1
irb(main):022:0> 12.pow(1, 10000000002)
=> 1
```

These result should be `12`.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>