-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added improved LosslessStringConvertible init() with "^=" bug fix. #261
Conversation
…de faster performance. Removed unnecessary _digits and _digitRadix. Fixed a cut/paste problem in "^=" function. Added test cases for string conversion performance and logical operation tests.
I looked more closely into the performance of Results:
Each cell contains:
More details are available in the PR that I linked above, it also contains links to the In your code you mention: /// Speeds the time to initialize a BigInt by about a factor of 16 for
/// the test case of the string for 512! using radix 10. A radix 36 test
/// was 10X faster. According to my tests we can do even better:
Anyway, I don't think that this is the 'official' Apple implementation. I wrote a lot of unit tests for it (see: I-242: [BigInt] Using tests from “Violet - Python VM written in Swift”) and has a tendency to:
So, it should NOT be used in production. Written under covid. I'm basically an intellectual vegetable; may be unreadable. sorry! |
Appreciate the feedback. Glad to know these times can be improved even more. Hopefully, one day, Apple will see the light and realize that a lot of people want better math support on the Mac and iDevices. For instance, why does no one have an "ipow" function yet. Or why don't the binary integers have x.squared() support which generally could be twice as fast as multiplying x * x. Good work on Violet, BTW. The project looks very impressive. |
…d into a negative. Fixed division/remainder signs after a multi-word division.
Added improved LosslessStringConvertible init() with order of magnitude faster performance.
Removed unnecessary _digits and _digitRadix.
Fixed a copy/paste problem in "^=" function. (see Issue # 260)
Added test cases for string conversion performance and logical operation tests.
Added a fix for division/remainder having incorrect signs.
Also fixed a corner-case issue where negated integers weren't.
Also added test cases for the division sign.