
(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 8 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 4e+224) (fma x_m x_m (* (- (* z z) t) (* y -4.0))) (fma (* y 4.0) t (* x_m x_m))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 4e+224) {
tmp = fma(x_m, x_m, (((z * z) - t) * (y * -4.0)));
} else {
tmp = fma((y * 4.0), t, (x_m * x_m));
}
return tmp;
}
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 4e+224) tmp = fma(x_m, x_m, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = fma(Float64(y * 4.0), t, Float64(x_m * x_m)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 4e+224], N[(x$95$m * x$95$m + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 4.0), $MachinePrecision] * t + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4 \cdot 10^{+224}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t, x\_m \cdot x\_m\right)\\
\end{array}
\end{array}
if x < 3.99999999999999988e224Initial program 91.0%
fmm-def93.9%
distribute-lft-neg-in93.9%
*-commutative93.9%
distribute-rgt-neg-in93.9%
metadata-eval93.9%
Simplified93.9%
if 3.99999999999999988e224 < x Initial program 64.7%
cancel-sign-sub-inv64.7%
distribute-lft-neg-out64.7%
+-commutative64.7%
distribute-lft-neg-out64.7%
distribute-lft-neg-in64.7%
distribute-rgt-neg-in64.7%
fma-define82.4%
sub-neg82.4%
+-commutative82.4%
distribute-neg-in82.4%
remove-double-neg82.4%
sub-neg82.4%
Simplified82.4%
Taylor expanded in t around inf 100.0%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= x_m 1.2e+150) (+ (* x_m x_m) (* t (* 4.0 (- y (/ (* z y) (/ t z)))))) (fma (* y 4.0) t (* x_m x_m))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 1.2e+150) {
tmp = (x_m * x_m) + (t * (4.0 * (y - ((z * y) / (t / z)))));
} else {
tmp = fma((y * 4.0), t, (x_m * x_m));
}
return tmp;
}
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 1.2e+150) tmp = Float64(Float64(x_m * x_m) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / z)))))); else tmp = fma(Float64(y * 4.0), t, Float64(x_m * x_m)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 1.2e+150], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 4.0), $MachinePrecision] * t + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 1.2 \cdot 10^{+150}:\\
\;\;\;\;x\_m \cdot x\_m + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t, x\_m \cdot x\_m\right)\\
\end{array}
\end{array}
if x < 1.20000000000000001e150Initial program 92.0%
Taylor expanded in t around inf 89.8%
+-commutative89.8%
*-commutative89.8%
*-commutative89.8%
metadata-eval89.8%
distribute-rgt-neg-in89.8%
distribute-lft-neg-in89.8%
distribute-rgt-out89.8%
unsub-neg89.8%
associate-/l*88.4%
Simplified88.4%
pow288.4%
Applied egg-rr88.4%
associate-*r/91.0%
associate-*r*92.7%
clear-num92.7%
un-div-inv92.7%
Applied egg-rr92.7%
if 1.20000000000000001e150 < x Initial program 73.0%
cancel-sign-sub-inv73.0%
distribute-lft-neg-out73.0%
+-commutative73.0%
distribute-lft-neg-out73.0%
distribute-lft-neg-in73.0%
distribute-rgt-neg-in73.0%
fma-define81.1%
sub-neg81.1%
+-commutative81.1%
distribute-neg-in81.1%
remove-double-neg81.1%
sub-neg81.1%
Simplified81.1%
Taylor expanded in t around inf 89.2%
Final simplification92.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))
(+ (* x_m x_m) (* t (* 4.0 (- y (/ (* z y) (/ t z))))))
(if (<= t_1 INFINITY) t_1 (+ (* x_m x_m) (* (- (* z z) t) (* y 4.0)))))))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 = (x_m * x_m) + (t * (4.0 * (y - ((z * y) / (t / z)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x_m * x_m) + (((z * z) - t) * (y * 4.0));
}
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 = (x_m * x_m) + (t * (4.0 * (y - ((z * y) / (t / z)))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x_m * x_m) + (((z * z) - t) * (y * 4.0));
}
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 = (x_m * x_m) + (t * (4.0 * (y - ((z * y) / (t / z))))) elif t_1 <= math.inf: tmp = t_1 else: tmp = (x_m * x_m) + (((z * z) - t) * (y * 4.0)) 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 <= Float64(-Inf)) tmp = Float64(Float64(x_m * x_m) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / z)))))); elseif (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x_m * x_m) + Float64(Float64(Float64(z * z) - t) * Float64(y * 4.0))); 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 = (x_m * x_m) + (t * (4.0 * (y - ((z * y) / (t / z))))); elseif (t_1 <= Inf) tmp = t_1; else tmp = (x_m * x_m) + (((z * z) - t) * (y * 4.0)); 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)], N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $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:\\
\;\;\;\;x\_m \cdot x\_m + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m + \left(z \cdot z - t\right) \cdot \left(y \cdot 4\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 87.6%
Taylor expanded in t around inf 87.6%
+-commutative87.6%
*-commutative87.6%
*-commutative87.6%
metadata-eval87.6%
distribute-rgt-neg-in87.6%
distribute-lft-neg-in87.6%
distribute-rgt-out87.6%
unsub-neg87.6%
associate-/l*87.6%
Simplified87.6%
pow287.6%
Applied egg-rr87.6%
associate-*r/95.0%
associate-*r*100.0%
clear-num100.0%
un-div-inv99.9%
Applied egg-rr99.9%
if -inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0Initial program 98.5%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.0%
swap-sqr25.0%
metadata-eval25.0%
metadata-eval25.0%
swap-sqr25.0%
sqrt-unprod25.0%
add-sqr-sqrt65.0%
metadata-eval65.0%
distribute-rgt-neg-in65.0%
Applied egg-rr65.0%
Final simplification96.1%
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 (+ (* x_m x_m) (* (- (* z z) t) (* y 4.0))))))
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 = (x_m * x_m) + (((z * z) - t) * (y * 4.0));
}
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 = (x_m * x_m) + (((z * z) - t) * (y * 4.0));
}
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 = (x_m * x_m) + (((z * z) - t) * (y * 4.0)) 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(Float64(x_m * x_m) + Float64(Float64(Float64(z * z) - t) * Float64(y * 4.0))); 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 = (x_m * x_m) + (((z * z) - t) * (y * 4.0)); 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[(N[(x$95$m * x$95$m), $MachinePrecision] + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $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}:\\
\;\;\;\;x\_m \cdot x\_m + \left(z \cdot z - t\right) \cdot \left(y \cdot 4\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 96.8%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.0%
swap-sqr25.0%
metadata-eval25.0%
metadata-eval25.0%
swap-sqr25.0%
sqrt-unprod25.0%
add-sqr-sqrt65.0%
metadata-eval65.0%
distribute-rgt-neg-in65.0%
Applied egg-rr65.0%
Final simplification94.3%
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 (+ (* x_m x_m) (* t (* y -4.0))))))
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 = (x_m * x_m) + (t * (y * -4.0));
}
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 = (x_m * x_m) + (t * (y * -4.0));
}
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 = (x_m * x_m) + (t * (y * -4.0)) 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(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) t_1 = (x_m * x_m) + ((y * 4.0) * (t - (z * z))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; 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_] := 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[(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}
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}:\\
\;\;\;\;x\_m \cdot x\_m + t \cdot \left(y \cdot -4\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 96.8%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 0.0%
add-sqr-sqrt0.0%
sqrt-unprod25.0%
swap-sqr25.0%
metadata-eval25.0%
metadata-eval25.0%
swap-sqr25.0%
sqrt-unprod25.0%
add-sqr-sqrt65.0%
metadata-eval65.0%
distribute-rgt-neg-in65.0%
Applied egg-rr65.0%
Taylor expanded in z around 0 60.0%
neg-mul-160.0%
Simplified60.0%
Taylor expanded in y around 0 60.0%
*-commutative60.0%
Simplified60.0%
Final simplification93.9%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* z z) 4.6e+203) (- (* x_m x_m) (* y (* t -4.0))) (* (* z z) (* y -4.0))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((z * z) <= 4.6e+203) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = (z * z) * (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 ((z * z) <= 4.6d+203) then
tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
else
tmp = (z * z) * (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 ((z * z) <= 4.6e+203) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = (z * z) * (y * -4.0);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if (z * z) <= 4.6e+203: tmp = (x_m * x_m) - (y * (t * -4.0)) else: tmp = (z * z) * (y * -4.0) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4.6e+203) tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(z * z) * 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 ((z * z) <= 4.6e+203) tmp = (x_m * x_m) - (y * (t * -4.0)); else tmp = (z * z) * (y * -4.0); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4.6e+203], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4.6 \cdot 10^{+203}:\\
\;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.5999999999999998e203Initial program 95.1%
Taylor expanded in z around 0 82.4%
*-commutative82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
if 4.5999999999999998e203 < (*.f64 z z) Initial program 78.8%
fmm-def83.1%
distribute-lft-neg-in83.1%
*-commutative83.1%
distribute-rgt-neg-in83.1%
metadata-eval83.1%
Simplified83.1%
Taylor expanded in z around inf 75.3%
associate-*r*75.3%
*-commutative75.3%
*-commutative75.3%
Simplified75.3%
pow276.6%
Applied egg-rr75.3%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* z z) 9.2e-44) (* 4.0 (* t y)) (* (* z z) (* y -4.0))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((z * z) <= 9.2e-44) {
tmp = 4.0 * (t * y);
} else {
tmp = (z * z) * (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 ((z * z) <= 9.2d-44) then
tmp = 4.0d0 * (t * y)
else
tmp = (z * z) * (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 ((z * z) <= 9.2e-44) {
tmp = 4.0 * (t * y);
} else {
tmp = (z * z) * (y * -4.0);
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if (z * z) <= 9.2e-44: tmp = 4.0 * (t * y) else: tmp = (z * z) * (y * -4.0) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(z * z) <= 9.2e-44) tmp = Float64(4.0 * Float64(t * y)); else tmp = Float64(Float64(z * z) * 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 ((z * z) <= 9.2e-44) tmp = 4.0 * (t * y); else tmp = (z * z) * (y * -4.0); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 9.2e-44], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 9.2 \cdot 10^{-44}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.19999999999999992e-44Initial program 95.3%
fmm-def96.3%
distribute-lft-neg-in96.3%
*-commutative96.3%
distribute-rgt-neg-in96.3%
metadata-eval96.3%
Simplified96.3%
Taylor expanded in t around inf 46.6%
*-commutative46.6%
Simplified46.6%
if 9.19999999999999992e-44 < (*.f64 z z) Initial program 84.7%
fmm-def88.8%
distribute-lft-neg-in88.8%
*-commutative88.8%
distribute-rgt-neg-in88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in z around inf 58.4%
associate-*r*58.4%
*-commutative58.4%
*-commutative58.4%
Simplified58.4%
pow279.5%
Applied egg-rr58.4%
Final simplification53.4%
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 89.2%
fmm-def91.9%
distribute-lft-neg-in91.9%
*-commutative91.9%
distribute-rgt-neg-in91.9%
metadata-eval91.9%
Simplified91.9%
Taylor expanded in t around inf 30.5%
*-commutative30.5%
Simplified30.5%
Final simplification30.5%
(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 2024172
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:alt
(! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))