
(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 11 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 (* y -4.0))))
(if (<= (* z z) 5e+246)
(fma (pow t_1 2.0) (* t_1 (- (* z z) t)) (* x x))
(- (* x x) (* z (* z (* y 4.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = cbrt((y * -4.0));
double tmp;
if ((z * z) <= 5e+246) {
tmp = fma(pow(t_1, 2.0), (t_1 * ((z * z) - t)), (x * x));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) t_1 = cbrt(Float64(y * -4.0)) tmp = 0.0 if (Float64(z * z) <= 5e+246) tmp = fma((t_1 ^ 2.0), Float64(t_1 * Float64(Float64(z * z) - t)), 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_] := Block[{t$95$1 = N[Power[N[(y * -4.0), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 5e+246], N[(N[Power[t$95$1, 2.0], $MachinePrecision] * N[(t$95$1 * N[(N[(z * z), $MachinePrecision] - t), $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}
t_1 := \sqrt[3]{y \cdot -4}\\
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+246}:\\
\;\;\;\;\mathsf{fma}\left({t_1}^{2}, t_1 \cdot \left(z \cdot z - t\right), 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.99999999999999976e246Initial program 95.4%
associate-*l*96.0%
Simplified96.0%
sub-neg96.0%
+-commutative96.0%
distribute-rgt-neg-in96.0%
distribute-lft-neg-in96.0%
metadata-eval96.0%
associate-*l*95.4%
add-cube-cbrt94.8%
associate-*l*94.8%
fma-def97.7%
pow297.7%
Applied egg-rr97.7%
if 4.99999999999999976e246 < (*.f64 z z) Initial program 79.9%
associate-*l*79.9%
Simplified79.9%
Taylor expanded in z around inf 79.9%
*-commutative79.9%
unpow279.9%
*-commutative79.9%
associate-*r*79.9%
associate-*l*93.8%
*-commutative93.8%
Simplified93.8%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+302) (fma x x (* (* y -4.0) (- (* z z) t))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+302) {
tmp = fma(x, x, ((y * -4.0) * ((z * z) - t)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+302) tmp = fma(x, x, Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t))); 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], 2e+302], N[(x * x + N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $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 2 \cdot 10^{+302}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot -4\right) \cdot \left(z \cdot z - t\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) < 2.0000000000000002e302Initial program 95.1%
fma-neg96.2%
*-commutative96.2%
distribute-rgt-neg-in96.2%
distribute-rgt-neg-in96.2%
metadata-eval96.2%
Simplified96.2%
if 2.0000000000000002e302 < (*.f64 z z) Initial program 78.5%
associate-*l*78.5%
Simplified78.5%
Taylor expanded in z around inf 78.5%
*-commutative78.5%
unpow278.5%
*-commutative78.5%
associate-*r*78.5%
associate-*l*94.3%
*-commutative94.3%
Simplified94.3%
Final simplification95.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* (* y -4.0) t))))
(if (<= (* z z) 2e+140)
t_1
(if (<= (* z z) 2e+185)
(* (* y -4.0) (- (* z z) t))
(if (<= (* z z) 5e+209) t_1 (* z (* z (* y -4.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - ((y * -4.0) * t);
double tmp;
if ((z * z) <= 2e+140) {
tmp = t_1;
} else if ((z * z) <= 2e+185) {
tmp = (y * -4.0) * ((z * z) - t);
} else if ((z * z) <= 5e+209) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * x) - ((y * (-4.0d0)) * t)
if ((z * z) <= 2d+140) then
tmp = t_1
else if ((z * z) <= 2d+185) then
tmp = (y * (-4.0d0)) * ((z * z) - t)
else if ((z * z) <= 5d+209) then
tmp = t_1
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 t_1 = (x * x) - ((y * -4.0) * t);
double tmp;
if ((z * z) <= 2e+140) {
tmp = t_1;
} else if ((z * z) <= 2e+185) {
tmp = (y * -4.0) * ((z * z) - t);
} else if ((z * z) <= 5e+209) {
tmp = t_1;
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * x) - ((y * -4.0) * t) tmp = 0 if (z * z) <= 2e+140: tmp = t_1 elif (z * z) <= 2e+185: tmp = (y * -4.0) * ((z * z) - t) elif (z * z) <= 5e+209: tmp = t_1 else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(Float64(y * -4.0) * t)) tmp = 0.0 if (Float64(z * z) <= 2e+140) tmp = t_1; elseif (Float64(z * z) <= 2e+185) tmp = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)); elseif (Float64(z * z) <= 5e+209) tmp = t_1; else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * x) - ((y * -4.0) * t); tmp = 0.0; if ((z * z) <= 2e+140) tmp = t_1; elseif ((z * z) <= 2e+185) tmp = (y * -4.0) * ((z * z) - t); elseif ((z * z) <= 5e+209) tmp = t_1; else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(N[(y * -4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e+140], t$95$1, If[LessEqual[N[(z * z), $MachinePrecision], 2e+185], N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+209], t$95$1, N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot x - \left(y \cdot -4\right) \cdot t\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+140}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+185}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+209}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000012e140 or 2e185 < (*.f64 z z) < 4.99999999999999964e209Initial program 95.5%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in z around 0 89.9%
associate-*r*89.3%
*-commutative89.3%
Simplified89.3%
if 2.00000000000000012e140 < (*.f64 z z) < 2e185Initial program 91.7%
associate-*l*91.7%
Simplified91.7%
sub-neg91.7%
+-commutative91.7%
distribute-rgt-neg-in91.7%
distribute-lft-neg-in91.7%
metadata-eval91.7%
associate-*l*91.7%
add-cube-cbrt90.8%
associate-*l*90.7%
fma-def90.7%
pow290.7%
Applied egg-rr90.7%
Taylor expanded in x around 0 83.0%
pow-base-183.0%
*-rgt-identity83.0%
*-commutative83.0%
unpow283.0%
distribute-rgt-out--83.0%
distribute-lft-out--83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
distribute-lft-out--83.0%
Simplified83.0%
if 4.99999999999999964e209 < (*.f64 z z) Initial program 81.5%
associate-*l*81.5%
Simplified81.5%
Taylor expanded in z around inf 81.5%
*-commutative81.5%
unpow281.5%
*-commutative81.5%
associate-*r*81.5%
associate-*l*87.7%
Simplified87.7%
Final simplification88.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* (* z z) y))))
(if (<= (* x x) 1.2e-307)
t_1
(if (<= (* x x) 3.4e-202)
(* t (* y 4.0))
(if (<= (* x x) 1.45e+126) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = -4.0 * ((z * z) * y);
double tmp;
if ((x * x) <= 1.2e-307) {
tmp = t_1;
} else if ((x * x) <= 3.4e-202) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 1.45e+126) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * ((z * z) * y)
if ((x * x) <= 1.2d-307) then
tmp = t_1
else if ((x * x) <= 3.4d-202) then
tmp = t * (y * 4.0d0)
else if ((x * x) <= 1.45d+126) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -4.0 * ((z * z) * y);
double tmp;
if ((x * x) <= 1.2e-307) {
tmp = t_1;
} else if ((x * x) <= 3.4e-202) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 1.45e+126) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -4.0 * ((z * z) * y) tmp = 0 if (x * x) <= 1.2e-307: tmp = t_1 elif (x * x) <= 3.4e-202: tmp = t * (y * 4.0) elif (x * x) <= 1.45e+126: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(-4.0 * Float64(Float64(z * z) * y)) tmp = 0.0 if (Float64(x * x) <= 1.2e-307) tmp = t_1; elseif (Float64(x * x) <= 3.4e-202) tmp = Float64(t * Float64(y * 4.0)); elseif (Float64(x * x) <= 1.45e+126) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -4.0 * ((z * z) * y); tmp = 0.0; if ((x * x) <= 1.2e-307) tmp = t_1; elseif ((x * x) <= 3.4e-202) tmp = t * (y * 4.0); elseif ((x * x) <= 1.45e+126) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1.2e-307], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 3.4e-202], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 1.45e+126], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{-307}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 3.4 \cdot 10^{-202}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{elif}\;x \cdot x \leq 1.45 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.20000000000000009e-307 or 3.40000000000000012e-202 < (*.f64 x x) < 1.44999999999999993e126Initial program 96.2%
associate-*l*96.2%
Simplified96.2%
sub-neg96.2%
+-commutative96.2%
distribute-rgt-neg-in96.2%
distribute-lft-neg-in96.2%
metadata-eval96.2%
associate-*l*96.2%
add-cube-cbrt95.5%
associate-*l*95.5%
fma-def95.5%
pow295.5%
Applied egg-rr95.5%
Taylor expanded in z around inf 55.6%
pow-base-155.6%
unpow255.6%
associate-*r*55.6%
*-lft-identity55.6%
Simplified55.6%
if 1.20000000000000009e-307 < (*.f64 x x) < 3.40000000000000012e-202Initial program 91.4%
associate-*l*91.4%
Simplified91.4%
Taylor expanded in t around inf 69.6%
associate-*r*69.6%
Simplified69.6%
if 1.44999999999999993e126 < (*.f64 x x) Initial program 83.8%
associate-*l*84.6%
Simplified84.6%
Taylor expanded in x around inf 79.5%
unpow279.5%
Simplified79.5%
Final simplification67.0%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e+40)
(* x x)
(if (<= (* z z) 2e+61)
(* -4.0 (* (* z z) y))
(if (<= (* z z) 2e+140) (* x x) (* z (* z (* y -4.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+40) {
tmp = x * x;
} else if ((z * z) <= 2e+61) {
tmp = -4.0 * ((z * z) * y);
} else if ((z * z) <= 2e+140) {
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 * z) <= 5d+40) then
tmp = x * x
else if ((z * z) <= 2d+61) then
tmp = (-4.0d0) * ((z * z) * y)
else if ((z * z) <= 2d+140) 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 * z) <= 5e+40) {
tmp = x * x;
} else if ((z * z) <= 2e+61) {
tmp = -4.0 * ((z * z) * y);
} else if ((z * z) <= 2e+140) {
tmp = x * x;
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+40: tmp = x * x elif (z * z) <= 2e+61: tmp = -4.0 * ((z * z) * y) elif (z * z) <= 2e+140: tmp = x * x else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+40) tmp = Float64(x * x); elseif (Float64(z * z) <= 2e+61) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); elseif (Float64(z * z) <= 2e+140) tmp = Float64(x * x); 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) <= 5e+40) tmp = x * x; elseif ((z * z) <= 2e+61) tmp = -4.0 * ((z * z) * y); elseif ((z * z) <= 2e+140) tmp = x * x; else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+40], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+61], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+140], N[(x * x), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+40}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+61}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+140}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000003e40 or 1.9999999999999999e61 < (*.f64 z z) < 2.00000000000000012e140Initial program 95.1%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in x around inf 58.8%
unpow258.8%
Simplified58.8%
if 5.00000000000000003e40 < (*.f64 z z) < 1.9999999999999999e61Initial program 100.0%
associate-*l*100.0%
Simplified100.0%
sub-neg100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
distribute-lft-neg-in100.0%
metadata-eval100.0%
associate-*l*100.0%
add-cube-cbrt99.1%
associate-*l*99.1%
fma-def99.1%
pow299.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 100.0%
pow-base-1100.0%
unpow2100.0%
associate-*r*100.0%
*-lft-identity100.0%
Simplified100.0%
if 2.00000000000000012e140 < (*.f64 z z) Initial program 83.8%
associate-*l*83.8%
Simplified83.8%
Taylor expanded in z around inf 75.8%
*-commutative75.8%
unpow275.8%
*-commutative75.8%
associate-*r*75.8%
associate-*l*81.0%
Simplified81.0%
Final simplification68.9%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 1e+37)
(- (* x x) (* (* y -4.0) t))
(if (<= (* z z) 5e+269)
(- (* x x) (* y (* (* z z) 4.0)))
(* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+37) {
tmp = (x * x) - ((y * -4.0) * t);
} else if ((z * z) <= 5e+269) {
tmp = (x * x) - (y * ((z * z) * 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) <= 1d+37) then
tmp = (x * x) - ((y * (-4.0d0)) * t)
else if ((z * z) <= 5d+269) then
tmp = (x * x) - (y * ((z * z) * 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) <= 1e+37) {
tmp = (x * x) - ((y * -4.0) * t);
} else if ((z * z) <= 5e+269) {
tmp = (x * x) - (y * ((z * z) * 4.0));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e+37: tmp = (x * x) - ((y * -4.0) * t) elif (z * z) <= 5e+269: tmp = (x * x) - (y * ((z * z) * 4.0)) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+37) tmp = Float64(Float64(x * x) - Float64(Float64(y * -4.0) * t)); elseif (Float64(z * z) <= 5e+269) tmp = Float64(Float64(x * x) - Float64(y * Float64(Float64(z * z) * 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 * z) <= 1e+37) tmp = (x * x) - ((y * -4.0) * t); elseif ((z * z) <= 5e+269) tmp = (x * x) - (y * ((z * z) * 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], 1e+37], N[(N[(x * x), $MachinePrecision] - N[(N[(y * -4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+269], N[(N[(x * x), $MachinePrecision] - N[(y * N[(N[(z * z), $MachinePrecision] * 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 \cdot z \leq 10^{+37}:\\
\;\;\;\;x \cdot x - \left(y \cdot -4\right) \cdot t\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+269}:\\
\;\;\;\;x \cdot x - y \cdot \left(\left(z \cdot z\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999954e36Initial program 95.4%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in z around 0 92.5%
associate-*r*91.8%
*-commutative91.8%
Simplified91.8%
if 9.99999999999999954e36 < (*.f64 z z) < 5.0000000000000002e269Initial program 95.7%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in z around inf 82.0%
unpow282.0%
Simplified82.0%
if 5.0000000000000002e269 < (*.f64 z z) Initial program 79.1%
associate-*l*79.1%
Simplified79.1%
Taylor expanded in z around inf 82.9%
*-commutative82.9%
unpow282.9%
*-commutative82.9%
associate-*r*82.9%
associate-*l*90.0%
Simplified90.0%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+269) (+ (* 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) <= 5e+269) {
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) <= 5d+269) 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) <= 5e+269) {
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) <= 5e+269: 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) <= 5e+269) tmp = Float64(Float64(x * x) + Float64(y * Float64(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) <= 5e+269) 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], 5e+269], N[(N[(x * x), $MachinePrecision] + N[(y * N[(4.0 * N[(t - N[(z * z), $MachinePrecision]), $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 5 \cdot 10^{+269}:\\
\;\;\;\;x \cdot x + y \cdot \left(4 \cdot \left(t - z \cdot z\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) < 5.0000000000000002e269Initial program 95.5%
associate-*l*96.0%
Simplified96.0%
if 5.0000000000000002e269 < (*.f64 z z) Initial program 79.1%
associate-*l*79.1%
Simplified79.1%
Taylor expanded in z around inf 79.1%
*-commutative79.1%
unpow279.1%
*-commutative79.1%
associate-*r*79.1%
associate-*l*93.5%
*-commutative93.5%
Simplified93.5%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+37) (- (* x x) (* (* y -4.0) t)) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+37) {
tmp = (x * x) - ((y * -4.0) * t);
} 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) <= 1d+37) then
tmp = (x * x) - ((y * (-4.0d0)) * t)
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) <= 1e+37) {
tmp = (x * x) - ((y * -4.0) * t);
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e+37: tmp = (x * x) - ((y * -4.0) * t) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+37) tmp = Float64(Float64(x * x) - Float64(Float64(y * -4.0) * t)); 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) <= 1e+37) tmp = (x * x) - ((y * -4.0) * t); 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], 1e+37], N[(N[(x * x), $MachinePrecision] - N[(N[(y * -4.0), $MachinePrecision] * t), $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 10^{+37}:\\
\;\;\;\;x \cdot x - \left(y \cdot -4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999954e36Initial program 95.4%
associate-*l*96.2%
Simplified96.2%
Taylor expanded in z around 0 92.5%
associate-*r*91.8%
*-commutative91.8%
Simplified91.8%
if 9.99999999999999954e36 < (*.f64 z z) Initial program 85.3%
associate-*l*85.3%
Simplified85.3%
Taylor expanded in z around inf 80.2%
*-commutative80.2%
unpow280.2%
*-commutative80.2%
associate-*r*80.2%
associate-*l*89.2%
*-commutative89.2%
Simplified89.2%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.25e+126) (* (* y -4.0) (- (* z z) t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.25e+126) {
tmp = (y * -4.0) * ((z * z) - 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) <= 1.25d+126) then
tmp = (y * (-4.0d0)) * ((z * z) - 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) <= 1.25e+126) {
tmp = (y * -4.0) * ((z * z) - t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.25e+126: tmp = (y * -4.0) * ((z * z) - t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.25e+126) tmp = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 1.25e+126) tmp = (y * -4.0) * ((z * z) - t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.25e+126], N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.25 \cdot 10^{+126}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.24999999999999994e126Initial program 95.5%
associate-*l*95.5%
Simplified95.5%
sub-neg95.5%
+-commutative95.5%
distribute-rgt-neg-in95.5%
distribute-lft-neg-in95.5%
metadata-eval95.5%
associate-*l*95.5%
add-cube-cbrt94.8%
associate-*l*94.7%
fma-def94.7%
pow294.7%
Applied egg-rr94.7%
Taylor expanded in x around 0 83.8%
pow-base-183.8%
*-rgt-identity83.8%
*-commutative83.8%
unpow283.8%
distribute-rgt-out--81.1%
distribute-lft-out--80.4%
*-commutative80.4%
associate-*r*80.4%
*-commutative80.4%
*-commutative80.4%
associate-*r*80.4%
*-commutative80.4%
distribute-lft-out--83.8%
Simplified83.8%
if 1.24999999999999994e126 < (*.f64 x x) Initial program 83.8%
associate-*l*84.6%
Simplified84.6%
Taylor expanded in x around inf 79.5%
unpow279.5%
Simplified79.5%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (<= x 8.5e-28) (* t (* y 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 8.5e-28) {
tmp = t * (y * 4.0);
} 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 <= 8.5d-28) then
tmp = t * (y * 4.0d0)
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 <= 8.5e-28) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 8.5e-28: tmp = t * (y * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 8.5e-28) tmp = Float64(t * Float64(y * 4.0)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 8.5e-28) tmp = t * (y * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 8.5e-28], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{-28}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 8.49999999999999925e-28Initial program 91.4%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in t around inf 33.4%
associate-*r*33.4%
Simplified33.4%
if 8.49999999999999925e-28 < x Initial program 88.0%
associate-*l*88.0%
Simplified88.0%
Taylor expanded in x around inf 63.9%
unpow263.9%
Simplified63.9%
Final simplification41.4%
(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.5%
associate-*l*90.9%
Simplified90.9%
Taylor expanded in x around inf 42.3%
unpow242.3%
Simplified42.3%
Final simplification42.3%
(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 2023223
(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))))