93be5dbff2
23: Add RealNum trait for real data types (Float, but without floating-point specific features) r=cuviper a=yoanlcq This is supposed to fix [#19](https://github.com/rust-num/num-traits/issues/19); I assumed going ahead would be better than bumping the thread. In any case, I understand that it is a quite significant addition and won't mind too much if it doesn't make it. This adds a new `RealNum` trait, along with a universal impl `impl<T: Float> RealNum for T { ... }`. Therefore, this shouldn't be a breaking change, except in places where both traits are imported (which obviously only happened in a few places in this crate). The intent is that generic code may prefer to use `RealNum` instead of `Float` when floating-point isn't a requirement. In the future (next major version ?), I guess `Float` could be made to only provide floating-point-specific features on top of `RealNum`. Most of the code+doc was copy-pasted from `Float`, but the doc comments should be up-to-date with the situation; `Float` only makes an appearance when talking about NaN and infinity. Issues I've seen : - `RealNum` might not be the name we want; - I've mentioned that `sqrt()` is allowed to panic if the input is negative and has no meaningful NaN representation; - Should we do that too for e.g `log()` ? Like `sqrt()`, it's supposed to return Nan when `x < 0`. Thanks for your time. :) |
||
---|---|---|
ci | ||
src | ||
.gitignore | ||
.travis.yml | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md | ||
bors.toml |