(FPCore (x y z t)
:precision binary64
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
↓
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ t (* y (* z 3.0)))))
(if (<= t -2.2e+94)
(+ (+ x (* -0.3333333333333333 (/ y z))) t_1)
(if (<= t 5e-41)
(+ x (/ (- y (/ t y)) (* z -3.0)))
(+ (- x (/ y (* z 3.0))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t / (y * (z * 3.0));
double tmp;
if (t <= -2.2e+94) {
tmp = (x + (-0.3333333333333333 * (y / z))) + t_1;
} else if (t <= 5e-41) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x - (y / (z * 3.0))) + t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
↓
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = t / (y * (z * 3.0d0))
if (t <= (-2.2d+94)) then
tmp = (x + ((-0.3333333333333333d0) * (y / z))) + t_1
else if (t <= 5d-41) then
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
else
tmp = (x - (y / (z * 3.0d0))) + t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
↓
public static double code(double x, double y, double z, double t) {
double t_1 = t / (y * (z * 3.0));
double tmp;
if (t <= -2.2e+94) {
tmp = (x + (-0.3333333333333333 * (y / z))) + t_1;
} else if (t <= 5e-41) {
tmp = x + ((y - (t / y)) / (z * -3.0));
} else {
tmp = (x - (y / (z * 3.0))) + t_1;
}
return tmp;
}
(+.f64 (+.f64 x (*.f64 -1/3 (/.f64 y z))) (/.f64 t (*.f64 y (*.f64 z 3)))): 0 points increase in error, 0 points decrease in error
(+.f64 (+.f64 x (*.f64 (Rewrite<= metadata-eval (/.f64 -1 3)) (/.f64 y z))) (/.f64 t (*.f64 y (*.f64 z 3)))): 0 points increase in error, 0 points decrease in error
(+.f64 (+.f64 x (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 y) (*.f64 3 z)))) (/.f64 t (*.f64 y (*.f64 z 3)))): 11 points increase in error, 21 points decrease in error
(+.f64 (+.f64 x (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 y)) (*.f64 3 z))) (/.f64 t (*.f64 y (*.f64 z 3)))): 0 points increase in error, 0 points decrease in error
(+.f64 (+.f64 x (/.f64 (neg.f64 y) (Rewrite<= *-commutative_binary64 (*.f64 z 3)))) (/.f64 t (*.f64 y (*.f64 z 3)))): 0 points increase in error, 0 points decrease in error
(+.f64 (+.f64 x (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 y (*.f64 z 3))))) (/.f64 t (*.f64 y (*.f64 z 3)))): 0 points increase in error, 0 points decrease in error
(+.f64 (Rewrite<= sub-neg_binary64 (-.f64 x (/.f64 y (*.f64 z 3)))) (/.f64 t (*.f64 y (*.f64 z 3)))): 0 points increase in error, 0 points decrease in error
(+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 z 3) y)))): 0 points increase in error, 0 points decrease in error
if -2.20000000000000012e94 < t < 4.9999999999999996e-41
(+.f64 x (*.f64 (/.f64 -1/3 z) (-.f64 y (/.f64 t y)))): 0 points increase in error, 0 points decrease in error
(+.f64 x (*.f64 (/.f64 (Rewrite<= metadata-eval (/.f64 -1 3)) z) (-.f64 y (/.f64 t y)))): 0 points increase in error, 0 points decrease in error
(+.f64 x (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 3 z))) (-.f64 y (/.f64 t y)))): 20 points increase in error, 26 points decrease in error
(+.f64 x (*.f64 (/.f64 -1 (Rewrite<= *-commutative_binary64 (*.f64 z 3))) (-.f64 y (/.f64 t y)))): 0 points increase in error, 0 points decrease in error
(+.f64 x (Rewrite<= distribute-lft-out--_binary64 (-.f64 (*.f64 (/.f64 -1 (*.f64 z 3)) y) (*.f64 (/.f64 -1 (*.f64 z 3)) (/.f64 t y))))): 0 points increase in error, 0 points decrease in error
(+.f64 x (-.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 -1 y) (*.f64 z 3))) (*.f64 (/.f64 -1 (*.f64 z 3)) (/.f64 t y)))): 8 points increase in error, 23 points decrease in error
(+.f64 x (-.f64 (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 y)) (*.f64 z 3)) (*.f64 (/.f64 -1 (*.f64 z 3)) (/.f64 t y)))): 0 points increase in error, 0 points decrease in error
(+.f64 x (-.f64 (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 y (*.f64 z 3)))) (*.f64 (/.f64 -1 (*.f64 z 3)) (/.f64 t y)))): 0 points increase in error, 0 points decrease in error
(+.f64 x (-.f64 (neg.f64 (/.f64 y (*.f64 z 3))) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 t) (*.f64 (*.f64 z 3) y))))): 24 points increase in error, 27 points decrease in error
(+.f64 x (-.f64 (neg.f64 (/.f64 y (*.f64 z 3))) (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 t)) (*.f64 (*.f64 z 3) y)))): 0 points increase in error, 0 points decrease in error
(+.f64 x (-.f64 (neg.f64 (/.f64 y (*.f64 z 3))) (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 t (*.f64 (*.f64 z 3) y)))))): 0 points increase in error, 0 points decrease in error
(+.f64 x (Rewrite<= unsub-neg_binary64 (+.f64 (neg.f64 (/.f64 y (*.f64 z 3))) (neg.f64 (neg.f64 (/.f64 t (*.f64 (*.f64 z 3) y))))))): 0 points increase in error, 0 points decrease in error
(+.f64 x (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (/.f64 y (*.f64 z 3)) (neg.f64 (/.f64 t (*.f64 (*.f64 z 3) y))))))): 0 points increase in error, 0 points decrease in error
(+.f64 x (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (/.f64 y (*.f64 z 3)) (/.f64 t (*.f64 (*.f64 z 3) y)))))): 0 points increase in error, 0 points decrease in error
(Rewrite<= sub-neg_binary64 (-.f64 x (-.f64 (/.f64 y (*.f64 z 3)) (/.f64 t (*.f64 (*.f64 z 3) y))))): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y)))): 0 points increase in error, 0 points decrease in error
Applied egg-rr0.5
\[\leadsto x + \color{blue}{\frac{y - \frac{t}{y}}{z \cdot -3}}
\]
herbie shell --seed 2022338
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))