
(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 (cbrt (fma x x (* t (* (fma y (* z (/ z t)) (- y)) -4.0))))))
(if (<= (* z z) 1e+308)
(fma (* y 4.0) (- t (* z z)) (* x x))
(* t_1 (pow t_1 2.0)))))
double code(double x, double y, double z, double t) {
double t_1 = cbrt(fma(x, x, (t * (fma(y, (z * (z / t)), -y) * -4.0))));
double tmp;
if ((z * z) <= 1e+308) {
tmp = fma((y * 4.0), (t - (z * z)), (x * x));
} else {
tmp = t_1 * pow(t_1, 2.0);
}
return tmp;
}
function code(x, y, z, t) t_1 = cbrt(fma(x, x, Float64(t * Float64(fma(y, Float64(z * Float64(z / t)), Float64(-y)) * -4.0)))) tmp = 0.0 if (Float64(z * z) <= 1e+308) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(t_1 * (t_1 ^ 2.0)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Power[N[(x * x + N[(t * N[(N[(y * N[(z * N[(z / t), $MachinePrecision]), $MachinePrecision] + (-y)), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 1e+308], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt[3]{\mathsf{fma}\left(x, x, t \cdot \left(\mathsf{fma}\left(y, z \cdot \frac{z}{t}, -y\right) \cdot -4\right)\right)}\\
\mathbf{if}\;z \cdot z \leq 10^{+308}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot {t\_1}^{2}\\
\end{array}
\end{array}
if (*.f64 z z) < 1e308Initial program 97.9%
cancel-sign-sub-inv97.9%
distribute-lft-neg-out97.9%
+-commutative97.9%
distribute-lft-neg-out97.9%
distribute-lft-neg-in97.9%
distribute-rgt-neg-in97.9%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
if 1e308 < (*.f64 z z) Initial program 67.7%
Taylor expanded in t around inf 67.7%
+-commutative67.7%
*-commutative67.7%
*-commutative67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
distribute-lft-neg-in67.7%
distribute-rgt-out67.7%
unsub-neg67.7%
associate-/l*67.7%
Simplified67.7%
unpow267.7%
*-un-lft-identity67.7%
times-frac75.0%
Applied egg-rr75.0%
/-rgt-identity75.0%
associate-*r*80.9%
clear-num80.9%
un-div-inv80.9%
Applied egg-rr80.9%
add-cube-cbrt80.8%
Applied egg-rr81.2%
Final simplification94.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+308) (fma (* y 4.0) (- t (* z z)) (* x x)) (+ (* x x) (* t (* 4.0 (- y (/ (* z y) (/ t z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+308) {
tmp = fma((y * 4.0), (t - (z * z)), (x * x));
} else {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+308) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(Float64(x * x) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / z)))))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+308], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+308}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1e308Initial program 97.9%
cancel-sign-sub-inv97.9%
distribute-lft-neg-out97.9%
+-commutative97.9%
distribute-lft-neg-out97.9%
distribute-lft-neg-in97.9%
distribute-rgt-neg-in97.9%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
if 1e308 < (*.f64 z z) Initial program 67.7%
Taylor expanded in t around inf 67.7%
+-commutative67.7%
*-commutative67.7%
*-commutative67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
distribute-lft-neg-in67.7%
distribute-rgt-out67.7%
unsub-neg67.7%
associate-/l*67.7%
Simplified67.7%
unpow267.7%
*-un-lft-identity67.7%
times-frac75.0%
Applied egg-rr75.0%
/-rgt-identity75.0%
associate-*r*80.9%
clear-num80.9%
un-div-inv80.9%
Applied egg-rr80.9%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (if (<= z 1.35e+154) (fma x x (* (- (* z z) t) (* y -4.0))) (+ (* x x) (* t (* 4.0 (- y (/ (* z y) (/ t z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.35e+154) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 1.35e+154) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / z)))))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.35e+154], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\end{array}
\end{array}
if z < 1.35000000000000003e154Initial program 95.0%
fmm-def96.4%
distribute-lft-neg-in96.4%
*-commutative96.4%
distribute-rgt-neg-in96.4%
metadata-eval96.4%
Simplified96.4%
if 1.35000000000000003e154 < z Initial program 64.4%
Taylor expanded in t around inf 64.4%
+-commutative64.4%
*-commutative64.4%
*-commutative64.4%
metadata-eval64.4%
distribute-rgt-neg-in64.4%
distribute-lft-neg-in64.4%
distribute-rgt-out64.4%
unsub-neg64.4%
associate-/l*64.4%
Simplified64.4%
unpow264.4%
*-un-lft-identity64.4%
times-frac71.5%
Applied egg-rr71.5%
/-rgt-identity71.5%
associate-*r*78.6%
clear-num78.6%
un-div-inv78.6%
Applied egg-rr78.6%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+308) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (+ (* x x) (* t (* 4.0 (- y (/ (* z y) (/ t z))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+308) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
}
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) <= 1d+308) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) + (t * (4.0d0 * (y - ((z * y) / (t / z)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+308) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e+308: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+308) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / z)))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 1e+308) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+308], 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[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+308}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1e308Initial program 97.9%
if 1e308 < (*.f64 z z) Initial program 67.7%
Taylor expanded in t around inf 67.7%
+-commutative67.7%
*-commutative67.7%
*-commutative67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
distribute-lft-neg-in67.7%
distribute-rgt-out67.7%
unsub-neg67.7%
associate-/l*67.7%
Simplified67.7%
unpow267.7%
*-un-lft-identity67.7%
times-frac75.0%
Applied egg-rr75.0%
/-rgt-identity75.0%
associate-*r*80.9%
clear-num80.9%
un-div-inv80.9%
Applied egg-rr80.9%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.45e+297) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.45e+297) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} 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) <= 2.45d+297) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
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) <= 2.45e+297) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 2.45e+297: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 2.45e+297) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 2.45e+297) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2.45e+297], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.45 \cdot 10^{+297}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.45000000000000014e297Initial program 93.3%
if 2.45000000000000014e297 < (*.f64 x x) Initial program 80.3%
Taylor expanded in y around 0 80.3%
Simplified91.8%
--rgt-identity91.8%
Applied egg-rr91.8%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (if (<= x 2.7e-171) (* 4.0 (* y t)) (if (<= x 155000.0) (* -4.0 (* (* z z) y)) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.7e-171) {
tmp = 4.0 * (y * t);
} else if (x <= 155000.0) {
tmp = -4.0 * ((z * z) * y);
} 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 <= 2.7d-171) then
tmp = 4.0d0 * (y * t)
else if (x <= 155000.0d0) then
tmp = (-4.0d0) * ((z * z) * y)
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 <= 2.7e-171) {
tmp = 4.0 * (y * t);
} else if (x <= 155000.0) {
tmp = -4.0 * ((z * z) * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 2.7e-171: tmp = 4.0 * (y * t) elif x <= 155000.0: tmp = -4.0 * ((z * z) * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 2.7e-171) tmp = Float64(4.0 * Float64(y * t)); elseif (x <= 155000.0) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 2.7e-171) tmp = 4.0 * (y * t); elseif (x <= 155000.0) tmp = -4.0 * ((z * z) * y); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 2.7e-171], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 155000.0], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7 \cdot 10^{-171}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;x \leq 155000:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 2.70000000000000014e-171Initial program 90.1%
fmm-def91.6%
distribute-lft-neg-in91.6%
*-commutative91.6%
distribute-rgt-neg-in91.6%
metadata-eval91.6%
Simplified91.6%
Taylor expanded in t around inf 41.1%
*-commutative41.1%
Simplified41.1%
if 2.70000000000000014e-171 < x < 155000Initial program 94.8%
Taylor expanded in t around inf 86.7%
+-commutative86.7%
*-commutative86.7%
*-commutative86.7%
metadata-eval86.7%
distribute-rgt-neg-in86.7%
distribute-lft-neg-in86.7%
distribute-rgt-out86.7%
unsub-neg86.7%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in z around inf 56.5%
*-commutative56.5%
Simplified56.5%
unpow256.5%
Applied egg-rr56.5%
if 155000 < x Initial program 88.4%
Taylor expanded in y around 0 88.4%
Simplified72.5%
--rgt-identity72.5%
Applied egg-rr72.5%
Final simplification53.6%
(FPCore (x y z t) :precision binary64 (if (<= z 1.2e+116) (- (* x x) (* y (* t -4.0))) (* -4.0 (* (* z z) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e+116) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = -4.0 * ((z * z) * y);
}
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.2d+116) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (-4.0d0) * ((z * z) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e+116) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = -4.0 * ((z * z) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.2e+116: tmp = (x * x) - (y * (t * -4.0)) else: tmp = -4.0 * ((z * z) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.2e+116) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.2e+116) tmp = (x * x) - (y * (t * -4.0)); else tmp = -4.0 * ((z * z) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.2e+116], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{+116}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\end{array}
\end{array}
if z < 1.2e116Initial program 94.8%
Taylor expanded in z around 0 77.7%
*-commutative77.7%
*-commutative77.7%
associate-*l*77.7%
Simplified77.7%
if 1.2e116 < z Initial program 70.3%
Taylor expanded in t around inf 68.2%
+-commutative68.2%
*-commutative68.2%
*-commutative68.2%
metadata-eval68.2%
distribute-rgt-neg-in68.2%
distribute-lft-neg-in68.2%
distribute-rgt-out68.2%
unsub-neg68.2%
associate-/l*68.2%
Simplified68.2%
Taylor expanded in z around inf 70.4%
*-commutative70.4%
Simplified70.4%
unpow270.4%
Applied egg-rr70.4%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (<= x 0.062) (* 4.0 (* y t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 0.062) {
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 <= 0.062d0) 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 <= 0.062) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 0.062: tmp = 4.0 * (y * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 0.062) 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 <= 0.062) tmp = 4.0 * (y * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 0.062], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.062:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 0.062Initial program 91.0%
fmm-def92.2%
distribute-lft-neg-in92.2%
*-commutative92.2%
distribute-rgt-neg-in92.2%
metadata-eval92.2%
Simplified92.2%
Taylor expanded in t around inf 39.6%
*-commutative39.6%
Simplified39.6%
if 0.062 < x Initial program 88.7%
Taylor expanded in y around 0 88.7%
Simplified71.0%
--rgt-identity71.0%
Applied egg-rr71.0%
(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 90.2%
Taylor expanded in y around 0 90.2%
Simplified42.1%
--rgt-identity42.1%
Applied egg-rr42.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 2024181
(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))))