(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 (<= (* z 3.0) -2e-59)
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y)))
(if (<= (* z 3.0) 2e-22)
(- x (* (- y (/ t y)) (/ 0.3333333333333333 z)))
(+ x (/ (- (/ (/ t z) y) (/ y z)) 3.0)))))
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 ((z * 3.0d0) <= (-2d-59)) then
tmp = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
else if ((z * 3.0d0) <= 2d-22) then
tmp = x - ((y - (t / y)) * (0.3333333333333333d0 / z))
else
tmp = x + ((((t / z) / y) - (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));
}
(+.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)))): 32 points increase in error, 18 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))))): 1 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)))): 6 points increase in error, 17 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))))): 25 points increase in error, 31 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
(+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 (/.f64 t z) (*.f64 y 3))): 0 points increase in error, 0 points decrease in error
(+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 (/.f64 t z) (Rewrite<= *-commutative_binary64 (*.f64 3 y)))): 0 points increase in error, 0 points decrease in error
(+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (Rewrite<= associate-/r*_binary64 (/.f64 t (*.f64 z (*.f64 3 y))))): 29 points increase in error, 22 points decrease in error
(+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 3) y)))): 13 points increase in error, 12 points decrease in error
herbie shell --seed 2022329
(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))))