Skip to content

PowerMod and PowerModList reject a rational base and a list; ChineseRemainder has no offset - #547

Open
enumeratio wants to merge 1 commit into
cortex-js:mainfrom
enumeratio:powermod-rational-base
Open

enumeratio wants to merge 1 commit into
cortex-js:mainfrom
enumeratio:powermod-rational-base

Conversation

@enumeratio

Copy link
Copy Markdown
Contributor

Fixes #546

  • PowerMod(p/q, b, m) and PowerModList(p/q, s, m): the base is read as p * q^-1 mod m; a base with no inverse (PowerMod(1/2, 2, 4)) stays unevaluated. Works with a negative or rational exponent.
  • Both heads thread over list operands (one length, scalars held fixed; unequal lengths stay unevaluated). The signatures and type handlers say list<integer> / list<list<integer>> when an operand is a list and integer / list<integer> otherwise.
  • ChineseRemainder(residues, moduli, d): the smallest solution x >= d.
  • Both power heads keep lazy: true, so .N() leaves the exact operands alone.

Existing tests that pin old behavior changed: none. Compiled code: the heads have no lowering, so the new forms decline as the old ones do.

…f the denominator) and thread over lists, ChineseRemainder takes an offset d (the smallest solution at least d); add regression tests. Fix cortex-js#546
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

PowerMod and PowerModList reject a rational base and a list; ChineseRemainder has no offset

1 participant