[ruby-core:101891] [Ruby master Feature#6362] Modular exponentiation/inverse
From:
leah@...
Date:
2021-01-03 19:35:19 UTC
List:
ruby-core #101891
Issue #6362 has been updated by leahneukirchen (Leah Neukirchen). As of Python 3.8, this is supported by Python's pow function, which can take a mod argument, just like Ruby's. https://docs.python.org/3/library/functions.html#pow I therefore propose to add this feature as ``` n.pow(-1, m) ``` This currently throws an error (`Integer#pow() 1st argument cannot be negative when 2nd argument specified`), so should be possible to extend. ---------------------------------------- Feature #6362: Modular exponentiation/inverse https://bugs.ruby-lang.org/issues/6362#change-89732 * Author: MartinBosslet (Martin Bosslet) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) ---------------------------------------- I'd like to ask your opinion about adding two methods for modular exponentiation/modular inverse to integer classes. Is this functionality too specific or would this be a welcome addition? -- 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>