Skip to content

Commit

Permalink
try to fix rust-lang#170
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Schultzer <benjamin@schultzer.com>
  • Loading branch information
Schultzer committed Jul 2, 2019
1 parent fb0547e commit 8acb24c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/math/jnf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ pub fn jnf(n: i32, mut x: f32) -> f32 {
}
temp = 0.5 * x;
b = temp;
a = 1.0;
let mut a = 1;
i = 2;
while i <= nm1 + 1 {
a *= i as f32; /* a = n! */
a *= i; /* a = n! */
b *= temp; /* b = (x/2)^n */
i += 1;
}
b = b / a;
b /= a as f32;
} else {
/* use backward recurrence */
/* x x^2 x^2
Expand Down Expand Up @@ -124,7 +124,7 @@ pub fn jnf(n: i32, mut x: f32) -> f32 {
let mut k: i32;

nf = (nm1 as f32) + 1.0;
w = 2.0 * (nf as f32) / x;
w = 2.0 * nf / x;
h = 2.0 / x;
z = w + h;
q0 = w;
Expand Down
4 changes: 4 additions & 0 deletions src/math/logf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ pub fn logf(mut x: f32) -> f32 {
let mut ix = x.to_bits();
let mut k = 0i32;

/* Fix sign of zero with downward rounding when x==1. */
if (ix == 0x3f800000) {
return 0.;
}
if (ix < 0x00800000) || ((ix >> 31) != 0) {
/* x < 2**-126 */
if ix << 1 == 0 {
Expand Down

0 comments on commit 8acb24c

Please sign in to comment.