(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)) (+ (/ (* y b) t) (+ a 1.0))))
(t_2 (* (/ y t) (/ z (+ 1.0 (+ a (* b (/ y t))))))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 -1e-237)
t_1
(if (<= t_1 0.0)
(/ (+ x (/ y (/ t z))) (+ a (+ 1.0 (/ b (/ t y)))))
(if (<= t_1 5e+303)
t_1
(if (<= t_1 INFINITY) t_2 (+ (/ z b) (* (/ t y) (/ x b))))))))))
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)) / (((y * b) / t) + (a + 1.0));
double t_2 = (y / t) * (z / (1.0 + (a + (b * (y / t)))));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= -1e-237) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x + (y / (t / z))) / (a + (1.0 + (b / (t / y))));
} else if (t_1 <= 5e+303) {
tmp = t_1;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = (z / b) + ((t / y) * (x / b));
}
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)) / (((y * b) / t) + (a + 1.0));
double t_2 = (y / t) * (z / (1.0 + (a + (b * (y / t)))));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 <= -1e-237) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (x + (y / (t / z))) / (a + (1.0 + (b / (t / y))));
} else if (t_1 <= 5e+303) {
tmp = t_1;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = (z / b) + ((t / y) * (x / b));
}
return tmp;
}
def code(x, y, z, t, a, b):
return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))
if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -inf.0 or 4.9999999999999997e303 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < +inf.0
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (+.f64 a (*.f64 b (/.f64 y t)))))): 0 points increase in error, 0 points decrease in error
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (+.f64 a (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 y t) b)))))): 0 points increase in error, 5 points decrease in error
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (+.f64 a (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 y b) t)))))): 5 points increase in error, 0 points decrease in error
(*.f64 (/.f64 y t) (/.f64 z (+.f64 1 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 (*.f64 y b) t) a))))): 4 points increase in error, 1 points decrease in error
(Rewrite<= times-frac_binary64 (/.f64 (*.f64 y z) (*.f64 t (+.f64 1 (+.f64 (/.f64 (*.f64 y b) t) a))))): 1 points increase in error, 4 points decrease in error
if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -9.9999999999999999e-238 or -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 4.9999999999999997e303
(/.f64 (+.f64 x (/.f64 y (/.f64 t z))) (+.f64 a (+.f64 1 (/.f64 b (/.f64 t y))))): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y z) t))) (+.f64 a (+.f64 1 (/.f64 b (/.f64 t y))))): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 a (+.f64 1 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 b y) t))))): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 a (+.f64 1 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 y b)) t)))): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t)))): 3 points increase in error, 0 points decrease in error
if +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t)))
\[\leadsto \color{blue}{\frac{t}{y} \cdot \frac{x + z \cdot \frac{y}{t}}{b}}
\]
Proof
(*.f64 (/.f64 t y) (/.f64 (+.f64 x (*.f64 z (/.f64 y t))) b)): 0 points increase in error, 0 points decrease in error
(*.f64 (/.f64 t y) (/.f64 (+.f64 x (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 z y) t))) b)): 0 points increase in error, 5 points decrease in error
(*.f64 (/.f64 t y) (/.f64 (+.f64 x (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 y z)) t)) b)): 5 points increase in error, 0 points decrease in error
(*.f64 (/.f64 t y) (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 (*.f64 y z) t) x)) b)): 1 points increase in error, 4 points decrease in error
(Rewrite<= times-frac_binary64 (/.f64 (*.f64 t (+.f64 (/.f64 (*.f64 y z) t) x)) (*.f64 y b))): 1 points increase in error, 1 points decrease in error
herbie shell --seed 2022340
(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))))