Added Unchecked Math Operations#426
Merged
heyLu merged 1 commit intopixie-lang:masterfrom Nov 6, 2015
reutermj:master
Merged
Conversation
Member
|
I'm a bit unsure about this. Here are a few comments:
I may be wrong on these, feel free to tell me if that's the case! |
Contributor
Author
|
I've made changes with respect to all of your comments. To be completely honest I only knew about clojure's unchecked-math and didn't know of the specific functions. I also added unchecked-inc and unchecked-dec to reflect the api. |
Member
|
Ace. If you can squash the commits I'll merge this shortly. Thanks! |
Contributor
Author
|
Done. Let me know if you have any problems with it. |
Member
|
Thanks! Can you rebase this onto current master, so that the other commits disappear? |
Added Tests for Unchecked Math Operations Adjustments to unchecked math Made changes to the implementation of unchecked math in regards to: implementing them under their own protocol, mirrored the api of clojure, reduced implementations of the protocol to just integer and float Fixed errors in the tests that caused the build to fail
Contributor
Author
|
Sorry I thought I did that; git is still magic to me. It should be done now. |
Member
|
No worries, git tends to be confusing. :) Thanks a lot for the pull request, will merge when the tests have run. |
Member
|
✨ :) |
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.
Related to issue #406. Added operations u+, u-, and u* for Integer, Float, BigInteger, and Ratio that follows the semantics of the checked operations except for cases of Integer and Integer. In these cases, the operations do not promote to BigInteger, but instead wrap like the equivalent C/C++ operations.
I also defined tests that mirror the tests for the checked operations, as well as added a test demonstrating the wrapping behaviour.