
(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 1e+249) (fma x_m x_m (* (- (* z z) t) (* y -4.0))) (* x_m x_m)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 1e+249) {
tmp = fma(x_m, x_m, (((z * z) - t) * (y * -4.0)));
} else {
tmp = x_m * x_m;
}
return tmp;
}
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 1e+249) tmp = fma(x_m, x_m, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = 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, 1e+249], N[(x$95$m * x$95$m + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 10^{+249}:\\
\;\;\;\;\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\\
\end{array}
\end{array}
if x < 9.9999999999999992e248Initial program 89.9%
fmm-def92.8%
distribute-lft-neg-in92.8%
*-commutative92.8%
distribute-rgt-neg-in92.8%
metadata-eval92.8%
Simplified92.8%
if 9.9999999999999992e248 < x Initial program 68.8%
Taylor expanded in y around 0 68.8%
Simplified100.0%
--rgt-identity100.0%
Applied egg-rr100.0%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* z z) 1e+31) (- (* x_m x_m) (* y (* t -4.0))) (* t (* y (+ 4.0 (/ (* z -4.0) (/ t z)))))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+31) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = t * (y * (4.0 + ((z * -4.0) / (t / z))));
}
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) <= 1d+31) then
tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
else
tmp = t * (y * (4.0d0 + ((z * (-4.0d0)) / (t / z))))
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) <= 1e+31) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = t * (y * (4.0 + ((z * -4.0) / (t / z))));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if (z * z) <= 1e+31: tmp = (x_m * x_m) - (y * (t * -4.0)) else: tmp = t * (y * (4.0 + ((z * -4.0) / (t / z)))) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+31) tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))); else tmp = Float64(t * Float64(y * Float64(4.0 + Float64(Float64(z * -4.0) / Float64(t / z))))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if ((z * z) <= 1e+31) tmp = (x_m * x_m) - (y * (t * -4.0)); else tmp = t * (y * (4.0 + ((z * -4.0) / (t / z)))); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+31], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+31}:\\
\;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(4 + \frac{z \cdot -4}{\frac{t}{z}}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.9999999999999996e30Initial program 95.4%
Taylor expanded in z around 0 90.7%
*-commutative90.7%
*-commutative90.7%
associate-*l*90.7%
Simplified90.7%
if 9.9999999999999996e30 < (*.f64 z z) Initial program 81.3%
Taylor expanded in t around inf 75.1%
Taylor expanded in y around -inf 71.3%
unpow271.3%
*-un-lft-identity71.3%
times-frac72.8%
Applied egg-rr72.8%
/-rgt-identity72.8%
associate-*r*72.8%
clear-num72.9%
un-div-inv72.9%
Applied egg-rr72.9%
Final simplification82.1%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* z z) 1e+31) (- (* x_m x_m) (* y (* t -4.0))) (* t (* y (+ 4.0 (* (* z -4.0) (/ z t)))))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+31) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = t * (y * (4.0 + ((z * -4.0) * (z / t))));
}
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) <= 1d+31) then
tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
else
tmp = t * (y * (4.0d0 + ((z * (-4.0d0)) * (z / t))))
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) <= 1e+31) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = t * (y * (4.0 + ((z * -4.0) * (z / t))));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if (z * z) <= 1e+31: tmp = (x_m * x_m) - (y * (t * -4.0)) else: tmp = t * (y * (4.0 + ((z * -4.0) * (z / t)))) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+31) tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))); else tmp = Float64(t * Float64(y * Float64(4.0 + Float64(Float64(z * -4.0) * Float64(z / t))))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if ((z * z) <= 1e+31) tmp = (x_m * x_m) - (y * (t * -4.0)); else tmp = t * (y * (4.0 + ((z * -4.0) * (z / t)))); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+31], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+31}:\\
\;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(4 + \left(z \cdot -4\right) \cdot \frac{z}{t}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.9999999999999996e30Initial program 95.4%
Taylor expanded in z around 0 90.7%
*-commutative90.7%
*-commutative90.7%
associate-*l*90.7%
Simplified90.7%
if 9.9999999999999996e30 < (*.f64 z z) Initial program 81.3%
Taylor expanded in t around inf 75.1%
Taylor expanded in y around -inf 71.3%
clear-num71.3%
un-div-inv71.3%
Applied egg-rr71.3%
pow271.3%
div-inv71.3%
clear-num71.3%
associate-*r/72.8%
associate-*r*72.8%
Applied egg-rr72.8%
Final simplification82.1%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= (* z z) 4.7e+35) (- (* x_m x_m) (* y (* t -4.0))) (* t (* y (+ 4.0 (* -4.0 (/ (* z z) t)))))))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if ((z * z) <= 4.7e+35) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = t * (y * (4.0 + (-4.0 * ((z * z) / t))));
}
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.7d+35) then
tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
else
tmp = t * (y * (4.0d0 + ((-4.0d0) * ((z * z) / t))))
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.7e+35) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = t * (y * (4.0 + (-4.0 * ((z * z) / t))));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if (z * z) <= 4.7e+35: tmp = (x_m * x_m) - (y * (t * -4.0)) else: tmp = t * (y * (4.0 + (-4.0 * ((z * z) / t)))) return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4.7e+35) tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))); else tmp = Float64(t * Float64(y * Float64(4.0 + Float64(-4.0 * Float64(Float64(z * z) / t))))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if ((z * z) <= 4.7e+35) tmp = (x_m * x_m) - (y * (t * -4.0)); else tmp = t * (y * (4.0 + (-4.0 * ((z * z) / t)))); 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.7e+35], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(4.0 + N[(-4.0 * N[(N[(z * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4.7 \cdot 10^{+35}:\\
\;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(4 + -4 \cdot \frac{z \cdot z}{t}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.70000000000000033e35Initial program 95.4%
Taylor expanded in z around 0 90.7%
*-commutative90.7%
*-commutative90.7%
associate-*l*90.7%
Simplified90.7%
if 4.70000000000000033e35 < (*.f64 z z) Initial program 81.3%
Taylor expanded in t around inf 75.1%
Taylor expanded in y around -inf 71.3%
unpow271.3%
Applied egg-rr71.3%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= x_m 4.8e+149) (+ (* x_m x_m) (* (* y 4.0) (- t (* z z)))) (* x_m x_m)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 4.8e+149) {
tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = x_m * x_m;
}
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 <= 4.8d+149) then
tmp = (x_m * x_m) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = x_m * x_m
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 <= 4.8e+149) {
tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = x_m * x_m;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if x_m <= 4.8e+149: tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z))) else: tmp = x_m * x_m return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 4.8e+149) tmp = Float64(Float64(x_m * x_m) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(x_m * x_m); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if (x_m <= 4.8e+149) tmp = (x_m * x_m) + ((y * 4.0) * (t - (z * z))); else tmp = x_m * x_m; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 4.8e+149], 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), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4.8 \cdot 10^{+149}:\\
\;\;\;\;x\_m \cdot x\_m + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m\\
\end{array}
\end{array}
if x < 4.80000000000000024e149Initial program 90.3%
if 4.80000000000000024e149 < x Initial program 78.4%
Taylor expanded in y around 0 78.4%
Simplified94.6%
--rgt-identity94.6%
Applied egg-rr94.6%
Final simplification90.9%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= x_m 4e+149) (- (* x_m x_m) (* y (* t -4.0))) (* 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+149) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = x_m * x_m;
}
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+149) then
tmp = (x_m * x_m) - (y * (t * (-4.0d0)))
else
tmp = x_m * x_m
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+149) {
tmp = (x_m * x_m) - (y * (t * -4.0));
} else {
tmp = x_m * x_m;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if x_m <= 4e+149: tmp = (x_m * x_m) - (y * (t * -4.0)) else: tmp = x_m * x_m return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 4e+149) tmp = Float64(Float64(x_m * x_m) - Float64(y * Float64(t * -4.0))); else tmp = Float64(x_m * x_m); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if (x_m <= 4e+149) tmp = (x_m * x_m) - (y * (t * -4.0)); else tmp = x_m * x_m; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 4e+149], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4 \cdot 10^{+149}:\\
\;\;\;\;x\_m \cdot x\_m - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m\\
\end{array}
\end{array}
if x < 4.0000000000000002e149Initial program 90.3%
Taylor expanded in z around 0 59.5%
*-commutative59.5%
*-commutative59.5%
associate-*l*59.5%
Simplified59.5%
if 4.0000000000000002e149 < x Initial program 78.4%
Taylor expanded in y around 0 78.4%
Simplified94.6%
--rgt-identity94.6%
Applied egg-rr94.6%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (if (<= x_m 4.9e+47) (* 4.0 (* t y)) (* x_m x_m)))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 4.9e+47) {
tmp = 4.0 * (t * y);
} else {
tmp = x_m * x_m;
}
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 <= 4.9d+47) then
tmp = 4.0d0 * (t * y)
else
tmp = x_m * x_m
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 <= 4.9e+47) {
tmp = 4.0 * (t * y);
} else {
tmp = x_m * x_m;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m, y, z, t): tmp = 0 if x_m <= 4.9e+47: tmp = 4.0 * (t * y) else: tmp = x_m * x_m return tmp
x_m = abs(x) function code(x_m, y, z, t) tmp = 0.0 if (x_m <= 4.9e+47) tmp = Float64(4.0 * Float64(t * y)); else tmp = Float64(x_m * x_m); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m, y, z, t) tmp = 0.0; if (x_m <= 4.9e+47) tmp = 4.0 * (t * y); else tmp = x_m * x_m; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := If[LessEqual[x$95$m, 4.9e+47], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(x$95$m * x$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4.9 \cdot 10^{+47}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m\\
\end{array}
\end{array}
if x < 4.9000000000000003e47Initial program 90.1%
fmm-def92.6%
distribute-lft-neg-in92.6%
*-commutative92.6%
distribute-rgt-neg-in92.6%
metadata-eval92.6%
Simplified92.6%
Taylor expanded in t around inf 36.8%
*-commutative36.8%
Simplified36.8%
if 4.9000000000000003e47 < x Initial program 82.4%
Taylor expanded in y around 0 82.4%
Simplified83.7%
--rgt-identity83.7%
Applied egg-rr83.7%
Final simplification46.2%
x_m = (fabs.f64 x) (FPCore (x_m y z t) :precision binary64 (* x_m x_m))
x_m = fabs(x);
double code(double x_m, double y, double z, double t) {
return x_m * x_m;
}
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
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;
}
x_m = math.fabs(x) def code(x_m, y, z, t): return x_m * x_m
x_m = abs(x) function code(x_m, y, z, t) return Float64(x_m * x_m) end
x_m = abs(x); function tmp = code(x_m, y, z, t) tmp = x_m * x_m; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_, y_, z_, t_] := N[(x$95$m * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
x\_m \cdot x\_m
\end{array}
Initial program 88.6%
Taylor expanded in y around 0 88.6%
Simplified39.7%
--rgt-identity39.7%
Applied egg-rr39.7%
(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 2024180
(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))))