Repository navigation
The bigint compile mode lowers Floor(a/b) of two integers, a flattened (a - Mod(a, c))/c, Floor of an integer and (-1)^j - #677
Closed
enumeratio wants to merge 1 commit into
Conversation
…and (-1)^j in the bigint compile mode (cortex-js#676)
enumeratio
force-pushed
the
bigint-integer-division
branch
from
December 3, 2026 00:27
662f92b to
974faf4
Compare
arnog
added a commit
that referenced
this pull request
Dec 3, 2026
… a flattened (a - Mod(a, c))/c, Floor of an integer and (-1)^j; PolyLog(s, 1) is Zeta(s) only for Re s > 1 - #677 (#676): in the bigint compile mode, Floor(a/b) of two integers is the floor division; (a - Mod(a, c))/c is recognized when the canonical form flattens a sum a around the Mod term; Floor, Ceil, Round and Truncate of an integer are the integer; (-1)^j of an integer j is 1 - 2 Mod(j, 2). Power(2, n) still declines. - #681 (#680): PolyLog(s, 1) is Zeta(s) for Re s > 1 and a complex infinity for Re s < 1, in the interpreter, the numeric kernel and the GLSL helpers. A symbolic order not known to exceed 1 stays unevaluated. Review fixes: on Re s = 1, s != 1, PolyLog(s, 1) is bounded with no limit, so it stays unevaluated (NaN in compiled code) instead of a complex infinity; a real order is compared with 1 exactly, not as a double; a complex order with Re s < 1 gives the unsigned pole in compiled JavaScript; the GLSL LerchPhi helper tests z = 1 before its route through PolyLog, so LerchPhi(1, s, 1) keeps the value Zeta(s); flooredQuotient lowers the dividend of the Mod, a node of the program; the unreachable z = 1 branches of polylogIntegerOrderComplex are removed. Co-authored-by: enumeratio <314378874+enumeratio@users.noreply.github.com>
Member
|
Landed in adae37a. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
mode: 'bigint':Floor(a/b)of two integers with a run-timeblowers tofloordiv.int(
bfloorDiv): floor division, soFloor(-7/2)is-4;b = 0is the samepole as
Mod.flooredQuotient()takes anyAddwith oneNegate(Mod(m, c))term whoseother terms sum to
m, so the flattened(x - 1 - Mod(x - 1, 2))/2is thefloor division of
x - 1by 2.Floor,Ceil,RoundandTruncateof an integer lower to the integer(the canonical
Floor(2n/2)isFloor(n), which threw).(-1)^jof an integerjlowers to1 - 2 Mod(j, 2), also forj < 0;Power(1, j)is already1.Power(2, n)andPower(3, l - m)withintegerexponents still decline(rational at a negative exponent).
Ceil,RoundandTruncateofa/bwith a run-time
bstill decline.Tests in
test/compute-engine/ir-bigint.test.ts: each form againstevaluate()on a grid with negative values and
b = ±1, past 2^53, with and withoutfolding; the zero divisor; the declines (
Power(2, n),Power(3, n - m),Ceil(a/b),Floorof a real, a remainder of another dividend).Fixes #676