(FPCore (x y z t a b)
:precision binary64
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
↓
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) t))) (t_2 (/ t_1 (+ (+ a 1.0) (/ (* y b) t)))))
(if (<= t_2 (- INFINITY))
(* (/ y t) (/ z (+ 1.0 (+ a (* b (/ y t))))))
(if (<= t_2 0.0)
(/ t_1 (+ (+ a 1.0) (/ y (/ t b))))
(if (<= t_2 2e+304) t_2 (+ (/ z b) (/ (* (/ t b) (- x (/ z b))) y)))))))
double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
↓
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (y / t) * (z / (1.0 + (a + (b * (y / t)))));
} else if (t_2 <= 0.0) {
tmp = t_1 / ((a + 1.0) + (y / (t / b)));
} else if (t_2 <= 2e+304) {
tmp = t_2;
} else {
tmp = (z / b) + (((t / b) * (x - (z / b))) / y);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
↓
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + ((y * z) / t);
double t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (y / t) * (z / (1.0 + (a + (b * (y / t)))));
} else if (t_2 <= 0.0) {
tmp = t_1 / ((a + 1.0) + (y / (t / b)));
} else if (t_2 <= 2e+304) {
tmp = t_2;
} else {
tmp = (z / b) + (((t / b) * (x - (z / b))) / y);
}
return tmp;
}
def code(x, y, z, t, a, b):
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))
↓
def code(x, y, z, t, a, b):
t_1 = x + ((y * z) / t)
t_2 = t_1 / ((a + 1.0) + ((y * b) / t))
tmp = 0
if t_2 <= -math.inf:
tmp = (y / t) * (z / (1.0 + (a + (b * (y / t)))))
elif t_2 <= 0.0:
tmp = t_1 / ((a + 1.0) + (y / (t / b)))
elif t_2 <= 2e+304:
tmp = t_2
else:
tmp = (z / b) + (((t / b) * (x - (z / b))) / y)
return tmp
function code(x, y, z, t, a, b)
return Float64(Float64(x + Float64(Float64(y * z) / t)) / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t)))
end
↓
function code(x, y, z, t, a, b)
t_1 = Float64(x + Float64(Float64(y * z) / t))
t_2 = Float64(t_1 / Float64(Float64(a + 1.0) + Float64(Float64(y * b) / t)))
tmp = 0.0
if (t_2 <= Float64(-Inf))
tmp = Float64(Float64(y / t) * Float64(z / Float64(1.0 + Float64(a + Float64(b * Float64(y / t))))));
elseif (t_2 <= 0.0)
tmp = Float64(t_1 / Float64(Float64(a + 1.0) + Float64(y / Float64(t / b))));
elseif (t_2 <= 2e+304)
tmp = t_2;
else
tmp = Float64(Float64(z / b) + Float64(Float64(Float64(t / b) * Float64(x - Float64(z / b))) / y));
end
return tmp
end
function tmp = code(x, y, z, t, a, b)
tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
end
↓
function tmp_2 = code(x, y, z, t, a, b)
t_1 = x + ((y * z) / t);
t_2 = t_1 / ((a + 1.0) + ((y * b) / t));
tmp = 0.0;
if (t_2 <= -Inf)
tmp = (y / t) * (z / (1.0 + (a + (b * (y / t)))));
elseif (t_2 <= 0.0)
tmp = t_1 / ((a + 1.0) + (y / (t / b)));
elseif (t_2 <= 2e+304)
tmp = t_2;
else
tmp = (z / b) + (((t / b) * (x - (z / b))) / y);
end
tmp_2 = tmp;
end
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (+.f64 (*.f64 (/.f64 y t) b) a)))): 0 points increase in error, 0 points decrease in error
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (+.f64 (Rewrite<= associate-/r/_binary64 (/.f64 y (/.f64 t b))) a)))): 8 points increase in error, 2 points decrease in error
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (+.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y b) t)) a)))): 11 points increase in error, 9 points decrease in error
(Rewrite<= times-frac_binary64 (/.f64 (*.f64 y z) (*.f64 t (+.f64 1 (+.f64 (/.f64 (*.f64 y b) t) a))))): 42 points increase in error, 55 points decrease in error
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -0.0
(+.f64 (/.f64 z b) (/.f64 (*.f64 (/.f64 t b) (-.f64 x (/.f64 z b))) y)): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 z b) (/.f64 (Rewrite<= distribute-lft-out--_binary64 (-.f64 (*.f64 (/.f64 t b) x) (*.f64 (/.f64 t b) (/.f64 z b)))) y)): 2 points increase in error, 0 points decrease in error
(+.f64 (/.f64 z b) (/.f64 (-.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 t x) b)) (*.f64 (/.f64 t b) (/.f64 z b))) y)): 11 points increase in error, 11 points decrease in error
(+.f64 (/.f64 z b) (/.f64 (-.f64 (/.f64 (*.f64 t x) b) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 t z) (*.f64 b b)))) y)): 16 points increase in error, 5 points decrease in error
(+.f64 (/.f64 z b) (/.f64 (-.f64 (/.f64 (*.f64 t x) b) (/.f64 (*.f64 t z) (Rewrite<= unpow2_binary64 (pow.f64 b 2)))) y)): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 z b) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 (/.f64 (*.f64 t x) b) y) (/.f64 (/.f64 (*.f64 t z) (pow.f64 b 2)) y)))): 1 points increase in error, 0 points decrease in error
(+.f64 (/.f64 z b) (-.f64 (Rewrite=> associate-/l/_binary64 (/.f64 (*.f64 t x) (*.f64 y b))) (/.f64 (/.f64 (*.f64 t z) (pow.f64 b 2)) y))): 13 points increase in error, 7 points decrease in error
(+.f64 (/.f64 z b) (-.f64 (/.f64 (*.f64 t x) (*.f64 y b)) (Rewrite=> associate-/l/_binary64 (/.f64 (*.f64 t z) (*.f64 y (pow.f64 b 2)))))): 5 points increase in error, 3 points decrease in error
(Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (/.f64 z b) (/.f64 (*.f64 t x) (*.f64 y b))) (/.f64 (*.f64 t z) (*.f64 y (pow.f64 b 2))))): 0 points increase in error, 0 points decrease in error
(-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 (*.f64 t x) (*.f64 y b)) (/.f64 z b))) (/.f64 (*.f64 t z) (*.f64 y (pow.f64 b 2)))): 0 points increase in error, 0 points decrease in error
herbie shell --seed 2022302
(FPCore (x y z t a b)
:name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< t -1.3659085366310088e-271) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))
(/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))