Go to file
Homu 661e225862 Auto merge of #145 - ollie27:bigint_float, r=cuviper
bigint: fix float conversions

The default implementations of to_f32, to_f64, from_32 and from_f64 are
limited to numbers fitting in i64 but BigInt can of course be much bigger.
The default to_f32 also has double rounding.
from_f32 and from_f64 have undefined behaviour if the float is too big to
fit in an i64.

This fixes these issues and keeps the rounding consistant with other float
to int conversions.

Also add ToBigUint and ToBigInt implementations for f32 and f64.

Currently this returns None if the BigInt is too big for to_f32 and to_f64 but it might make more sense to return Some(INFINITY) but I've decided to match f64::to_f32() for now.
2015-12-28 06:57:52 +09:00
.travis Use scripts for compound travis commands 2015-11-18 21:33:07 -08:00
benches bigint: add a Hash test 2015-12-16 22:32:00 -08:00
doc Update repo and doc links 2015-11-12 18:40:13 -08:00
num-macros Fix num_macros for syntax/syntax_ext crate split 2015-12-19 10:57:26 +01:00
src bigint: cleanup float conversions 2015-12-24 18:15:56 +00:00
.gitignore Update num-macros to Rust master 2015-05-14 10:19:47 -07:00
.multirust.sh Add a simple multirust script for local "CI" 2015-12-21 12:26:32 -08:00
.travis.yml Fix travis on non-nightly 2015-11-18 22:12:19 -08:00
Cargo.toml Publish num 0.1.29 2015-12-16 22:48:45 -08: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
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;