BigInt implementation #81
No reviewers
Labels
No Label
bug
dependencies
discussion
documentation
duplicate
feature
good first issue
misc
performance
question
test
use case
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: kscience/kmath#81
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "big-int"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
We need to discuss implementation details. Leaving a whole Int for a sign is a big waste. We can implement the whole BigInt as int array and use the first value for signum. In this case, we can use the inline class for BigInt.
But we need to be sure that the array is not accessible from the outside after creation.
Why use whole
Int
for simple three way flag? Could it be replaced by boolean? Enum?Move to private constructor and move parameter checks to auxiliary builders.
Companion should be last declaration in the class
Also all internal values must be marked as private
should be virtual if it is not performance-critical
It does not make sense to make it RingElement since all operations are already class members.
Refactor to String.toBigInteger()
Now using Byte for that
Implemented changes that we discussed, please take a look.
Even byte is wasteful. Especially considering that my eat whole word due to alignment. Why not use 2-complement?
This may be a good idea, but I suspect (performance) problems with 2-complement will appear when we try to operate with numbers of different length. At least the classical Java BigInt implementation stores magnitude and signum separately (http://developer.classpath.org/doc/java/math/BigInteger-source.html)