\[\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{1}{\frac{\frac{a}{x}}{y \cdot 0.5}}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+304}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot \frac{-4.5}{a}\right)\\
\end{array}
\]
(FPCore (x y z t a)
:precision binary64
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
↓
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (<= t_1 (- INFINITY))
(/ 1.0 (/ (/ a x) (* y 0.5)))
(if (<= t_1 4e+304)
(/ (fma x y (* z (* t -9.0))) (* a 2.0))
(* t (* z (/ -4.5 a)))))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
↓
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = 1.0 / ((a / x) / (y * 0.5));
} else if (t_1 <= 4e+304) {
tmp = fma(x, y, (z * (t * -9.0))) / (a * 2.0);
} else {
tmp = t * (z * (-4.5 / a));
}
return tmp;
}
function code(x, y, z, t, a)
return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0))
end
↓
function code(x, y, z, t, a)
t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t))
tmp = 0.0
if (t_1 <= Float64(-Inf))
tmp = Float64(1.0 / Float64(Float64(a / x) / Float64(y * 0.5)));
elseif (t_1 <= 4e+304)
tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0));
else
tmp = Float64(t * Float64(z * Float64(-4.5 / a)));
end
return tmp
end
\[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}}
\]
Proof
(/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 19 points increase in error, 6 points decrease in error
(/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 1 points decrease in error
(/.f64 (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (*.f64 x y) 0)) (*.f64 (*.f64 z 9) t)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(Rewrite=> div-sub_binary64 (-.f64 (/.f64 (+.f64 (*.f64 x y) 0) (*.f64 a 2)) (/.f64 (*.f64 (*.f64 z 9) t) (*.f64 a 2)))): 3 points increase in error, 0 points decrease in error
(-.f64 (/.f64 (Rewrite=> +-rgt-identity_binary64 (*.f64 x y)) (*.f64 a 2)) (/.f64 (*.f64 (*.f64 z 9) t) (*.f64 a 2))): 0 points increase in error, 0 points decrease in error
(Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) (*.f64 a 2))): 0 points increase in error, 3 points decrease in error
\[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}}
\]
Proof
(/.f64 (fma.f64 x y (*.f64 z (*.f64 t -9))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (*.f64 z (*.f64 t (Rewrite<= metadata-eval (neg.f64 9))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (*.f64 z (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 t 9))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (*.f64 z (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 9 t))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 z (*.f64 9 t))))) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(/.f64 (fma.f64 x y (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 z 9) t)))) (*.f64 a 2)): 19 points increase in error, 6 points decrease in error
(/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))) (*.f64 a 2)): 0 points increase in error, 1 points decrease in error
(/.f64 (-.f64 (Rewrite<= +-rgt-identity_binary64 (+.f64 (*.f64 x y) 0)) (*.f64 (*.f64 z 9) t)) (*.f64 a 2)): 0 points increase in error, 0 points decrease in error
(Rewrite=> div-sub_binary64 (-.f64 (/.f64 (+.f64 (*.f64 x y) 0) (*.f64 a 2)) (/.f64 (*.f64 (*.f64 z 9) t) (*.f64 a 2)))): 3 points increase in error, 0 points decrease in error
(-.f64 (/.f64 (Rewrite=> +-rgt-identity_binary64 (*.f64 x y)) (*.f64 a 2)) (/.f64 (*.f64 (*.f64 z 9) t) (*.f64 a 2))): 0 points increase in error, 0 points decrease in error
(Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) (*.f64 a 2))): 0 points increase in error, 3 points decrease in error
if 3.9999999999999998e304 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t))
herbie shell --seed 2022331
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))