Go to file
Homu 0861fb4cfb Auto merge of #180 - bluss:fix-toprimitive-float, r=cuviper
Fix ToPrimitive for f64 -> f32 conversion.

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-16 01:32:23 +09:00
.travis test_features.sh: re-enable as a simple build 2016-03-25 18:30:27 -07:00
benches Expand bigint shl/shr benchmarking 2016-01-27 22:53:10 -08:00
bigint bigint: add path-dependency versions 2016-04-14 00:26:54 -07:00
complex complex: add path-dependency versions 2016-04-14 00:29:19 -07:00
doc Update repo and doc links 2015-11-12 18:40:13 -08:00
integer integer: add path-dependency versions 2016-04-14 00:25:51 -07:00
iter iter: add path-dependency versions 2016-04-14 00:37:04 -07:00
macros Bump all num crates to 0.1.32 2016-04-14 00:17:42 -07:00
rational rational: add path-dependency versions 2016-04-14 00:39:07 -07:00
src Serializers dependencies 2016-04-11 20:43:07 +02:00
traits traits: Fix ToPrimitive for f64 -> f32 conversion. 2016-04-15 13:36:29 +02:00
.gitignore Update num-macros to Rust master 2015-05-14 10:19:47 -07:00
.multirust.sh .multirust.sh: use the subcrated "make test" 2016-03-25 18:30:27 -07:00
.travis.yml .travis.yml: add a verbose build 2016-03-25 18:30:27 -07:00
Cargo.toml num: add path-dependency versions 2016-04-14 00:45:03 -07:00
LICENSE-APACHE Initial seeding from rust repo 2014-09-16 10:35:35 -07:00
LICENSE-MIT Initial seeding from rust repo 2014-09-16 10:35:35 -07:00
Makefile Makefile: add complex and iter 2016-03-25 17:50:51 -07:00
README.md Update intros to better reflect the breadth of num 2015-11-21 16:39:00 -08:00

README.md

num

A collection of numeric types and traits for Rust.

This includes new types for big integers, rationals, and complex numbers, new traits for generic programming on numeric properties like `Integer, and generic range iterators.

Documentation

Usage

Add this to your Cargo.toml:

[dependencies]
num = "0.1"

and this to your crate root:

extern crate num;