
(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}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* y -4.0))))
(if (<= (* y 4.0) -2e-297)
(- (* x x) (fma t (* y -4.0) (* z (* (- t_1) (* z t_1)))))
(if (<= (* y 4.0) 5e-154)
(- (* x x) (+ (* -4.0 (* y t)) (* 4.0 (pow (* z (sqrt y)) 2.0))))
(fma x x (* 4.0 (* y (fma z (- z) t))))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((y * -4.0));
double tmp;
if ((y * 4.0) <= -2e-297) {
tmp = (x * x) - fma(t, (y * -4.0), (z * (-t_1 * (z * t_1))));
} else if ((y * 4.0) <= 5e-154) {
tmp = (x * x) - ((-4.0 * (y * t)) + (4.0 * pow((z * sqrt(y)), 2.0)));
} else {
tmp = fma(x, x, (4.0 * (y * fma(z, -z, t))));
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(y * -4.0)) tmp = 0.0 if (Float64(y * 4.0) <= -2e-297) tmp = Float64(Float64(x * x) - fma(t, Float64(y * -4.0), Float64(z * Float64(Float64(-t_1) * Float64(z * t_1))))); elseif (Float64(y * 4.0) <= 5e-154) tmp = Float64(Float64(x * x) - Float64(Float64(-4.0 * Float64(y * t)) + Float64(4.0 * (Float64(z * sqrt(y)) ^ 2.0)))); else tmp = fma(x, x, Float64(4.0 * Float64(y * fma(z, Float64(-z), t)))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(y * -4.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(y * 4.0), $MachinePrecision], -2e-297], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision] + N[(z * N[((-t$95$1) * N[(z * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * 4.0), $MachinePrecision], 5e-154], N[(N[(x * x), $MachinePrecision] - N[(N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[Power[N[(z * N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(4.0 * N[(y * N[(z * (-z) + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{y \cdot -4}\\
\mathbf{if}\;y \cdot 4 \leq -2 \cdot 10^{-297}:\\
\;\;\;\;x \cdot x - \mathsf{fma}\left(t, y \cdot -4, z \cdot \left(\left(-t_1\right) \cdot \left(z \cdot t_1\right)\right)\right)\\
\mathbf{elif}\;y \cdot 4 \leq 5 \cdot 10^{-154}:\\
\;\;\;\;x \cdot x - \left(-4 \cdot \left(y \cdot t\right) + 4 \cdot {\left(z \cdot \sqrt{y}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, 4 \cdot \left(y \cdot \mathsf{fma}\left(z, -z, t\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y 4) < -2.00000000000000008e-297Initial program 92.3%
Taylor expanded in z around 0 87.9%
add-sqr-sqrt30.1%
sqrt-unprod60.2%
swap-sqr60.2%
metadata-eval60.2%
metadata-eval60.2%
swap-sqr60.2%
associate-*l*60.2%
associate-*l*60.2%
sqrt-unprod61.1%
add-sqr-sqrt61.1%
associate-*l*61.1%
metadata-eval61.1%
cancel-sign-sub-inv61.1%
add-sqr-sqrt29.1%
add-sqr-sqrt12.3%
difference-of-squares12.3%
Applied egg-rr49.3%
+-commutative49.3%
*-commutative49.3%
*-commutative49.3%
associate-*r*49.3%
*-commutative49.3%
associate-*r*49.3%
*-commutative49.3%
Simplified49.3%
+-commutative49.3%
difference-of-squares49.3%
cancel-sign-sub-inv49.3%
add-sqr-sqrt93.6%
*-commutative93.6%
associate-*l*93.6%
*-commutative93.6%
distribute-rgt-neg-in93.6%
*-commutative93.6%
Applied egg-rr93.6%
fma-def98.1%
*-commutative98.1%
associate-*l*98.1%
*-commutative98.1%
*-commutative98.1%
Simplified98.1%
if -2.00000000000000008e-297 < (*.f64 y 4) < 5.0000000000000002e-154Initial program 79.8%
Taylor expanded in z around 0 79.8%
add-sqr-sqrt79.8%
pow279.8%
*-commutative79.8%
sqrt-prod79.8%
unpow279.8%
sqrt-prod39.3%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
if 5.0000000000000002e-154 < (*.f64 y 4) Initial program 86.7%
fma-neg95.2%
distribute-rgt-neg-in95.2%
*-commutative95.2%
associate-*l*96.1%
sub-neg96.1%
distribute-neg-in96.1%
distribute-rgt-neg-out96.1%
remove-double-neg96.1%
fma-def96.1%
Simplified96.1%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+293) (fma y (* -4.0 (- (pow z 2.0) t)) (pow x 2.0)) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+293) {
tmp = fma(y, (-4.0 * (pow(z, 2.0) - t)), pow(x, 2.0));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+293) tmp = fma(y, Float64(-4.0 * Float64((z ^ 2.0) - t)), (x ^ 2.0)); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+293], N[(y * N[(-4.0 * N[(N[Power[z, 2.0], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\mathsf{fma}\left(y, -4 \cdot \left({z}^{2} - t\right), {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999998e293Initial program 95.1%
Taylor expanded in z around 0 95.1%
Taylor expanded in x around 0 95.1%
mul-1-neg95.1%
associate-*r*95.1%
*-commutative95.1%
distribute-neg-in95.1%
distribute-lft-neg-in95.1%
metadata-eval95.1%
associate-*r*94.5%
*-commutative94.5%
associate-*r*95.1%
+-commutative95.1%
sub-neg95.1%
distribute-lft-out--95.6%
cancel-sign-sub-inv95.6%
metadata-eval95.6%
fma-def97.8%
Simplified97.8%
if 1.9999999999999998e293 < (*.f64 z z) Initial program 69.7%
Taylor expanded in z around inf 76.8%
associate-*r*76.8%
Simplified76.8%
add-sqr-sqrt30.7%
pow230.7%
*-commutative30.7%
sqrt-prod30.7%
unpow230.7%
sqrt-prod22.9%
add-sqr-sqrt37.2%
*-commutative37.2%
Applied egg-rr37.2%
unpow-prod-down30.7%
unpow230.7%
associate-*l*37.3%
unpow237.3%
add-sqr-sqrt90.1%
Applied egg-rr90.1%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+293) (fma x x (* 4.0 (* y (fma z (- z) t)))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+293) {
tmp = fma(x, x, (4.0 * (y * fma(z, -z, t))));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+293) tmp = fma(x, x, Float64(4.0 * Float64(y * fma(z, Float64(-z), t)))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+293], N[(x * x + N[(4.0 * N[(y * N[(z * (-z) + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\mathsf{fma}\left(x, x, 4 \cdot \left(y \cdot \mathsf{fma}\left(z, -z, t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999998e293Initial program 95.1%
fma-neg97.3%
distribute-rgt-neg-in97.3%
*-commutative97.3%
associate-*l*97.8%
sub-neg97.8%
distribute-neg-in97.8%
distribute-rgt-neg-out97.8%
remove-double-neg97.8%
fma-def97.8%
Simplified97.8%
if 1.9999999999999998e293 < (*.f64 z z) Initial program 69.7%
Taylor expanded in z around inf 76.8%
associate-*r*76.8%
Simplified76.8%
add-sqr-sqrt30.7%
pow230.7%
*-commutative30.7%
sqrt-prod30.7%
unpow230.7%
sqrt-prod22.9%
add-sqr-sqrt37.2%
*-commutative37.2%
Applied egg-rr37.2%
unpow-prod-down30.7%
unpow230.7%
associate-*l*37.3%
unpow237.3%
add-sqr-sqrt90.1%
Applied egg-rr90.1%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+293) (fma x x (* (* y -4.0) (- (* z z) t))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+293) {
tmp = fma(x, x, ((y * -4.0) * ((z * z) - t)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+293) tmp = fma(x, x, Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+293], N[(x * x + N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+293}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999998e293Initial program 95.1%
fma-neg97.3%
*-commutative97.3%
distribute-rgt-neg-in97.3%
distribute-lft-neg-out97.3%
distribute-lft-neg-out97.3%
distribute-rgt-neg-in97.3%
metadata-eval97.3%
Simplified97.3%
if 1.9999999999999998e293 < (*.f64 z z) Initial program 69.7%
Taylor expanded in z around inf 76.8%
associate-*r*76.8%
Simplified76.8%
add-sqr-sqrt30.7%
pow230.7%
*-commutative30.7%
sqrt-prod30.7%
unpow230.7%
sqrt-prod22.9%
add-sqr-sqrt37.2%
*-commutative37.2%
Applied egg-rr37.2%
unpow-prod-down30.7%
unpow230.7%
associate-*l*37.3%
unpow237.3%
add-sqr-sqrt90.1%
Applied egg-rr90.1%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+293) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+293) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
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
real(8) :: tmp
if ((z * z) <= 2d+293) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+293) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+293: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+293) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 2e+293) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+293], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+293}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999998e293Initial program 95.1%
if 1.9999999999999998e293 < (*.f64 z z) Initial program 69.7%
Taylor expanded in z around inf 76.8%
associate-*r*76.8%
Simplified76.8%
add-sqr-sqrt30.7%
pow230.7%
*-commutative30.7%
sqrt-prod30.7%
unpow230.7%
sqrt-prod22.9%
add-sqr-sqrt37.2%
*-commutative37.2%
Applied egg-rr37.2%
unpow-prod-down30.7%
unpow230.7%
associate-*l*37.3%
unpow237.3%
add-sqr-sqrt90.1%
Applied egg-rr90.1%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (<= z 7.2e+90) (- (* x x) (* y (* t -4.0))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.2e+90) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
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
real(8) :: tmp
if (z <= 7.2d+90) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.2e+90) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 7.2e+90: tmp = (x * x) - (y * (t * -4.0)) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 7.2e+90) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 7.2e+90) tmp = (x * x) - (y * (t * -4.0)); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 7.2e+90], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.2 \cdot 10^{+90}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 7.2e90Initial program 91.3%
Taylor expanded in z around 0 76.8%
*-commutative76.8%
*-commutative76.8%
associate-*l*76.8%
Simplified76.8%
if 7.2e90 < z Initial program 75.4%
Taylor expanded in z around inf 75.9%
associate-*r*75.9%
Simplified75.9%
add-sqr-sqrt28.0%
pow228.0%
*-commutative28.0%
sqrt-prod28.0%
unpow228.0%
sqrt-prod33.4%
add-sqr-sqrt33.4%
*-commutative33.4%
Applied egg-rr33.4%
unpow-prod-down28.0%
unpow228.0%
associate-*l*33.5%
unpow233.5%
add-sqr-sqrt86.9%
Applied egg-rr86.9%
Final simplification78.8%
(FPCore (x y z t) :precision binary64 (if (<= z 5e+40) (* y (* 4.0 t)) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5e+40) {
tmp = y * (4.0 * t);
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
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
real(8) :: tmp
if (z <= 5d+40) then
tmp = y * (4.0d0 * t)
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5e+40) {
tmp = y * (4.0 * t);
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 5e+40: tmp = y * (4.0 * t) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 5e+40) tmp = Float64(y * Float64(4.0 * t)); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 5e+40) tmp = y * (4.0 * t); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 5e+40], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{+40}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 5.00000000000000003e40Initial program 91.5%
Taylor expanded in z around 0 92.0%
Taylor expanded in t around inf 32.2%
associate-*r*32.2%
*-commutative32.2%
*-commutative32.2%
Simplified32.2%
if 5.00000000000000003e40 < z Initial program 77.0%
Taylor expanded in z around inf 69.1%
associate-*r*69.1%
Simplified69.1%
add-sqr-sqrt27.7%
pow227.7%
*-commutative27.7%
sqrt-prod27.7%
unpow227.7%
sqrt-prod32.4%
add-sqr-sqrt32.4%
*-commutative32.4%
Applied egg-rr32.4%
unpow-prod-down27.7%
unpow227.7%
associate-*l*32.5%
unpow232.5%
add-sqr-sqrt78.6%
Applied egg-rr78.6%
Final simplification42.9%
(FPCore (x y z t) :precision binary64 (* 4.0 (* y t)))
double code(double x, double y, double z, double t) {
return 4.0 * (y * 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 = 4.0d0 * (y * t)
end function
public static double code(double x, double y, double z, double t) {
return 4.0 * (y * t);
}
def code(x, y, z, t): return 4.0 * (y * t)
function code(x, y, z, t) return Float64(4.0 * Float64(y * t)) end
function tmp = code(x, y, z, t) tmp = 4.0 * (y * t); end
code[x_, y_, z_, t_] := N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(y \cdot t\right)
\end{array}
Initial program 88.2%
Taylor expanded in t around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification26.7%
(FPCore (x y z t) :precision binary64 (* y (* 4.0 t)))
double code(double x, double y, double z, double t) {
return y * (4.0 * 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 = y * (4.0d0 * t)
end function
public static double code(double x, double y, double z, double t) {
return y * (4.0 * t);
}
def code(x, y, z, t): return y * (4.0 * t)
function code(x, y, z, t) return Float64(y * Float64(4.0 * t)) end
function tmp = code(x, y, z, t) tmp = y * (4.0 * t); end
code[x_, y_, z_, t_] := N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(4 \cdot t\right)
\end{array}
Initial program 88.2%
Taylor expanded in z around 0 85.0%
Taylor expanded in t around inf 26.7%
associate-*r*26.7%
*-commutative26.7%
*-commutative26.7%
Simplified26.7%
Final simplification26.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 2023305
(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))))