Comments (5)
Can a core team member comment on this? It's an easy change to make, and it can have huge benefits. I was thinking of changing all the std::ops
traits to take a type that implements ToBigInt
, so that you can do useful things like adding regular integer constants to BigInt
s, which would greatly reduce the verbosity of the current API. However, I can't do this because these conversion methods can fail.
from num.
@huonw, @alexcrichton, do you have thoughts on this? I'd like to implement it.
from num.
@hauleth and @cuviper, you are the new maintainers, correct? What do you think about this issue?
from num.
I'd rather use From
for infallible conversions (#117) and leave these alone. You already pointed out that ToBigUint
could fail on signed values, and even ToBigInt
could fail if it were implemented for something like BigRational
. I think it's useful to allow this possibility, and we don't need to break the current API when From
and Into
can do the job you want.
Expanding generic std::ops
for From
/Into
types sounds fine, but do note the issues that came up in #125 doing something like this for Complex
. You can be generic on the RHS, but the compiler won't let you implement for T
on the LHS.
from num.
FYI, num-bigint has its own repo now: https://github.com/rust-num/num-bigint
But I think my prior comment still stands, and we do have From
primitive integers now.
from num.
Related Issues (20)
- Implement rand traits for Ratio ? HOT 2
- Conversion between openssl::bn::BigNum and num::BigInt HOT 4
- Question: Is this crate official? HOT 3
- Support a more generic binomial coefficients
- Trait size of number in bits
- Human readable (concise) output HOT 1
- Signed::is_positive and Signed::is_negative implementation/documentation is inconsistent
- Extended GCD on BigUint doesn't work HOT 2
- Yank pre-Rust 1.0.0 versions HOT 1
- Bump num-family to v1.0? HOT 6
- conversion from BigUint to Complex and vice versa HOT 1
- `rustc-serialize` is deprecated, uses deprecated Rust features HOT 2
- Invalid Complex formatting for floats (f32 and f64). HOT 3
- New API additions in num-complex 0.4.2 not configurable through num version HOT 2
- NUM
- Curiousness at 1200! (factorial)... ? HOT 2
- Feature: more comparison operations with BigInts HOT 1
- Some overflow panics found by fuzzing HOT 1
- Updating dependencies: num-traits HOT 1
- `NonZero*` types for `BigInt` and related numbers HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from num.