
(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}
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4e+265) (fma (* y 4.0) (- t (* z z)) (* x x)) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e+265) {
tmp = fma((y * 4.0), (t - (z * z)), (x * x));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e+265) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+265], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+265}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000027e265Initial program 99.4%
cancel-sign-sub-inv99.4%
distribute-lft-neg-out99.4%
+-commutative99.4%
distribute-lft-neg-out99.4%
distribute-lft-neg-in99.4%
distribute-rgt-neg-in99.4%
fma-define99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
if 4.00000000000000027e265 < (*.f64 z z) Initial program 71.0%
Taylor expanded in z around inf 71.0%
mul-1-neg71.0%
unsub-neg71.0%
Simplified71.0%
add-sqr-sqrt33.6%
pow233.6%
sqrt-prod33.6%
*-commutative33.6%
sqrt-prod33.6%
metadata-eval33.6%
sqrt-prod33.6%
sqrt-pow146.5%
metadata-eval46.5%
pow146.5%
div-inv46.5%
pow-flip46.5%
metadata-eval46.5%
Applied egg-rr46.5%
Taylor expanded in z around inf 46.5%
unpow246.5%
swap-sqr33.6%
swap-sqr33.6%
metadata-eval33.6%
add-sqr-sqrt71.0%
*-commutative71.0%
associate-*r*90.3%
Applied egg-rr90.3%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4e+265) (fma x x (* (- (* z z) t) (* y -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e+265) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e+265) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+265], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+265}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000027e265Initial program 99.4%
fmm-def99.4%
distribute-lft-neg-in99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
Simplified99.4%
if 4.00000000000000027e265 < (*.f64 z z) Initial program 71.0%
Taylor expanded in z around inf 71.0%
mul-1-neg71.0%
unsub-neg71.0%
Simplified71.0%
add-sqr-sqrt33.6%
pow233.6%
sqrt-prod33.6%
*-commutative33.6%
sqrt-prod33.6%
metadata-eval33.6%
sqrt-prod33.6%
sqrt-pow146.5%
metadata-eval46.5%
pow146.5%
div-inv46.5%
pow-flip46.5%
metadata-eval46.5%
Applied egg-rr46.5%
Taylor expanded in z around inf 46.5%
unpow246.5%
swap-sqr33.6%
swap-sqr33.6%
metadata-eval33.6%
add-sqr-sqrt71.0%
*-commutative71.0%
associate-*r*90.3%
Applied egg-rr90.3%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4e+265) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e+265) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (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) <= 4d+265) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) - (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) <= 4e+265) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 4e+265: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e+265) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) - 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) <= 4e+265) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) - (z * (z * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+265], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+265}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000027e265Initial program 99.4%
if 4.00000000000000027e265 < (*.f64 z z) Initial program 71.0%
Taylor expanded in z around inf 71.0%
mul-1-neg71.0%
unsub-neg71.0%
Simplified71.0%
add-sqr-sqrt33.6%
pow233.6%
sqrt-prod33.6%
*-commutative33.6%
sqrt-prod33.6%
metadata-eval33.6%
sqrt-prod33.6%
sqrt-pow146.5%
metadata-eval46.5%
pow146.5%
div-inv46.5%
pow-flip46.5%
metadata-eval46.5%
Applied egg-rr46.5%
Taylor expanded in z around inf 46.5%
unpow246.5%
swap-sqr33.6%
swap-sqr33.6%
metadata-eval33.6%
add-sqr-sqrt71.0%
*-commutative71.0%
associate-*r*90.3%
Applied egg-rr90.3%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-14) (- (* x x) (* y (* t -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-14) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (x * x) - (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) <= 5d-14) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (x * x) - (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) <= 5e-14) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-14: tmp = (x * x) - (y * (t * -4.0)) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-14) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(x * x) - 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) <= 5e-14) tmp = (x * x) - (y * (t * -4.0)); else tmp = (x * x) - (z * (z * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-14], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-14}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.0000000000000002e-14Initial program 99.2%
Taylor expanded in z around 0 97.6%
*-commutative97.6%
*-commutative97.6%
associate-*l*96.8%
Simplified96.8%
if 5.0000000000000002e-14 < (*.f64 z z) Initial program 83.8%
Taylor expanded in z around inf 83.8%
mul-1-neg83.8%
unsub-neg83.8%
Simplified83.8%
add-sqr-sqrt39.3%
pow239.2%
sqrt-prod37.7%
*-commutative37.7%
sqrt-prod37.7%
metadata-eval37.7%
sqrt-prod37.7%
sqrt-pow144.9%
metadata-eval44.9%
pow144.9%
div-inv44.9%
pow-flip44.9%
metadata-eval44.9%
Applied egg-rr44.9%
Taylor expanded in z around inf 43.9%
unpow243.9%
swap-sqr36.8%
swap-sqr36.8%
metadata-eval36.8%
add-sqr-sqrt77.5%
*-commutative77.5%
associate-*r*88.3%
Applied egg-rr88.3%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (<= z 1.38e-36) (* 4.0 (* y t)) (if (<= z 9.2e+91) (* x x) (* (* z z) (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.38e-36) {
tmp = 4.0 * (y * t);
} else if (z <= 9.2e+91) {
tmp = x * x;
} 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 <= 1.38d-36) then
tmp = 4.0d0 * (y * t)
else if (z <= 9.2d+91) then
tmp = x * x
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 <= 1.38e-36) {
tmp = 4.0 * (y * t);
} else if (z <= 9.2e+91) {
tmp = x * x;
} else {
tmp = (z * z) * (y * -4.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.38e-36: tmp = 4.0 * (y * t) elif z <= 9.2e+91: tmp = x * x else: tmp = (z * z) * (y * -4.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.38e-36) tmp = Float64(4.0 * Float64(y * t)); elseif (z <= 9.2e+91) tmp = Float64(x * x); else tmp = Float64(Float64(z * z) * Float64(y * -4.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.38e-36) tmp = 4.0 * (y * t); elseif (z <= 9.2e+91) tmp = x * x; else tmp = (z * z) * (y * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.38e-36], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e+91], N[(x * x), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.38 \cdot 10^{-36}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+91}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if z < 1.38e-36Initial program 93.7%
fmm-def96.4%
distribute-lft-neg-in96.4%
*-commutative96.4%
distribute-rgt-neg-in96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in t around inf 42.5%
*-commutative42.5%
Simplified42.5%
if 1.38e-36 < z < 9.19999999999999965e91Initial program 99.8%
Taylor expanded in y around 0 99.8%
Simplified50.7%
--rgt-identity50.7%
Applied egg-rr50.7%
if 9.19999999999999965e91 < z Initial program 75.2%
Taylor expanded in z around inf 75.2%
mul-1-neg75.2%
unsub-neg75.2%
Simplified75.2%
Taylor expanded in z around inf 70.8%
metadata-eval70.8%
distribute-lft-neg-in70.8%
associate-*r*70.8%
*-commutative70.8%
*-commutative70.8%
distribute-rgt-neg-in70.8%
distribute-rgt-neg-in70.8%
metadata-eval70.8%
Simplified70.8%
pow270.8%
Applied egg-rr70.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 3.4e+225) (- (* 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 * z) <= 3.4e+225) {
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 * z) <= 3.4d+225) 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 * z) <= 3.4e+225) {
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 * z) <= 3.4e+225: 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 (Float64(z * z) <= 3.4e+225) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(z * z) * Float64(y * -4.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 3.4e+225) 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[N[(z * z), $MachinePrecision], 3.4e+225], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 3.4 \cdot 10^{+225}:\\
\;\;\;\;x \cdot x - 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) < 3.40000000000000018e225Initial program 99.4%
Taylor expanded in z around 0 87.0%
*-commutative87.0%
*-commutative87.0%
associate-*l*86.5%
Simplified86.5%
if 3.40000000000000018e225 < (*.f64 z z) Initial program 73.9%
Taylor expanded in z around inf 73.9%
mul-1-neg73.9%
unsub-neg73.9%
Simplified73.9%
Taylor expanded in z around inf 79.0%
metadata-eval79.0%
distribute-lft-neg-in79.0%
associate-*r*79.0%
*-commutative79.0%
*-commutative79.0%
distribute-rgt-neg-in79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
Simplified79.0%
pow279.0%
Applied egg-rr79.0%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 8e+23) (* 4.0 (* y t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e+23) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
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 ((x * x) <= 8d+23) then
tmp = 4.0d0 * (y * t)
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e+23) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 8e+23: tmp = 4.0 * (y * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 8e+23) tmp = Float64(4.0 * Float64(y * t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 8e+23) tmp = 4.0 * (y * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8e+23], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8 \cdot 10^{+23}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 7.9999999999999993e23Initial program 93.2%
fmm-def93.2%
distribute-lft-neg-in93.2%
*-commutative93.2%
distribute-rgt-neg-in93.2%
metadata-eval93.2%
Simplified93.2%
Taylor expanded in t around inf 51.8%
*-commutative51.8%
Simplified51.8%
if 7.9999999999999993e23 < (*.f64 x x) Initial program 89.1%
Taylor expanded in y around 0 89.1%
Simplified68.8%
--rgt-identity68.8%
Applied egg-rr68.8%
(FPCore (x y z t) :precision binary64 (* x x))
double code(double x, double y, double z, double t) {
return x * x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x * x;
}
def code(x, y, z, t): return x * x
function code(x, y, z, t) return Float64(x * x) end
function tmp = code(x, y, z, t) tmp = x * x; end
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x
\end{array}
Initial program 91.3%
Taylor expanded in y around 0 91.3%
Simplified38.1%
--rgt-identity38.1%
Applied egg-rr38.1%
(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 2024170
(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))))