\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
t_1 := x \cdot y - y \cdot z\\
t_2 := y \cdot \left(x \cdot t\right) - y \cdot \left(z \cdot t\right)\\
\mathbf{if}\;t_1 \leq -2.7787934013934826 \cdot 10^{+303}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq -5.684444323648512 \cdot 10^{-88}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{elif}\;t_1 \leq 3.4915314143491775 \cdot 10^{-231}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 5.448449864627173 \cdot 10^{+157}:\\
\;\;\;\;t_1 \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\
\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 (- (* y (* x t)) (* y (* z t)))))
(if (<= t_1 -2.7787934013934826e+303)
t_2
(if (<= t_1 -5.684444323648512e-88)
(* t (* y (- x z)))
(if (<= t_1 3.4915314143491775e-231)
t_2
(if (<= t_1 5.448449864627173e+157)
(* t_1 t)
(* y (* t (- x z)))))))))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 = (y * (x * t)) - (y * (z * t));
double tmp;
if (t_1 <= -2.7787934013934826e+303) {
tmp = t_2;
} else if (t_1 <= -5.684444323648512e-88) {
tmp = t * (y * (x - z));
} else if (t_1 <= 3.4915314143491775e-231) {
tmp = t_2;
} else if (t_1 <= 5.448449864627173e+157) {
tmp = t_1 * t;
} else {
tmp = y * (t * (x - z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.0 |
|---|---|
| Target | 3.6 |
| Herbie | 1.0 |
if (-.f64 (*.f64 x y) (*.f64 z y)) < -2.778793401393483e303 or -5.6844443236485124e-88 < (-.f64 (*.f64 x y) (*.f64 z y)) < 3.4915314143491775e-231Initial program 15.8
Taylor expanded in x around 0 2.2
if -2.778793401393483e303 < (-.f64 (*.f64 x y) (*.f64 z y)) < -5.6844443236485124e-88Initial program 0.3
Taylor expanded in y around 0 0.3
if 3.4915314143491775e-231 < (-.f64 (*.f64 x y) (*.f64 z y)) < 5.4484498646271728e157Initial program 0.2
if 5.4484498646271728e157 < (-.f64 (*.f64 x y) (*.f64 z y)) Initial program 22.6
Simplified2.6
Final simplification1.0
herbie shell --seed 2022068
(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))