(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 (* i (* c (fma c b a)))))
(if (<= i -3.4e+124)
(* 2.0 (fma y x (- (* t z) t_1)))
(if (<= i 5e-19)
(* 2.0 (fma y x (- (* t z) (* c (fma (* i c) b (* i a))))))
(* 2.0 (fma z t (- (* y x) 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 = i * (c * fma(c, b, a));
double tmp;
if (i <= -3.4e+124) {
tmp = 2.0 * fma(y, x, ((t * z) - t_1));
} else if (i <= 5e-19) {
tmp = 2.0 * fma(y, x, ((t * z) - (c * fma((i * c), b, (i * a)))));
} else {
tmp = 2.0 * fma(z, t, ((y * x) - 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(i * Float64(c * fma(c, b, a))) tmp = 0.0 if (i <= -3.4e+124) tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - t_1))); elseif (i <= 5e-19) tmp = Float64(2.0 * fma(y, x, Float64(Float64(t * z) - Float64(c * fma(Float64(i * c), b, Float64(i * a)))))); else tmp = Float64(2.0 * fma(z, t, Float64(Float64(y * x) - 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[(i * N[(c * N[(c * b + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.4e+124], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5e-19], N[(2.0 * N[(y * x + N[(N[(t * z), $MachinePrecision] - N[(c * N[(N[(i * c), $MachinePrecision] * b + N[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * t + N[(N[(y * x), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
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 := i \cdot \left(c \cdot \mathsf{fma}\left(c, b, a\right)\right)\\
\mathbf{if}\;i \leq -3.4 \cdot 10^{+124}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - t_1\right)\\
\mathbf{elif}\;i \leq 5 \cdot 10^{-19}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(y, x, t \cdot z - c \cdot \mathsf{fma}\left(i \cdot c, b, i \cdot a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \mathsf{fma}\left(z, t, y \cdot x - t_1\right)\\
\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.2 |
|---|---|
| Target | 1.7 |
| Herbie | 0.8 |
if i < -3.4e124Initial program 1.1
Simplified2.4
Taylor expanded in z around 0 26.1
Simplified1.1
if -3.4e124 < i < 5.0000000000000004e-19Initial program 8.6
Simplified1.8
Taylor expanded in z around 0 9.2
Simplified8.6
Taylor expanded in i around inf 1.9
Applied egg-rr0.8
Applied egg-rr0.8
if 5.0000000000000004e-19 < i Initial program 0.7
Simplified0.9
Taylor expanded in b around 0 17.1
Simplified0.6
Final simplification0.8
herbie shell --seed 2022160
(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))))