File tree 12 files changed +12
-0
lines changed
12 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
use core:: f32;
2
2
3
+ #[ inline]
3
4
pub fn ceilf ( x : f32 ) -> f32 {
4
5
let mut ui = x. to_bits ( ) ;
5
6
let e = ( ( ( ui >> 23 ) & 0xff ) - 0x7f ) as i32 ;
Original file line number Diff line number Diff line change @@ -318,6 +318,7 @@ static TBL: [u64; TBLSIZE * 2] = [
318
318
//
319
319
// Gal, S. and Bachelis, B. An Accurate Elementary Mathematical Library
320
320
// for the IEEE Floating Point Standard. TOMS 17(1), 26-46 (1991).
321
+ #[ inline]
321
322
pub fn exp2 ( mut x : f64 ) -> f64 {
322
323
let redux = f64:: from_bits ( 0x4338000000000000 ) / TBLSIZE as f64 ;
323
324
let p1 = f64:: from_bits ( 0x3fe62e42fefa39ef ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ static EXP2FT: [u64; TBLSIZE] = [
69
69
//
70
70
// Tang, P. Table-driven Implementation of the Exponential Function
71
71
// in IEEE Floating-Point Arithmetic. TOMS 15(2), 144-157 (1989).
72
+ #[ inline]
72
73
pub fn exp2f ( mut x : f32 ) -> f32 {
73
74
let redux = f32:: from_bits ( 0x4b400000 ) / TBLSIZE as f32 ;
74
75
let p1 = f32:: from_bits ( 0x3f317218 ) ;
Original file line number Diff line number Diff line change 1
1
use core:: f64;
2
2
3
+ #[ inline]
3
4
pub fn fdim ( x : f64 , y : f64 ) -> f64 {
4
5
if x. is_nan ( ) {
5
6
x
Original file line number Diff line number Diff line change 1
1
use core:: f32;
2
2
3
+ #[ inline]
3
4
pub fn fdimf ( x : f32 , y : f32 ) -> f32 {
4
5
if x. is_nan ( ) {
5
6
x
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use super::sqrt;
4
4
5
5
const SPLIT : f64 = 134217728. + 1. ; // 0x1p27 + 1 === (2 ^ 27) + 1
6
6
7
+ #[ inline]
7
8
fn sq ( x : f64 ) -> ( f64 , f64 ) {
8
9
let xh: f64 ;
9
10
let xl: f64 ;
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
65
65
const LG6 : f64 = 1.531383769920937332e-01 ; /* 3FC39A09 D078C69F */
66
66
const LG7 : f64 = 1.479819860511658591e-01 ; /* 3FC2F112 DF3E5244 */
67
67
68
+ #[ inline]
68
69
pub fn log1p ( x : f64 ) -> f64 {
69
70
let mut ui: u64 = x. to_bits ( ) ;
70
71
let hfsq: f64 ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
20
20
const LG3 : f32 = 0.28498786688 ; /* 0x91e9ee.0p-25 */
21
21
const LG4 : f32 = 0.24279078841 ; /* 0xf89e26.0p-26 */
22
22
23
+ #[ inline]
23
24
pub fn log1pf ( x : f32 ) -> f32 {
24
25
let mut ui: u32 = x. to_bits ( ) ;
25
26
let hfsq: f32 ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
29
29
const LG6 : f64 = 1.531383769920937332e-01 ; /* 3FC39A09 D078C69F */
30
30
const LG7 : f64 = 1.479819860511658591e-01 ; /* 3FC2F112 DF3E5244 */
31
31
32
+ #[ inline]
32
33
pub fn log2 ( mut x : f64 ) -> f64 {
33
34
let x1p54 = f64:: from_bits ( 0x4350000000000000 ) ; // 0x1p54 === 2 ^ 54
34
35
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
23
23
const LG3 : f32 = 0.28498786688 ; /* 0x91e9ee.0p-25 */
24
24
const LG4 : f32 = 0.24279078841 ; /* 0xf89e26.0p-26 */
25
25
26
+ #[ inline]
26
27
pub fn log2f ( mut x : f32 ) -> f32 {
27
28
let x1p25f = f32:: from_bits ( 0x4c000000 ) ; // 0x1p25f === 2 ^ 25
28
29
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use core::f64;
2
2
3
3
const TOINT : f64 = 1.0 / f64:: EPSILON ;
4
4
5
+ #[ inline]
5
6
pub fn round ( mut x : f64 ) -> f64 {
6
7
let ( f, i) = ( x, x. to_bits ( ) ) ;
7
8
let e: u64 = i >> 52 & 0x7ff ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use core::f32;
2
2
3
3
const TOINT : f32 = 1.0 / f32:: EPSILON ;
4
4
5
+ #[ inline]
5
6
pub fn roundf ( mut x : f32 ) -> f32 {
6
7
let i = x. to_bits ( ) ;
7
8
let e: u32 = i >> 23 & 0xff ;
You can’t perform that action at this time.
0 commit comments