Commit Graph

15 Commits

Author SHA1 Message Date
Josh Stone 932e45c207 traits: inline integer from_str_radix 2016-08-10 22:22:53 -07:00
Josh Stone 7a9c39fa87 traits: inline Bounded tuple methods 2016-08-10 22:22:15 -07:00
Josh Stone fa451ac00c traits: inline Saturating methods 2016-08-10 22:21:53 -07:00
Josh Stone eefa2a85d0 traits: inline Float methods 2016-08-10 22:21:33 -07:00
Josh Stone 7bc7ddfc87 traits: inline PrimInt methods 2016-08-10 22:21:00 -07:00
Josh Stone 0faeb31b09 traits: add `to_degrees` and `to_radians` on `Float`
To avoid a breaking change, these have crude default implementations as
well as better implementations for `f32` and `f64` in particular.  They
don't use the inherent methods though, because `f32` didn't stabilize
those until Rust 1.7.

Fixes #211
2016-07-23 00:34:14 -07:00
Josh Stone b21c89de36 Mask deprecation warnings on abs_sub 2016-07-12 00:34:55 -07:00
Vinzent Steinberg 3e4595eac6 Move functions remaining in num to num-traits
Fixes #102.
2016-05-13 10:38:14 +02:00
bluss acde249bf7 traits: Fix ToPrimitive for f64 -> f32 conversion.
It should use the destination type and not the source type to check if
the conversion would be to a value that's in range.

NOTE: A finite f64 value that is larger than the f32 value range now produces
None when converted to f32 with ToPrimitive.

Previously, too large f64 values would produce inf f32 values. This `as`
cast has an undefined result and was not specified to always produce for
example `inf`.

The conversion preserves nan/+-inf specifically.
2016-04-15 13:36:29 +02:00
Josh Stone b73cfa57bb traits: use `cast` items before `int`
For some reason, rustc 1.0.0 can't find `PrimInt` if it's before `cast`,
but later versions are fine with this.  That may have been a compiler
bug that was fixed.  Switching the order seems to work everywhere.
2016-03-25 16:12:56 -07:00
Łukasz Jan Niemier 956bb0f4db Reapply ebed6756de 2016-03-25 12:34:48 +01:00
Łukasz Jan Niemier 96e9166b0a Extract iter 2016-03-11 01:06:37 +01:00
Łukasz Jan Niemier 54685c46a1 Extract rational 2016-03-11 01:06:37 +01:00
Łukasz Jan Niemier 2176b7048c Extract bigint 2016-03-11 01:06:05 +01:00
Łukasz Jan Niemier c124be549f Move traits to separate crate 2016-03-11 01:06:05 +01:00