
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); 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]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); 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]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(if (<= z_m 1.25e+158)
(fma (* y 4.0) (- t (* z_m z_m)) (* x x))
(pow
(*
z_m
(+
(*
0.3333333333333333
(* (cbrt (/ y (pow z_m 7.0))) (* 4.0 (/ t (pow (cbrt -4.0) 2.0)))))
(* (cbrt -4.0) (* (cbrt y) (cbrt (/ 1.0 z_m))))))
3.0)))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.25e+158) {
tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
} else {
tmp = pow((z_m * ((0.3333333333333333 * (cbrt((y / pow(z_m, 7.0))) * (4.0 * (t / pow(cbrt(-4.0), 2.0))))) + (cbrt(-4.0) * (cbrt(y) * cbrt((1.0 / z_m)))))), 3.0);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1.25e+158) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x)); else tmp = Float64(z_m * Float64(Float64(0.3333333333333333 * Float64(cbrt(Float64(y / (z_m ^ 7.0))) * Float64(4.0 * Float64(t / (cbrt(-4.0) ^ 2.0))))) + Float64(cbrt(-4.0) * Float64(cbrt(y) * cbrt(Float64(1.0 / z_m)))))) ^ 3.0; end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.25e+158], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[Power[N[(z$95$m * N[(N[(0.3333333333333333 * N[(N[Power[N[(y / N[Power[z$95$m, 7.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[(4.0 * N[(t / N[Power[N[Power[-4.0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[-4.0, 1/3], $MachinePrecision] * N[(N[Power[y, 1/3], $MachinePrecision] * N[Power[N[(1.0 / z$95$m), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(z\_m \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z\_m}^{7}}} \cdot \left(4 \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)\right) + \sqrt[3]{-4} \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{\frac{1}{z\_m}}\right)\right)\right)}^{3}\\
\end{array}
\end{array}
if z < 1.2499999999999999e158Initial program 91.9%
cancel-sign-sub-inv91.9%
distribute-lft-neg-out91.9%
+-commutative91.9%
associate-*l*91.9%
distribute-lft-neg-in91.9%
associate-*l*91.9%
distribute-rgt-neg-in91.9%
fma-define94.0%
sub-neg94.0%
+-commutative94.0%
distribute-neg-in94.0%
remove-double-neg94.0%
sub-neg94.0%
Simplified94.0%
if 1.2499999999999999e158 < z Initial program 70.7%
fma-neg74.5%
*-commutative74.5%
distribute-rgt-neg-in74.5%
distribute-rgt-neg-in74.5%
metadata-eval74.5%
add-cube-cbrt74.5%
pow374.5%
Applied egg-rr74.5%
Taylor expanded in z around inf 53.8%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
*-commutative65.9%
associate-*l*65.9%
Simplified65.9%
pow1/319.9%
div-inv19.9%
unpow-prod-down29.8%
pow1/390.3%
Applied egg-rr90.3%
unpow1/392.3%
Simplified92.3%
Final simplification93.9%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(if (<= z_m 1.25e+158)
(fma (* y 4.0) (- t (* z_m z_m)) (* x x))
(pow
(*
z_m
(+
(*
0.3333333333333333
(* (cbrt (/ y (pow z_m 7.0))) (* 4.0 (/ t (pow (cbrt -4.0) 2.0)))))
(* (cbrt -4.0) (/ (cbrt y) (cbrt z_m)))))
3.0)))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.25e+158) {
tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
} else {
tmp = pow((z_m * ((0.3333333333333333 * (cbrt((y / pow(z_m, 7.0))) * (4.0 * (t / pow(cbrt(-4.0), 2.0))))) + (cbrt(-4.0) * (cbrt(y) / cbrt(z_m))))), 3.0);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1.25e+158) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x)); else tmp = Float64(z_m * Float64(Float64(0.3333333333333333 * Float64(cbrt(Float64(y / (z_m ^ 7.0))) * Float64(4.0 * Float64(t / (cbrt(-4.0) ^ 2.0))))) + Float64(cbrt(-4.0) * Float64(cbrt(y) / cbrt(z_m))))) ^ 3.0; end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.25e+158], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[Power[N[(z$95$m * N[(N[(0.3333333333333333 * N[(N[Power[N[(y / N[Power[z$95$m, 7.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * N[(4.0 * N[(t / N[Power[N[Power[-4.0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[-4.0, 1/3], $MachinePrecision] * N[(N[Power[y, 1/3], $MachinePrecision] / N[Power[z$95$m, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(z\_m \cdot \left(0.3333333333333333 \cdot \left(\sqrt[3]{\frac{y}{{z\_m}^{7}}} \cdot \left(4 \cdot \frac{t}{{\left(\sqrt[3]{-4}\right)}^{2}}\right)\right) + \sqrt[3]{-4} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{z\_m}}\right)\right)}^{3}\\
\end{array}
\end{array}
if z < 1.2499999999999999e158Initial program 91.9%
cancel-sign-sub-inv91.9%
distribute-lft-neg-out91.9%
+-commutative91.9%
associate-*l*91.9%
distribute-lft-neg-in91.9%
associate-*l*91.9%
distribute-rgt-neg-in91.9%
fma-define94.0%
sub-neg94.0%
+-commutative94.0%
distribute-neg-in94.0%
remove-double-neg94.0%
sub-neg94.0%
Simplified94.0%
if 1.2499999999999999e158 < z Initial program 70.7%
fma-neg74.5%
*-commutative74.5%
distribute-rgt-neg-in74.5%
distribute-rgt-neg-in74.5%
metadata-eval74.5%
add-cube-cbrt74.5%
pow374.5%
Applied egg-rr74.5%
Taylor expanded in z around inf 53.8%
Taylor expanded in y around inf 65.9%
*-commutative65.9%
*-commutative65.9%
associate-*l*65.9%
Simplified65.9%
cbrt-div92.0%
Applied egg-rr92.0%
Final simplification93.8%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (+ (* x x) (* (* y 4.0) (- t (* z_m z_m))))))
(if (<= t_1 (- INFINITY))
(- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t))))))
(if (<= t_1 INFINITY) t_1 (pow x 2.0)))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = pow(x, 2.0);
}
return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = Math.pow(x, 2.0);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m))) tmp = 0 if t_1 <= -math.inf: tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t))))) elif t_1 <= math.inf: tmp = t_1 else: tmp = math.pow(x, 2.0) return tmp
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t)))))); elseif (t_1 <= Inf) tmp = t_1; else tmp = x ^ 2.0; end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) t_1 = (x * x) + ((y * 4.0) * (t - (z_m * z_m))); tmp = 0.0; if (t_1 <= -Inf) tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t))))); elseif (t_1 <= Inf) tmp = t_1; else tmp = x ^ 2.0; end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[Power[x, 2.0], $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;{x}^{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < -inf.0Initial program 76.1%
Taylor expanded in t around inf 76.1%
*-commutative76.1%
associate-/l*76.1%
associate-*r*76.1%
*-commutative76.1%
associate-/l*76.1%
associate-*l*76.1%
associate-/l*76.1%
distribute-lft-out76.1%
Simplified76.1%
add-sqr-sqrt76.1%
associate-/l*76.1%
*-commutative76.1%
sqrt-prod76.1%
sqrt-pow148.2%
metadata-eval48.2%
pow148.2%
metadata-eval48.2%
*-commutative48.2%
sqrt-prod48.2%
sqrt-pow189.3%
metadata-eval89.3%
pow189.3%
metadata-eval89.3%
Applied egg-rr89.3%
if -inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0Initial program 96.3%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 0.0%
Taylor expanded in x around inf 60.0%
Final simplification93.9%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (- (* z_m z_m) t)))
(if (<= t_1 5e+296)
(fma x x (* t_1 (* y -4.0)))
(- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t)))))))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (z_m * z_m) - t;
double tmp;
if (t_1 <= 5e+296) {
tmp = fma(x, x, (t_1 * (y * -4.0)));
} else {
tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(z_m * z_m) - t) tmp = 0.0 if (t_1 <= 5e+296) tmp = fma(x, x, Float64(t_1 * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t)))))); end return tmp end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+296], N[(x * x + N[(t$95$1 * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := z\_m \cdot z\_m - t\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+296}:\\
\;\;\;\;\mathsf{fma}\left(x, x, t\_1 \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < 5.0000000000000001e296Initial program 95.9%
fma-neg97.4%
distribute-lft-neg-in97.4%
*-commutative97.4%
distribute-rgt-neg-in97.4%
metadata-eval97.4%
Simplified97.4%
if 5.0000000000000001e296 < (-.f64 (*.f64 z z) t) Initial program 69.2%
Taylor expanded in t around inf 69.2%
*-commutative69.2%
associate-/l*69.2%
associate-*r*69.2%
*-commutative69.2%
associate-/l*69.2%
associate-*l*69.2%
associate-/l*69.2%
distribute-lft-out69.2%
Simplified69.2%
add-sqr-sqrt69.2%
associate-/l*69.2%
*-commutative69.2%
sqrt-prod69.2%
sqrt-pow136.6%
metadata-eval36.6%
pow136.6%
metadata-eval36.6%
*-commutative36.6%
sqrt-prod36.6%
sqrt-pow180.5%
metadata-eval80.5%
pow180.5%
metadata-eval80.5%
Applied egg-rr80.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 1.35e+154) (fma (* y 4.0) (- t (* z_m z_m)) (* x x)) (- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.35e+154) {
tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
} else {
tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1.35e+154) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x)); else tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t)))))); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.35e+154], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\
\end{array}
\end{array}
if z < 1.35000000000000003e154Initial program 91.9%
cancel-sign-sub-inv91.9%
distribute-lft-neg-out91.9%
+-commutative91.9%
associate-*l*91.9%
distribute-lft-neg-in91.9%
associate-*l*91.9%
distribute-rgt-neg-in91.9%
fma-define94.0%
sub-neg94.0%
+-commutative94.0%
distribute-neg-in94.0%
remove-double-neg94.0%
sub-neg94.0%
Simplified94.0%
if 1.35000000000000003e154 < z Initial program 70.7%
Taylor expanded in t around inf 70.7%
*-commutative70.7%
associate-/l*70.7%
associate-*r*70.7%
*-commutative70.7%
associate-/l*70.7%
associate-*l*70.7%
associate-/l*70.7%
distribute-lft-out70.7%
Simplified70.7%
add-sqr-sqrt70.7%
associate-/l*70.7%
*-commutative70.7%
sqrt-prod70.7%
sqrt-pow170.7%
metadata-eval70.7%
pow170.7%
metadata-eval70.7%
*-commutative70.7%
sqrt-prod70.7%
sqrt-pow178.0%
metadata-eval78.0%
pow178.0%
metadata-eval78.0%
Applied egg-rr78.0%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 5e+296) (+ (* x x) (* (* y 4.0) (- t (* z_m z_m)))) (- (* x x) (* t (* y (+ -4.0 (* (* z_m 2.0) (/ (* z_m 2.0) t))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 5e+296) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((z_m * z_m) <= 5d+296) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
else
tmp = (x * x) - (t * (y * ((-4.0d0) + ((z_m * 2.0d0) * ((z_m * 2.0d0) / t)))))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 5e+296) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t)))));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 5e+296: tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))) else: tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t))))) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 5e+296) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m)))); else tmp = Float64(Float64(x * x) - Float64(t * Float64(y * Float64(-4.0 + Float64(Float64(z_m * 2.0) * Float64(Float64(z_m * 2.0) / t)))))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if ((z_m * z_m) <= 5e+296) tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))); else tmp = (x * x) - (t * (y * (-4.0 + ((z_m * 2.0) * ((z_m * 2.0) / t))))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 5e+296], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * N[(-4.0 + N[(N[(z$95$m * 2.0), $MachinePrecision] * N[(N[(z$95$m * 2.0), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 5 \cdot 10^{+296}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot \left(-4 + \left(z\_m \cdot 2\right) \cdot \frac{z\_m \cdot 2}{t}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.0000000000000001e296Initial program 95.9%
if 5.0000000000000001e296 < (*.f64 z z) Initial program 68.1%
Taylor expanded in t around inf 68.1%
*-commutative68.1%
associate-/l*68.1%
associate-*r*68.1%
*-commutative68.1%
associate-/l*68.1%
associate-*l*68.1%
associate-/l*68.1%
distribute-lft-out68.1%
Simplified68.1%
add-sqr-sqrt68.1%
associate-/l*68.1%
*-commutative68.1%
sqrt-prod68.1%
sqrt-pow134.4%
metadata-eval34.4%
pow134.4%
metadata-eval34.4%
*-commutative34.4%
sqrt-prod34.4%
sqrt-pow179.9%
metadata-eval79.9%
pow179.9%
metadata-eval79.9%
Applied egg-rr79.9%
Final simplification92.3%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* x x) 8.8e+296) (+ (* x x) (* (* y 4.0) (- t (* z_m z_m)))) (- (* x x) (* y (* t -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 8.8e+296) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = (x * x) - (y * (t * -4.0));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x * x) <= 8.8d+296) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
else
tmp = (x * x) - (y * (t * (-4.0d0)))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 8.8e+296) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = (x * x) - (y * (t * -4.0));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (x * x) <= 8.8e+296: tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))) else: tmp = (x * x) - (y * (t * -4.0)) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(x * x) <= 8.8e+296) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m)))); else tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if ((x * x) <= 8.8e+296) tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))); else tmp = (x * x) - (y * (t * -4.0)); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8.8e+296], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8.8 \cdot 10^{+296}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 8.80000000000000056e296Initial program 91.8%
if 8.80000000000000056e296 < (*.f64 x x) Initial program 84.3%
Taylor expanded in z around 0 91.6%
*-commutative91.6%
*-commutative91.6%
associate-*l*91.6%
Simplified91.6%
Final simplification91.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (- (* x x) (* y (* t -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (x * x) - (y * (t * -4.0));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (x * x) - (y * (t * (-4.0d0)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (x * x) - (y * (t * -4.0));
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (x * x) - (y * (t * -4.0))
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (x * x) - (y * (t * -4.0)); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x \cdot x - y \cdot \left(t \cdot -4\right)
\end{array}
Initial program 89.7%
Taylor expanded in z around 0 66.0%
*-commutative66.0%
*-commutative66.0%
associate-*l*66.0%
Simplified66.0%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (* 4.0 (* y t)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return 4.0 * (y * t);
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = 4.0d0 * (y * t)
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return 4.0 * (y * t);
}
z_m = math.fabs(z) def code(x, y, z_m, t): return 4.0 * (y * t)
z_m = abs(z) function code(x, y, z_m, t) return Float64(4.0 * Float64(y * t)) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = 4.0 * (y * t); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
4 \cdot \left(y \cdot t\right)
\end{array}
Initial program 89.7%
Taylor expanded in t around inf 33.6%
*-commutative33.6%
Simplified33.6%
(FPCore (x y z t) :precision binary64 (- (* x x) (* 4.0 (* y (- (* z z) t)))))
double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - (4.0d0 * (y * ((z * z) - t)))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
def code(x, y, z, t): return (x * x) - (4.0 * (y * ((z * z) - t)))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(4.0 * Float64(y * Float64(Float64(z * z) - t)))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (4.0 * (y * ((z * z) - t))); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)
\end{array}
herbie shell --seed 2024083
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:alt
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))