-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the following methods ```golang // CmpUint64 compares z and x and returns: // // -1 if z < x // 0 if z == x // +1 if z > x func (z *Int) CmpUint64(n uint64) int // Log10 returns the log in base 10, floored to nearest integer. // **OBS** This method returns '0' for '0', not `-Inf`. func (z *Int) Log10() uint ``` The implementation of `Log10` is probably close to the optimal way. The majority of cases are handled by one lookup based on the bitlength. For the remaining cases, one an additional lookup is performed, a comparison, and then it is done. This PR adds around 2K persistent memory for lookup tables and precalculated integers. ``` lut [257] uint8 // 257 B pows = [60]Int // 1920 B pows64 = [20]uint64 // 20*8 = 160 B ``` Ref: #123
- Loading branch information
Showing
2 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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