\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - y \cdot z \leq -6.902129959376691 \cdot 10^{+145}:\\
\;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\
\mathbf{elif}\;x \cdot y - y \cdot z \leq -4.7999445602809516 \cdot 10^{-234}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{elif}\;x \cdot y - y \cdot z \leq 6.228974896488953 \cdot 10^{-270}:\\
\;\;\;\;y \cdot \left(x \cdot t - z \cdot t\right)\\
\mathbf{elif}\;x \cdot y - y \cdot z \leq 1.941003136626665 \cdot 10^{+168}:\\
\;\;\;\;\left(x \cdot y - y \cdot z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\
\end{array}(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
:precision binary64
(if (<= (- (* x y) (* y z)) -6.902129959376691e+145)
(* y (- (* x t) (* z t)))
(if (<= (- (* x y) (* y z)) -4.7999445602809516e-234)
(* t (* y (- x z)))
(if (<= (- (* x y) (* y z)) 6.228974896488953e-270)
(* y (- (* x t) (* z t)))
(if (<= (- (* x y) (* y z)) 1.941003136626665e+168)
(* (- (* x y) (* y z)) t)
(* (- x z) (* y t)))))))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 tmp;
if (((x * y) - (y * z)) <= -6.902129959376691e+145) {
tmp = y * ((x * t) - (z * t));
} else if (((x * y) - (y * z)) <= -4.7999445602809516e-234) {
tmp = t * (y * (x - z));
} else if (((x * y) - (y * z)) <= 6.228974896488953e-270) {
tmp = y * ((x * t) - (z * t));
} else if (((x * y) - (y * z)) <= 1.941003136626665e+168) {
tmp = ((x * y) - (y * z)) * t;
} else {
tmp = (x - z) * (y * t);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 3.5 |
| Herbie | 0.9 |
if (-.f64 (*.f64 x y) (*.f64 z y)) < -6.90212995937669148e145 or -4.79994456028095162e-234 < (-.f64 (*.f64 x y) (*.f64 z y)) < 6.22897489648895273e-270Initial program 15.4
rmApplied *-un-lft-identity_binary6415.4
Applied associate-*l*_binary6415.4
Simplified15.4
rmApplied sub-neg_binary6415.4
Applied distribute-rgt-in_binary6415.4
Applied distribute-rgt-in_binary6415.4
Simplified15.4
Simplified15.4
Taylor expanded around -inf 1.9
if -6.90212995937669148e145 < (-.f64 (*.f64 x y) (*.f64 z y)) < -4.79994456028095162e-234Initial program 0.2
Taylor expanded around inf 0.2
if 6.22897489648895273e-270 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1.94100313662666503e168Initial program 0.2
rmApplied *-un-lft-identity_binary640.2
Applied associate-*l*_binary640.2
Simplified0.2
rmApplied sub-neg_binary640.2
Applied distribute-rgt-in_binary640.2
Simplified0.2
if 1.94100313662666503e168 < (-.f64 (*.f64 x y) (*.f64 z y)) Initial program 24.3
rmApplied *-un-lft-identity_binary6424.3
Applied associate-*l*_binary6424.3
Simplified24.3
rmApplied associate-*r*_binary642.2
Final simplification0.9
herbie shell --seed 2021118
(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))