(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 (fma (* t (- x z)) y (* y (fma t (- z) (* z t))))))
(if (<= t_1 -3.9027479416013315e+279)
t_2
(if (<= t_1 -1.0453025525917239e-153)
(* t_1 t)
(if (<= t_1 5.261353732592366e-129)
t_2
(if (<= t_1 1.902271020531652e+174) (* 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 = fma((t * (x - z)), y, (y * fma(t, -z, (z * t))));
double tmp;
if (t_1 <= -3.9027479416013315e+279) {
tmp = t_2;
} else if (t_1 <= -1.0453025525917239e-153) {
tmp = t_1 * t;
} else if (t_1 <= 5.261353732592366e-129) {
tmp = t_2;
} else if (t_1 <= 1.902271020531652e+174) {
tmp = t * (y * (x - z));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) return Float64(Float64(Float64(x * y) - Float64(z * y)) * t) end
function code(x, y, z, t) t_1 = Float64(Float64(x * y) - Float64(y * z)) t_2 = fma(Float64(t * Float64(x - z)), y, Float64(y * fma(t, Float64(-z), Float64(z * t)))) tmp = 0.0 if (t_1 <= -3.9027479416013315e+279) tmp = t_2; elseif (t_1 <= -1.0453025525917239e-153) tmp = Float64(t_1 * t); elseif (t_1 <= 5.261353732592366e-129) tmp = t_2; elseif (t_1 <= 1.902271020531652e+174) tmp = Float64(t * Float64(y * Float64(x - z))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision] * y + N[(y * N[(t * (-z) + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -3.9027479416013315e+279], t$95$2, If[LessEqual[t$95$1, -1.0453025525917239e-153], N[(t$95$1 * t), $MachinePrecision], If[LessEqual[t$95$1, 5.261353732592366e-129], t$95$2, If[LessEqual[t$95$1, 1.902271020531652e+174], N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
t_1 := x \cdot y - y \cdot z\\
t_2 := \mathsf{fma}\left(t \cdot \left(x - z\right), y, y \cdot \mathsf{fma}\left(t, -z, z \cdot t\right)\right)\\
\mathbf{if}\;t_1 \leq -3.9027479416013315 \cdot 10^{+279}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq -1.0453025525917239 \cdot 10^{-153}:\\
\;\;\;\;t_1 \cdot t\\
\mathbf{elif}\;t_1 \leq 5.261353732592366 \cdot 10^{-129}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 1.902271020531652 \cdot 10^{+174}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.7 |
|---|---|
| Target | 3.3 |
| Herbie | 0.7 |
if (-.f64 (*.f64 x y) (*.f64 z y)) < -3.902747941601331e279 or -1.0453025525917239e-153 < (-.f64 (*.f64 x y) (*.f64 z y)) < 5.26135373259236625e-129 or 1.9022710205316519e174 < (-.f64 (*.f64 x y) (*.f64 z y)) Initial program 17.2
Simplified1.6
Taylor expanded in y around 0 1.6
Applied egg-rr1.5
if -3.902747941601331e279 < (-.f64 (*.f64 x y) (*.f64 z y)) < -1.0453025525917239e-153Initial program 0.2
if 5.26135373259236625e-129 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1.9022710205316519e174Initial program 0.3
Simplified12.3
Taylor expanded in y around 0 12.3
Applied egg-rr12.2
Taylor expanded in t around 0 0.3
Simplified0.3
Final simplification0.7
herbie shell --seed 2022133
(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))