
(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 10 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}
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= x_m 1.45e+246) (fma x_m x_m (* (- (* z z) t) (* y -4.0))) (- (* x_m x_m) (* t (* y 4.0)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 1.45e+246) {
tmp = fma(x_m, x_m, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x_m * x_m) - (t * (y * 4.0));
}
return tmp;
}
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 1.45e+246) tmp = fma(x_m, x_m, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(y * 4.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 1.45e+246], N[(x$95$m * x$95$m + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.45 \cdot 10^{+246}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \left(y \cdot 4\right)\\
\end{array}
\end{array}
if x < 1.45000000000000007e246Initial program 88.9%
fma-neg92.6%
distribute-lft-neg-in92.6%
*-commutative92.6%
distribute-rgt-neg-in92.6%
metadata-eval92.6%
Simplified92.6%
if 1.45000000000000007e246 < x Initial program 75.0%
Taylor expanded in t around inf 75.0%
associate-*r*75.0%
sub-neg75.0%
distribute-rgt-in75.0%
*-commutative75.0%
*-commutative75.0%
add-sqr-sqrt50.0%
sqrt-unprod66.7%
swap-sqr66.7%
metadata-eval66.7%
metadata-eval66.7%
swap-sqr66.7%
sqrt-unprod33.3%
add-sqr-sqrt83.3%
associate-*l*83.3%
metadata-eval83.3%
neg-mul-183.3%
add-sqr-sqrt33.3%
Applied egg-rr83.3%
distribute-lft1-in91.7%
unpow291.7%
associate-*r/91.7%
fma-define91.7%
Simplified91.7%
Taylor expanded in z around 0 100.0%
Final simplification92.9%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* (- (* z z) t) (* y 4.0)) 4e+252) (+ (* x_m x_m) (* (* y 4.0) (- t (* z z)))) (* -4.0 (* t (* y (fma z (/ z t) -1.0))))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((((z * z) - t) * (y * 4.0)) <= 4e+252) {
tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = -4.0 * (t * (y * fma(z, (z / t), -1.0)));
}
return tmp;
}
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(Float64(Float64(z * z) - t) * Float64(y * 4.0)) <= 4e+252) tmp = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(-4.0 * Float64(t * Float64(y * fma(z, Float64(z / t), -1.0)))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], 4e+252], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * N[(y * N[(z * N[(z / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot z - t\right) \cdot \left(y \cdot 4\right) \leq 4 \cdot 10^{+252}:\\
\;\;\;\;x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \left(y \cdot \mathsf{fma}\left(z, \frac{z}{t}, -1\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 4.0000000000000004e252Initial program 97.1%
if 4.0000000000000004e252 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) Initial program 58.5%
Taylor expanded in t around inf 58.5%
Taylor expanded in x around 0 73.7%
unpow273.7%
associate-*r/76.9%
fma-neg76.9%
metadata-eval76.9%
Simplified76.9%
Final simplification92.5%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* x_m x_m) 5e+262) (+ (* x_m x_m) (* (* y 4.0) (- t (* z z)))) (fma x_m x_m (* y (* t 4.0)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((x_m * x_m) <= 5e+262) {
tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = fma(x_m, x_m, (y * (t * 4.0)));
}
return tmp;
}
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(x_m * x_m) <= 5e+262) tmp = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = fma(x_m, x_m, Float64(y * Float64(t * 4.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 5e+262], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * x$95$m + N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 5 \cdot 10^{+262}:\\
\;\;\;\;x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m, y \cdot \left(t \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000000008e262Initial program 93.2%
if 5.00000000000000008e262 < (*.f64 x x) Initial program 72.3%
Taylor expanded in z around 0 77.0%
associate-*r*77.0%
Simplified77.0%
fma-neg85.2%
*-commutative85.2%
distribute-rgt-neg-in85.2%
distribute-lft-neg-in85.2%
metadata-eval85.2%
Applied egg-rr85.2%
Final simplification91.3%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* x_m x_m) 5e+265) (+ (* x_m x_m) (* (* y 4.0) (- t (* z z)))) (pow x_m 2.0)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((x_m * x_m) <= 5e+265) {
tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = pow(x_m, 2.0);
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x_m * x_m) <= 5d+265) then
tmp = (x_m * x_m) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = x_m ** 2.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
double tmp;
if ((x_m * x_m) <= 5e+265) {
tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = Math.pow(x_m, 2.0);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if (x_m * x_m) <= 5e+265: tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z))) else: tmp = math.pow(x_m, 2.0) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(x_m * x_m) <= 5e+265) tmp = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = x_m ^ 2.0; end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if ((x_m * x_m) <= 5e+265) tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z))); else tmp = x_m ^ 2.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 5e+265], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[x$95$m, 2.0], $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \cdot x\_m \leq 5 \cdot 10^{+265}:\\
\;\;\;\;x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;{x\_m}^{2}\\
\end{array}
\end{array}
if (*.f64 x x) < 5.0000000000000002e265Initial program 93.3%
if 5.0000000000000002e265 < (*.f64 x x) Initial program 71.8%
Taylor expanded in x around 0 73.3%
Simplified84.4%
Final simplification91.2%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (let* ((t_1 (+ (* x_m x_m) (* (* y 4.0) (- t (* z z)))))) (if (<= t_1 INFINITY) t_1 (* -4.0 (* t y)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = -4.0 * (t * y);
}
return tmp;
}
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
double t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = -4.0 * (t * y);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = -4.0 * (t * y) return tmp
x_m = abs(x) function code(x_m, y, z, t) t_1 = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(-4.0 * Float64(t * y)); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = -4.0 * (t * y); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_1 := x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot y\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0Initial program 94.1%
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 t around inf 0.0%
associate-*r*0.0%
sub-neg0.0%
distribute-rgt-in0.0%
*-commutative0.0%
*-commutative0.0%
add-sqr-sqrt0.0%
sqrt-unprod12.5%
swap-sqr12.5%
metadata-eval12.5%
metadata-eval12.5%
swap-sqr12.5%
sqrt-unprod12.5%
add-sqr-sqrt12.5%
associate-*l*12.5%
metadata-eval12.5%
neg-mul-112.5%
add-sqr-sqrt12.5%
Applied egg-rr12.5%
distribute-lft1-in25.0%
unpow225.0%
associate-*r/25.0%
fma-define25.0%
Simplified25.0%
Taylor expanded in x around 0 50.0%
associate-*r*50.0%
+-commutative50.0%
unpow250.0%
associate-*r/50.0%
fma-undefine50.0%
Simplified50.0%
Taylor expanded in t around inf 44.5%
Final simplification91.0%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= x_m 4e+200) (- (* x_m x_m) (* y (* t -4.0))) (- (* x_m x_m) (* t (* y 4.0)))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 4e+200) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = (x_m * x_m) - (t * (y * 4.0));
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x_m <= 4d+200) then
tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
else
tmp = (x_m * x_m) - (t * (y * 4.0d0))
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 4e+200) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = (x_m * x_m) - (t * (y * 4.0));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if x_m <= 4e+200: tmp = (x_m * x_m) - (y * (t * -4.0)) else: tmp = (x_m * x_m) - (t * (y * 4.0)) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 4e+200) tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(y * 4.0))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if (x_m <= 4e+200) tmp = (x_m * x_m) - (y * (t * -4.0)); else tmp = (x_m * x_m) - (t * (y * 4.0)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 4e+200], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4 \cdot 10^{+200}:\\
\;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \left(y \cdot 4\right)\\
\end{array}
\end{array}
if x < 3.9999999999999999e200Initial program 89.1%
Taylor expanded in z around 0 63.9%
associate-*r*63.9%
Simplified63.9%
if 3.9999999999999999e200 < x Initial program 75.0%
Taylor expanded in t around inf 75.0%
associate-*r*75.0%
sub-neg75.0%
distribute-rgt-in75.0%
*-commutative75.0%
*-commutative75.0%
add-sqr-sqrt43.8%
sqrt-unprod68.8%
swap-sqr68.8%
metadata-eval68.8%
metadata-eval68.8%
swap-sqr68.8%
sqrt-unprod37.5%
add-sqr-sqrt81.3%
associate-*l*81.3%
metadata-eval81.3%
neg-mul-181.3%
add-sqr-sqrt37.5%
Applied egg-rr81.3%
distribute-lft1-in87.5%
unpow287.5%
associate-*r/87.5%
fma-define87.5%
Simplified87.5%
Taylor expanded in z around 0 93.8%
Final simplification65.7%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= z 2.3e+94) (* 4.0 (* t y)) (* -4.0 (* t y))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (z <= 2.3e+94) {
tmp = 4.0 * (t * y);
} else {
tmp = -4.0 * (t * y);
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 2.3d+94) then
tmp = 4.0d0 * (t * y)
else
tmp = (-4.0d0) * (t * y)
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
double tmp;
if (z <= 2.3e+94) {
tmp = 4.0 * (t * y);
} else {
tmp = -4.0 * (t * y);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if z <= 2.3e+94: tmp = 4.0 * (t * y) else: tmp = -4.0 * (t * y) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (z <= 2.3e+94) tmp = Float64(4.0 * Float64(t * y)); else tmp = Float64(-4.0 * Float64(t * y)); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if (z <= 2.3e+94) tmp = 4.0 * (t * y); else tmp = -4.0 * (t * y); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[z, 2.3e+94], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{+94}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot y\right)\\
\end{array}
\end{array}
if z < 2.3e94Initial program 91.4%
Taylor expanded in t around inf 40.8%
*-commutative40.8%
Simplified40.8%
if 2.3e94 < z Initial program 70.6%
Taylor expanded in t around inf 68.0%
associate-*r*58.2%
sub-neg58.2%
distribute-rgt-in45.4%
*-commutative45.4%
*-commutative45.4%
add-sqr-sqrt11.4%
sqrt-unprod37.7%
swap-sqr37.7%
metadata-eval37.7%
metadata-eval37.7%
swap-sqr37.7%
sqrt-unprod31.4%
add-sqr-sqrt50.5%
associate-*l*50.5%
metadata-eval50.5%
neg-mul-150.5%
add-sqr-sqrt31.4%
Applied egg-rr50.5%
distribute-lft1-in55.6%
unpow255.6%
associate-*r/60.4%
fma-define60.4%
Simplified60.4%
Taylor expanded in x around 0 65.8%
associate-*r*57.8%
+-commutative57.8%
unpow257.8%
associate-*r/62.5%
fma-undefine62.5%
Simplified62.5%
Taylor expanded in t around inf 12.1%
Final simplification36.4%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (- (* x_m x_m) (* y (* t -4.0))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
return (x_m * x_m) - (y * (t * -4.0));
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x_m * x_m) - (y * (t * (-4.0d0)))
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
return (x_m * x_m) - (y * (t * -4.0));
}
x_m = math.fabs(x) def code(x_m, y, z, t): return (x_m * x_m) - (y * (t * -4.0))
x_m = abs(x) function code(x_m, y, z, t) return Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))) end
x_m = abs(x); function tmp = code(x_m, y, z, t) tmp = (x_m * x_m) - (y * (t * -4.0)); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)
\end{array}
Initial program 88.2%
Taylor expanded in z around 0 65.0%
associate-*r*65.0%
Simplified65.0%
Final simplification65.0%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (* -4.0 (* t y)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
return -4.0 * (t * y);
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (-4.0d0) * (t * y)
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
return -4.0 * (t * y);
}
x_m = math.fabs(x) def code(x_m, y, z, t): return -4.0 * (t * y)
x_m = abs(x) function code(x_m, y, z, t) return Float64(-4.0 * Float64(t * y)) end
x_m = abs(x); function tmp = code(x_m, y, z, t) tmp = -4.0 * (t * y); end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
-4 \cdot \left(t \cdot y\right)
\end{array}
Initial program 88.2%
Taylor expanded in t around inf 85.9%
associate-*r*84.3%
sub-neg84.3%
distribute-rgt-in75.7%
*-commutative75.7%
*-commutative75.7%
add-sqr-sqrt36.8%
sqrt-unprod52.5%
swap-sqr52.5%
metadata-eval52.5%
metadata-eval52.5%
swap-sqr52.5%
sqrt-unprod27.7%
add-sqr-sqrt52.8%
associate-*l*52.8%
metadata-eval52.8%
neg-mul-152.8%
add-sqr-sqrt27.7%
Applied egg-rr52.8%
distribute-lft1-in55.2%
unpow255.2%
associate-*r/55.9%
fma-define55.9%
Simplified55.9%
Taylor expanded in x around 0 30.3%
associate-*r*30.5%
+-commutative30.5%
unpow230.5%
associate-*r/31.2%
fma-undefine31.2%
Simplified31.2%
Taylor expanded in t around inf 8.4%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 0.0)
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
return 0.0;
}
x_m = abs(x)
real(8) function code(x_m, y, z, t)
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 0.0d0
end function
x_m = Math.abs(x);
public static double code(double x_m, double y, double z, double t) {
return 0.0;
}
x_m = math.fabs(x) def code(x_m, y, z, t): return 0.0
x_m = abs(x) function code(x_m, y, z, t) return 0.0 end
x_m = abs(x); function tmp = code(x_m, y, z, t) tmp = 0.0; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := 0.0
\begin{array}{l}
x_m = \left|x\right|
\\
0
\end{array}
Initial program 88.2%
Taylor expanded in x around 0 63.2%
Simplified2.9%
(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 2024086
(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))))