(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 2e+287)
(fma y (* t_1 -4.0) (* x x))
(fma x x (* z (* z (* y -4.0)))))))double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= 2e+287) {
tmp = fma(y, (t_1 * -4.0), (x * x));
} else {
tmp = fma(x, x, (z * (z * (y * -4.0))));
}
return tmp;
}
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= 2e+287) tmp = fma(y, Float64(t_1 * -4.0), Float64(x * x)); else tmp = fma(x, x, Float64(z * Float64(z * Float64(y * -4.0)))); end return tmp end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+287], N[(y * N[(t$95$1 * -4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+287}:\\
\;\;\;\;\mathsf{fma}\left(y, t_1 \cdot -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\right)\\
\end{array}
| Original | 5.7 |
|---|---|
| Target | 5.7 |
| Herbie | 0.5 |
if (-.f64 (*.f64 z z) t) < 2.0000000000000002e287Initial program 0.1
Simplified0.1
if 2.0000000000000002e287 < (-.f64 (*.f64 z z) t) Initial program 51.7
Simplified52.2
Applied egg-rr52.3
Taylor expanded in t around 0 55.7
Simplified4.2
Final simplification0.5
herbie shell --seed 2022210
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))