Skip to content

Add numeric functions and traits that provide numeric traits for generic mathematics. #30

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

Merged
merged 3 commits into from
Nov 17, 2014

Conversation

gifnksm
Copy link
Contributor

@gifnksm gifnksm commented Nov 15, 2014

This PR adds the following modules and functions.

  • traits module that provides numeric traits, such as Zero, One, Bounded
  • iter module that provides generic range iterators
  • The functions that were in std::num, such as one, zero

The codes are imported from old rust standard library.

closes #28

@gifnksm
Copy link
Contributor Author

gifnksm commented Nov 15, 2014

The travis failure will be fixed by nightly build updates.

@gifnksm gifnksm changed the title Add numeric functions and traits that providing numeric traits for gemeric mathematics. Add numeric functions and traits that provide numeric traits for generic mathematics. Nov 16, 2014
@gifnksm
Copy link
Contributor Author

gifnksm commented Nov 16, 2014

Now. travis passed with latest nightly build.
r? @alexcrichton

… for generic

mathematcs.

Import numeric traits and functions that were removed from the standard library.
This also implements `AdditiveIterator` and `MultiplicativeIterator` for
`BigUint` and `BigInt`.

closes #28
The codes are imported from the standard library.
@aturon
Copy link
Contributor

aturon commented Nov 17, 2014

@bjz You might want to comment on this. My perception is that the existing traits were not really an ideal design for generic programming over numerics (and that in general there are problems trying to be generic over "true" mathematical abstractions and primitives types at the same time).

@brendanzab
Copy link

Yeah I'm not sure. It would definitely need a re-think later. I am currently working on an abstract algebra library at https://github.com/bjz/algebra

@alexcrichton
Copy link
Contributor

I agree with @aturon that this may not be the direction we want to go in, but I think it's also important to keep this library building so I'm going to merge this for now. We can revisit this time with perhaps a newly released version of libnum at a later date. Thanks @gifnksm!

alexcrichton added a commit that referenced this pull request Nov 17, 2014
Add numeric functions and traits that provide numeric traits for generic mathematics.
@alexcrichton alexcrichton merged commit c0df55e into rust-num:master Nov 17, 2014
remexre pushed a commit to remexre/num that referenced this pull request Jun 1, 2017
This resolves rust-num#22, resolves rust-num#29, and resolves rust-num#30.

* The reported error code is now `MissingField`, not `ExpectedSomeValue`.
* A missing `()` field now causes a `MissingField` error.
* A missing `Vec<_>` field now causes a `MissingField` error.

Tests have been updated to check these cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Providing generic numeric traits
4 participants