(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 (fma x y (* z t)))
(t_2 (* 2.0 (fma c (- (fma (* c i) b (* a i))) t_1)))
(t_3 (* c (+ a (* b c)))))
(if (<= t_3 -3.251941869890704e+300)
t_2
(if (<= t_3 5.423452089292153e+198)
(* 2.0 (- t_1 (* i (* c (fma b c a)))))
t_2))))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 = fma(x, y, (z * t));
double t_2 = 2.0 * fma(c, -fma((c * i), b, (a * i)), t_1);
double t_3 = c * (a + (b * c));
double tmp;
if (t_3 <= -3.251941869890704e+300) {
tmp = t_2;
} else if (t_3 <= 5.423452089292153e+198) {
tmp = 2.0 * (t_1 - (i * (c * fma(b, c, a))));
} else {
tmp = t_2;
}
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 = fma(x, y, Float64(z * t)) t_2 = Float64(2.0 * fma(c, Float64(-fma(Float64(c * i), b, Float64(a * i))), t_1)) t_3 = Float64(c * Float64(a + Float64(b * c))) tmp = 0.0 if (t_3 <= -3.251941869890704e+300) tmp = t_2; elseif (t_3 <= 5.423452089292153e+198) tmp = Float64(2.0 * Float64(t_1 - Float64(i * Float64(c * fma(b, c, a))))); else tmp = t_2; 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[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(c * (-N[(N[(c * i), $MachinePrecision] * b + N[(a * i), $MachinePrecision]), $MachinePrecision]) + t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -3.251941869890704e+300], t$95$2, If[LessEqual[t$95$3, 5.423452089292153e+198], N[(2.0 * N[(t$95$1 - N[(i * N[(c * N[(b * c + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
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 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
t_2 := 2 \cdot \mathsf{fma}\left(c, -\mathsf{fma}\left(c \cdot i, b, a \cdot i\right), t_1\right)\\
t_3 := c \cdot \left(a + b \cdot c\right)\\
\mathbf{if}\;t_3 \leq -3.251941869890704 \cdot 10^{+300}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_3 \leq 5.423452089292153 \cdot 10^{+198}:\\
\;\;\;\;2 \cdot \left(t_1 - i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\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.3 |
|---|---|
| Target | 1.9 |
| Herbie | 0.3 |
if (*.f64 (+.f64 a (*.f64 b c)) c) < -3.25194186989070401e300 or 5.423452089292153e198 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 42.4
Simplified42.4
Applied egg-rr7.2
Taylor expanded in c around 0 3.4
Applied egg-rr0.5
if -3.25194186989070401e300 < (*.f64 (+.f64 a (*.f64 b c)) c) < 5.423452089292153e198Initial program 0.3
Simplified0.3
Final simplification0.3
herbie shell --seed 2022131
(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))))