13
13
14
14
use prelude:: * ;
15
15
16
- use cmath:: c_float_utils ;
16
+ use cmath;
17
17
use default:: Default ;
18
18
use libc:: { c_float, c_int} ;
19
19
use num:: { FPCategory , FPNaN , FPInfinite , FPZero , FPSubnormal , FPNormal } ;
@@ -22,8 +22,6 @@ use num;
22
22
use to_str;
23
23
use unstable:: intrinsics;
24
24
25
- pub use cmath:: c_float_targ_consts:: * ;
26
-
27
25
macro_rules! delegate(
28
26
(
29
27
$(
@@ -62,8 +60,8 @@ delegate!(
62
60
fn sqrt( n: f32 ) -> f32 = intrinsics:: sqrtf32,
63
61
64
62
// LLVM 3.3 required to use intrinsics for these four
65
- fn ceil( n: c_float) -> c_float = c_float_utils :: ceil,
66
- fn trunc( n: c_float) -> c_float = c_float_utils :: trunc,
63
+ fn ceil( n: c_float) -> c_float = cmath :: c_float :: ceil,
64
+ fn trunc( n: c_float) -> c_float = cmath :: c_float :: trunc,
67
65
/*
68
66
fn ceil(n: f32) -> f32 = intrinsics::ceilf32,
69
67
fn trunc(n: f32) -> f32 = intrinsics::truncf32,
@@ -72,47 +70,53 @@ delegate!(
72
70
*/
73
71
74
72
// cmath
75
- fn acos( n: c_float) -> c_float = c_float_utils:: acos,
76
- fn asin( n: c_float) -> c_float = c_float_utils:: asin,
77
- fn atan( n: c_float) -> c_float = c_float_utils:: atan,
78
- fn atan2( a: c_float, b: c_float) -> c_float = c_float_utils:: atan2,
79
- fn cbrt( n: c_float) -> c_float = c_float_utils:: cbrt,
80
- fn copysign( x: c_float, y: c_float) -> c_float = c_float_utils:: copysign,
81
- fn cosh( n: c_float) -> c_float = c_float_utils:: cosh,
82
- // fn erf(n: c_float) -> c_float = c_float_utils::erf,
83
- // fn erfc(n: c_float) -> c_float = c_float_utils::erfc,
84
- fn exp_m1( n: c_float) -> c_float = c_float_utils:: exp_m1,
85
- fn abs_sub( a: c_float, b: c_float) -> c_float = c_float_utils:: abs_sub,
86
- fn next_after( x: c_float, y: c_float) -> c_float = c_float_utils:: next_after,
87
- fn frexp( n: c_float, value: & mut c_int) -> c_float = c_float_utils:: frexp,
88
- fn hypot( x: c_float, y: c_float) -> c_float = c_float_utils:: hypot,
89
- fn ldexp( x: c_float, n: c_int) -> c_float = c_float_utils:: ldexp,
90
- // fn lgamma(n: c_float, sign: &mut c_int) -> c_float = c_float_utils::lgamma,
91
- // fn log_radix(n: c_float) -> c_float = c_float_utils::log_radix,
92
- fn ln_1p( n: c_float) -> c_float = c_float_utils:: ln_1p,
93
- // fn ilog_radix(n: c_float) -> c_int = c_float_utils::ilog_radix,
94
- // fn modf(n: c_float, iptr: &mut c_float) -> c_float = c_float_utils::modf,
95
- fn round( n: c_float) -> c_float = c_float_utils:: round,
96
- // fn ldexp_radix(n: c_float, i: c_int) -> c_float = c_float_utils::ldexp_radix,
97
- fn sinh( n: c_float) -> c_float = c_float_utils:: sinh,
98
- fn tan( n: c_float) -> c_float = c_float_utils:: tan,
99
- fn tanh( n: c_float) -> c_float = c_float_utils:: tanh
100
- // fn tgamma(n: c_float) -> c_float = c_float_utils::tgamma
73
+ fn acos( n: c_float) -> c_float = cmath:: c_float:: acos,
74
+ fn asin( n: c_float) -> c_float = cmath:: c_float:: asin,
75
+ fn atan( n: c_float) -> c_float = cmath:: c_float:: atan,
76
+ fn atan2( a: c_float, b: c_float) -> c_float = cmath:: c_float:: atan2,
77
+ fn cbrt( n: c_float) -> c_float = cmath:: c_float:: cbrt,
78
+ fn copysign( x: c_float, y: c_float) -> c_float = cmath:: c_float:: copysign,
79
+ fn cosh( n: c_float) -> c_float = cmath:: c_float:: cosh,
80
+ // fn erf(n: c_float) -> c_float = cmath::c_float::erf,
81
+ // fn erfc(n: c_float) -> c_float = cmath::c_float::erfc,
82
+ fn exp_m1( n: c_float) -> c_float = cmath:: c_float:: exp_m1,
83
+ fn abs_sub( a: c_float, b: c_float) -> c_float = cmath:: c_float:: abs_sub,
84
+ fn next_after( x: c_float, y: c_float) -> c_float = cmath:: c_float:: next_after,
85
+ fn frexp( n: c_float, value: & mut c_int) -> c_float = cmath:: c_float:: frexp,
86
+ fn hypot( x: c_float, y: c_float) -> c_float = cmath:: c_float:: hypot,
87
+ fn ldexp( x: c_float, n: c_int) -> c_float = cmath:: c_float:: ldexp,
88
+ // fn log_radix(n: c_float) -> c_float = cmath::c_float::log_radix,
89
+ fn ln_1p( n: c_float) -> c_float = cmath:: c_float:: ln_1p,
90
+ // fn ilog_radix(n: c_float) -> c_int = cmath::c_float::ilog_radix,
91
+ // fn modf(n: c_float, iptr: &mut c_float) -> c_float = cmath::c_float::modf,
92
+ fn round( n: c_float) -> c_float = cmath:: c_float:: round,
93
+ // fn ldexp_radix(n: c_float, i: c_int) -> c_float = cmath::c_float::ldexp_radix,
94
+ fn sinh( n: c_float) -> c_float = cmath:: c_float:: sinh,
95
+ fn tan( n: c_float) -> c_float = cmath:: c_float:: tan,
96
+ fn tanh( n: c_float) -> c_float = cmath:: c_float:: tanh
101
97
)
102
98
103
- // These are not defined inside consts:: for consistency with
104
- // the integer types
99
+ pub static RADIX : uint = 2 u;
105
100
106
- pub static NAN : f32 = 0.0_f32 /0.0_f32 ;
101
+ pub static MANTISSA_DIGITS : uint = 53 u;
102
+ pub static DIGITS : uint = 15 u;
107
103
108
- pub static INFINITY : f32 = 1.0_f32 / 0.0_f32 ;
104
+ pub static EPSILON : f64 = 2.220446e-16_f64 ;
109
105
110
- pub static NEG_INFINITY : f32 = -1.0_f32 /0.0_f32 ;
106
+ // FIXME (#1433): this is wrong, replace with hexadecimal (%a) statics
107
+ // below.
108
+ pub static MIN_VALUE : f64 = 2.225074e-308_f64 ;
109
+ pub static MAX_VALUE : f64 = 1.797693e+308_f64 ;
111
110
112
- // FIXME (#1999): replace the predicates below with llvm intrinsics or
113
- // calls to the libmath macros in the rust runtime for performance.
111
+ pub static MIN_EXP : uint = - 1021 u ;
112
+ pub static MAX_EXP : uint = 1024 u ;
114
113
115
- // FIXME (#1999): add is_normal, is_subnormal, and fpclassify.
114
+ pub static MIN_10_EXP : int = -307 ;
115
+ pub static MAX_10_EXP : int = 308 ;
116
+
117
+ pub static NAN : f32 = 0.0_f32 /0.0_f32 ;
118
+ pub static INFINITY : f32 = 1.0_f32 /0.0_f32 ;
119
+ pub static NEG_INFINITY : f32 = -1.0_f32 /0.0_f32 ;
116
120
117
121
/* Module: consts */
118
122
pub mod consts {
0 commit comments