(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (fma z t (fma (fma b c a) (- (* i c)) (* x y))))))
(if (<= i -7.6e-223)
t_1
(if (<= i 1.4e-288)
(* 2.0 (- (+ (* z t) (* x y)) (* c (* b (* i c)))))
t_1))))double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * fma(z, t, fma(fma(b, c, a), -(i * c), (x * y)));
double tmp;
if (i <= -7.6e-223) {
tmp = t_1;
} else if (i <= 1.4e-288) {
tmp = 2.0 * (((z * t) + (x * y)) - (c * (b * (i * c))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * fma(z, t, fma(fma(b, c, a), Float64(-Float64(i * c)), Float64(x * y)))) tmp = 0.0 if (i <= -7.6e-223) tmp = t_1; elseif (i <= 1.4e-288) tmp = Float64(2.0 * Float64(Float64(Float64(z * t) + Float64(x * y)) - Float64(c * Float64(b * Float64(i * c))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(z * t + N[(N[(b * c + a), $MachinePrecision] * (-N[(i * c), $MachinePrecision]) + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -7.6e-223], t$95$1, If[LessEqual[i, 1.4e-288], N[(2.0 * N[(N[(N[(z * t), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(c * N[(b * N[(i * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\begin{array}{l}
t_1 := 2 \cdot \mathsf{fma}\left(z, t, \mathsf{fma}\left(\mathsf{fma}\left(b, c, a\right), -i \cdot c, x \cdot y\right)\right)\\
\mathbf{if}\;i \leq -7.6 \cdot 10^{-223}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;i \leq 1.4 \cdot 10^{-288}:\\
\;\;\;\;2 \cdot \left(\left(z \cdot t + x \cdot y\right) - c \cdot \left(b \cdot \left(i \cdot c\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus i
| Original | 6.5 |
|---|---|
| Target | 2.0 |
| Herbie | 1.9 |
if i < -7.60000000000000024e-223 or 1.4e-288 < i Initial program 5.4
Simplified1.6
if -7.60000000000000024e-223 < i < 1.4e-288Initial program 14.8
Simplified4.9
Taylor expanded in b around 0 11.4
Simplified14.8
Applied egg-rr5.0
Applied egg-rr4.2
Taylor expanded in c around inf 5.8
Simplified4.2
Final simplification1.9
herbie shell --seed 2022165
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))