
(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}
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 2.8e+149) (fma (* y 4.0) (- t (* z_m z_m)) (* x x)) (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.8e+149) {
tmp = fma((y * 4.0), (t - (z_m * z_m)), (x * x));
} else {
tmp = z_m * (z_m * (y * -4.0));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 2.8e+149) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z_m * z_m)), Float64(x * x)); else tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0))); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 2.8e+149], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 2.8 \cdot 10^{+149}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z\_m \cdot z\_m, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 2.7999999999999999e149Initial program 94.2%
cancel-sign-sub-inv94.2%
distribute-lft-neg-out94.2%
+-commutative94.2%
distribute-lft-neg-out94.2%
distribute-lft-neg-in94.2%
distribute-rgt-neg-in94.2%
fma-define96.9%
sub-neg96.9%
+-commutative96.9%
distribute-neg-in96.9%
remove-double-neg96.9%
sub-neg96.9%
Simplified96.9%
if 2.7999999999999999e149 < z Initial program 75.3%
Taylor expanded in z around inf 86.7%
associate-*r*86.7%
*-commutative86.7%
Simplified86.7%
unpow286.7%
Applied egg-rr86.7%
add-sqr-sqrt29.2%
pow229.2%
sqrt-prod29.2%
sqrt-prod34.5%
add-sqr-sqrt34.5%
*-commutative34.5%
Applied egg-rr34.5%
*-commutative34.5%
unpow-prod-down29.2%
pow229.2%
add-sqr-sqrt86.7%
*-commutative86.7%
pow286.7%
associate-*r*94.5%
Applied egg-rr94.5%
Final simplification96.6%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= x 1.05e+170) (fma x x (* (- (* z_m z_m) t) (* y -4.0))) (pow x 2.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (x <= 1.05e+170) {
tmp = fma(x, x, (((z_m * z_m) - t) * (y * -4.0)));
} else {
tmp = pow(x, 2.0);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (x <= 1.05e+170) tmp = fma(x, x, Float64(Float64(Float64(z_m * z_m) - t) * Float64(y * -4.0))); else tmp = x ^ 2.0; end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[x, 1.05e+170], N[(x * x + N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[x, 2.0], $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z\_m \cdot z\_m - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{x}^{2}\\
\end{array}
\end{array}
if x < 1.04999999999999999e170Initial program 93.2%
fma-neg94.9%
distribute-lft-neg-in94.9%
*-commutative94.9%
distribute-rgt-neg-in94.9%
metadata-eval94.9%
Simplified94.9%
if 1.04999999999999999e170 < x Initial program 80.0%
Taylor expanded in x around inf 93.3%
Final simplification94.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 2e+298) (+ (* x x) (* (* y 4.0) (- t (* z_m z_m)))) (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 2e+298) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = z_m * (z_m * (y * -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 ((z_m * z_m) <= 2d+298) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
else
tmp = z_m * (z_m * (y * (-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 ((z_m * z_m) <= 2e+298) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = z_m * (z_m * (y * -4.0));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 2e+298: tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))) else: tmp = z_m * (z_m * (y * -4.0)) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 2e+298) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m)))); else tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0))); 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) <= 2e+298) tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))); else tmp = z_m * (z_m * (y * -4.0)); 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], 2e+298], 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[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+298}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e298Initial program 96.8%
if 1.9999999999999999e298 < (*.f64 z z) Initial program 76.0%
Taylor expanded in z around inf 85.4%
associate-*r*85.4%
*-commutative85.4%
Simplified85.4%
unpow285.4%
Applied egg-rr85.4%
add-sqr-sqrt42.8%
pow242.8%
sqrt-prod42.8%
sqrt-prod18.9%
add-sqr-sqrt47.0%
*-commutative47.0%
Applied egg-rr47.0%
*-commutative47.0%
unpow-prod-down42.8%
pow242.8%
add-sqr-sqrt85.4%
*-commutative85.4%
pow285.4%
associate-*r*93.9%
Applied egg-rr93.9%
Final simplification96.1%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 2e+231) (- (* x x) (* -4.0 (* y t))) (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 2e+231) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = z_m * (z_m * (y * -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 ((z_m * z_m) <= 2d+231) then
tmp = (x * x) - ((-4.0d0) * (y * t))
else
tmp = z_m * (z_m * (y * (-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 ((z_m * z_m) <= 2e+231) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = z_m * (z_m * (y * -4.0));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 2e+231: tmp = (x * x) - (-4.0 * (y * t)) else: tmp = z_m * (z_m * (y * -4.0)) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 2e+231) tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t))); else tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0))); 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) <= 2e+231) tmp = (x * x) - (-4.0 * (y * t)); else tmp = z_m * (z_m * (y * -4.0)); 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], 2e+231], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+231}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e231Initial program 96.6%
Taylor expanded in z around 0 84.8%
*-commutative84.8%
Simplified84.8%
if 2.0000000000000001e231 < (*.f64 z z) Initial program 79.8%
Taylor expanded in z around inf 83.9%
associate-*r*83.9%
*-commutative83.9%
Simplified83.9%
unpow283.9%
Applied egg-rr83.9%
add-sqr-sqrt37.4%
pow237.4%
sqrt-prod37.4%
sqrt-prod15.9%
add-sqr-sqrt41.0%
*-commutative41.0%
Applied egg-rr41.0%
*-commutative41.0%
unpow-prod-down37.4%
pow237.4%
add-sqr-sqrt83.9%
*-commutative83.9%
pow283.9%
associate-*r*90.9%
Applied egg-rr90.9%
Final simplification86.6%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 8.5e+76) (* (* y 4.0) t) (* (* z_m z_m) (* y -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 8.5e+76) {
tmp = (y * 4.0) * t;
} else {
tmp = (z_m * z_m) * (y * -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 ((z_m * z_m) <= 8.5d+76) then
tmp = (y * 4.0d0) * t
else
tmp = (z_m * z_m) * (y * (-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 ((z_m * z_m) <= 8.5e+76) {
tmp = (y * 4.0) * t;
} else {
tmp = (z_m * z_m) * (y * -4.0);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 8.5e+76: tmp = (y * 4.0) * t else: tmp = (z_m * z_m) * (y * -4.0) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 8.5e+76) tmp = Float64(Float64(y * 4.0) * t); else tmp = Float64(Float64(z_m * z_m) * Float64(y * -4.0)); 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) <= 8.5e+76) tmp = (y * 4.0) * t; else tmp = (z_m * z_m) * (y * -4.0); 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], 8.5e+76], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(N[(z$95$m * z$95$m), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 8.5 \cdot 10^{+76}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;\left(z\_m \cdot z\_m\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 8.49999999999999992e76Initial program 97.9%
Taylor expanded in t around inf 51.1%
*-commutative51.1%
*-commutative51.1%
Simplified51.1%
Taylor expanded in y around 0 51.1%
*-commutative51.1%
*-commutative51.1%
*-commutative51.1%
associate-*r*51.1%
Simplified51.1%
if 8.49999999999999992e76 < (*.f64 z z) Initial program 83.3%
Taylor expanded in z around inf 71.1%
associate-*r*71.1%
*-commutative71.1%
Simplified71.1%
unpow271.1%
Applied egg-rr71.1%
Final simplification59.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 4e+61) (* (* y 4.0) t) (* z_m (* z_m (* y -4.0)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 4e+61) {
tmp = (y * 4.0) * t;
} else {
tmp = z_m * (z_m * (y * -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 ((z_m * z_m) <= 4d+61) then
tmp = (y * 4.0d0) * t
else
tmp = z_m * (z_m * (y * (-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 ((z_m * z_m) <= 4e+61) {
tmp = (y * 4.0) * t;
} else {
tmp = z_m * (z_m * (y * -4.0));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 4e+61: tmp = (y * 4.0) * t else: tmp = z_m * (z_m * (y * -4.0)) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 4e+61) tmp = Float64(Float64(y * 4.0) * t); else tmp = Float64(z_m * Float64(z_m * Float64(y * -4.0))); 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) <= 4e+61) tmp = (y * 4.0) * t; else tmp = z_m * (z_m * (y * -4.0)); 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], 4e+61], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(z$95$m * N[(z$95$m * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{+61}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;z\_m \cdot \left(z\_m \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 3.9999999999999998e61Initial program 97.9%
Taylor expanded in t around inf 51.1%
*-commutative51.1%
*-commutative51.1%
Simplified51.1%
Taylor expanded in y around 0 51.1%
*-commutative51.1%
*-commutative51.1%
*-commutative51.1%
associate-*r*51.1%
Simplified51.1%
if 3.9999999999999998e61 < (*.f64 z z) Initial program 83.3%
Taylor expanded in z around inf 71.1%
associate-*r*71.1%
*-commutative71.1%
Simplified71.1%
unpow271.1%
Applied egg-rr71.1%
add-sqr-sqrt32.6%
pow232.6%
sqrt-prod32.6%
sqrt-prod14.7%
add-sqr-sqrt35.1%
*-commutative35.1%
Applied egg-rr35.1%
*-commutative35.1%
unpow-prod-down32.6%
pow232.6%
add-sqr-sqrt71.1%
*-commutative71.1%
pow271.1%
associate-*r*76.0%
Applied egg-rr76.0%
Final simplification61.8%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 3.6e+151) (* (* y 4.0) t) (* -4.0 (* y t))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 3.6e+151) {
tmp = (y * 4.0) * t;
} else {
tmp = -4.0 * (y * 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 <= 3.6d+151) then
tmp = (y * 4.0d0) * t
else
tmp = (-4.0d0) * (y * 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 <= 3.6e+151) {
tmp = (y * 4.0) * t;
} else {
tmp = -4.0 * (y * t);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if z_m <= 3.6e+151: tmp = (y * 4.0) * t else: tmp = -4.0 * (y * t) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 3.6e+151) tmp = Float64(Float64(y * 4.0) * t); else tmp = Float64(-4.0 * Float64(y * t)); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (z_m <= 3.6e+151) tmp = (y * 4.0) * t; else tmp = -4.0 * (y * t); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 3.6e+151], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 3.6 \cdot 10^{+151}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if z < 3.6e151Initial program 94.2%
Taylor expanded in t around inf 38.5%
*-commutative38.5%
*-commutative38.5%
Simplified38.5%
Taylor expanded in y around 0 38.5%
*-commutative38.5%
*-commutative38.5%
*-commutative38.5%
associate-*r*38.9%
Simplified38.9%
if 3.6e151 < z Initial program 74.6%
Taylor expanded in z around 0 16.3%
*-commutative16.3%
Simplified16.3%
associate-*r*16.3%
add-sqr-sqrt12.6%
sqrt-unprod36.0%
*-commutative36.0%
*-commutative36.0%
swap-sqr36.0%
metadata-eval36.0%
metadata-eval36.0%
swap-sqr36.0%
sqrt-unprod15.2%
add-sqr-sqrt30.4%
*-commutative30.4%
associate-*r*30.4%
metadata-eval30.4%
distribute-lft-neg-in30.4%
associate-*r*30.4%
*-commutative30.4%
associate-*l*30.4%
Applied egg-rr30.4%
Taylor expanded in x around 0 16.2%
Final simplification35.9%
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 91.6%
Taylor expanded in z around 0 66.8%
*-commutative66.8%
Simplified66.8%
associate-*r*67.1%
add-sqr-sqrt34.9%
sqrt-unprod47.7%
*-commutative47.7%
*-commutative47.7%
swap-sqr47.7%
metadata-eval47.7%
metadata-eval47.7%
swap-sqr47.7%
sqrt-unprod20.3%
add-sqr-sqrt40.0%
*-commutative40.0%
associate-*r*40.0%
metadata-eval40.0%
distribute-lft-neg-in40.0%
associate-*r*40.0%
*-commutative40.0%
associate-*l*40.0%
Applied egg-rr40.0%
Taylor expanded in x around 0 7.6%
Final simplification7.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 2024044
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))