(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma z (fma a b y) (fma a t x))))
(if (<= z -100000000.0)
t_1
(if (<= z 1e+58) (fma y z (fma a t (fma a (* z b) x))) t_1))))double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, fma(a, b, y), fma(a, t, x));
double tmp;
if (z <= -100000000.0) {
tmp = t_1;
} else if (z <= 1e+58) {
tmp = fma(y, z, fma(a, t, fma(a, (z * b), x)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function code(x, y, z, t, a, b) t_1 = fma(z, fma(a, b, y), fma(a, t, x)) tmp = 0.0 if (z <= -100000000.0) tmp = t_1; elseif (z <= 1e+58) tmp = fma(y, z, fma(a, t, fma(a, Float64(z * b), x))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(a * b + y), $MachinePrecision] + N[(a * t + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -100000000.0], t$95$1, If[LessEqual[z, 1e+58], N[(y * z + N[(a * t + N[(a * N[(z * b), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), \mathsf{fma}\left(a, t, x\right)\right)\\
\mathbf{if}\;z \leq -100000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(y, z, \mathsf{fma}\left(a, t, \mathsf{fma}\left(a, z \cdot b, x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
| Original | 2.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if z < -1e8 or 9.99999999999999944e57 < z Initial program 5.4
Taylor expanded in z around 0 0.1
Taylor expanded in z around inf 0.1
Simplified0.1
if -1e8 < z < 9.99999999999999944e57Initial program 0.3
Simplified0.2
Taylor expanded in z around 0 0.2
Applied egg-rr0.2
Final simplification0.1
herbie shell --seed 2022186
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))