(FPCore (x y z t)
:precision binary64
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
↓
(FPCore (x y z t)
:precision binary64
(if (or (<= t -50000.0) (not (<= t 1e+101)))
(+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))
(+ x (/ (- y (/ t y)) (* z -3.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -50000.0) || !(t <= 1e+101)) {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
} else {
tmp = x + ((y - (t / y)) / (z * -3.0));
}
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) :: tmp
if ((t <= (-50000.0d0)) .or. (.not. (t <= 1d+101))) then
tmp = (x - (y / (z * 3.0d0))) + (t / (y * (z * 3.0d0)))
else
tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
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 tmp;
if ((t <= -50000.0) || !(t <= 1e+101)) {
tmp = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
} else {
tmp = x + ((y - (t / y)) / (z * -3.0));
}
return tmp;
}
(+.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)))): 0 points increase in error, 0 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))))): 13 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)))): 0 points increase in error, 13 points decrease in error
(+.f64 x (-.f64 (Rewrite<= associate-*r/_binary64 (*.f64 -1 (/.f64 y (*.f64 z 3)))) (*.f64 (/.f64 -1 (*.f64 z 3)) (/.f64 t y)))): 2 points increase in error, 0 points decrease in error
(+.f64 x (-.f64 (*.f64 -1 (/.f64 y (*.f64 z 3))) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 t) (*.f64 (*.f64 z 3) y))))): 0 points increase in error, 2 points decrease in error
(+.f64 x (-.f64 (*.f64 -1 (/.f64 y (*.f64 z 3))) (Rewrite<= associate-*r/_binary64 (*.f64 -1 (/.f64 t (*.f64 (*.f64 z 3) y)))))): 13 points increase in error, 0 points decrease in error
(+.f64 x (Rewrite=> distribute-lft-out--_binary64 (*.f64 -1 (-.f64 (/.f64 y (*.f64 z 3)) (/.f64 t (*.f64 (*.f64 z 3) y)))))): 0 points increase in error, 13 points decrease in error
(+.f64 x (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.f64 (/.f64 y (*.f64 z 3)) (/.f64 t (*.f64 (*.f64 z 3) y)))))): 11 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, 11 points decrease in error
(Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y)))): 5 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 2022340
(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))))