about summary refs log tree commit diff
path: root/src/libstd/num/mod.rs
diff options
context:
space:
mode:
authorVolker Mische <volker.mische@gmail.com>2013-12-02 00:47:19 +0100
committerVolker Mische <volker.mische@gmail.com>2013-12-04 16:11:39 +0100
commit30a9c6e4904f1d74b5ece97a422a0f1b148f4ba1 (patch)
treeeca427dc6dbcc44524364231342c283d7d16c431 /src/libstd/num/mod.rs
parent91695797c2ff36017edc47af270ca665f2f4d1ef (diff)
downloadrust-30a9c6e4904f1d74b5ece97a422a0f1b148f4ba1.tar.gz
rust-30a9c6e4904f1d74b5ece97a422a0f1b148f4ba1.zip
Decode a float into integers
The `integer_decode()` function decodes a float (f32/f64)
into integers containing the mantissa, exponent and sign.

It's needed for `rationalize()` implementation of #9838.

The code got ported from ABCL [1].

[1] http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/FloatFunctions.java?rev=14465#L94
Diffstat (limited to 'src/libstd/num/mod.rs')
-rw-r--r--src/libstd/num/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 456011d5172..79efe5934d5 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -532,6 +532,8 @@ pub trait Float: Real
     fn ln_1p(&self) -> Self;
     fn mul_add(&self, a: Self, b: Self) -> Self;
     fn next_after(&self, other: Self) -> Self;
+
+    fn integer_decode(&self) -> (u64, i16, i8);
 }
 
 /// Returns the exponential of the number, minus `1`, `exp(n) - 1`, in a way