\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
t_1 := x \cdot y - y \cdot z\\
t_2 := \left(x - z\right) \cdot \left(y \cdot t\right)\\
\mathbf{if}\;t_1 \leq -1.8441810201496387 \cdot 10^{+268}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq -1.611934450527025 \cdot 10^{-148}:\\
\;\;\;\;t_1 \cdot t\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-324}:\\
\;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\
\mathbf{elif}\;t_1 \leq 8.316205377767225 \cdot 10^{+297}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x y) (* y z))) (t_2 (* (- x z) (* y t))))
(if (<= t_1 -1.8441810201496387e+268)
t_2
(if (<= t_1 -1.611934450527025e-148)
(* t_1 t)
(if (<= t_1 5e-324)
(* y (- (* x t) (* z t)))
(if (<= t_1 8.316205377767225e+297) (* t (* y (- x z))) t_2))))))double code(double x, double y, double z, double t) {
return ((x * y) - (z * y)) * t;
}
double code(double x, double y, double z, double t) {
double t_1 = (x * y) - (y * z);
double t_2 = (x - z) * (y * t);
double tmp;
if (t_1 <= -1.8441810201496387e+268) {
tmp = t_2;
} else if (t_1 <= -1.611934450527025e-148) {
tmp = t_1 * t;
} else if (t_1 <= 5e-324) {
tmp = y * ((x * t) - (z * t));
} else if (t_1 <= 8.316205377767225e+297) {
tmp = t * (y * (x - z));
} else {
tmp = t_2;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 3.2 |
| Herbie | 0.5 |
if (-.f64 (*.f64 x y) (*.f64 z y)) < -1.8441810201496387e268 or 8.31620537776722474e297 < (-.f64 (*.f64 x y) (*.f64 z y)) Initial program 50.5
Simplified0.3
Taylor expanded in y around inf 0.3
if -1.8441810201496387e268 < (-.f64 (*.f64 x y) (*.f64 z y)) < -1.6119344505270251e-148Initial program 0.3
Simplified9.8
Applied *-commutative_binary649.8
Applied sub-neg_binary649.8
Applied distribute-lft-in_binary649.8
Taylor expanded in t around 0 0.3
if -1.6119344505270251e-148 < (-.f64 (*.f64 x y) (*.f64 z y)) < 4.94066e-324Initial program 8.7
Simplified1.7
Applied *-un-lft-identity_binary641.7
Applied cancel-sign-sub-inv_binary641.7
Applied distribute-lft-in_binary641.7
if 4.94066e-324 < (-.f64 (*.f64 x y) (*.f64 z y)) < 8.31620537776722474e297Initial program 0.3
Simplified8.2
Taylor expanded in y around inf 7.5
Applied associate-*r*_binary640.3
Final simplification0.5
herbie shell --seed 2022125
(FPCore (x y z t)
:name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))
(* (- (* x y) (* z y)) t))