
(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 10 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) 1e+292) (fma x x (* (- (* z z) t) (* y -4.0))) (+ (* x x) (- (* 4.0 (* t y)) (* z (* z (* y 4.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+292) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) + ((4.0 * (t * y)) - (z * (z * (y * 4.0))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+292) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) + Float64(Float64(4.0 * Float64(t * y)) - Float64(z * Float64(z * Float64(y * 4.0))))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+292], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+292}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(4 \cdot \left(t \cdot y\right) - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1e292Initial program 97.9%
fma-neg98.9%
*-commutative98.9%
distribute-rgt-neg-in98.9%
distribute-rgt-neg-in98.9%
metadata-eval98.9%
Simplified98.9%
if 1e292 < (*.f64 z z) Initial program 75.6%
add-cube-cbrt75.5%
pow375.5%
Applied egg-rr75.5%
unpow375.5%
add-cube-cbrt75.6%
sub-neg75.6%
distribute-lft-in74.0%
*-commutative74.0%
Applied egg-rr74.0%
fma-def74.0%
distribute-rgt-neg-out74.0%
add-sqr-sqrt37.8%
sqrt-prod62.0%
sqr-neg62.0%
sqrt-prod36.2%
add-sqr-sqrt75.6%
*-commutative75.6%
*-commutative75.6%
fma-neg75.6%
associate-*l*95.1%
add-sqr-sqrt49.9%
add-sqr-sqrt95.1%
add-sqr-sqrt46.7%
sqrt-prod72.7%
sqr-neg72.7%
sqrt-prod46.8%
add-sqr-sqrt93.5%
Applied egg-rr93.5%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* (* z z) (* y 4.0))))
(t_2 (- (* x x) (* t (* y -4.0)))))
(if (<= (* z z) 1e-57)
t_2
(if (<= (* z z) 1e+37)
t_1
(if (<= (* z z) 1e+105)
t_2
(if (<= (* z z) 4e+258) t_1 (* -4.0 (* z (* z y)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - ((z * z) * (y * 4.0));
double t_2 = (x * x) - (t * (y * -4.0));
double tmp;
if ((z * z) <= 1e-57) {
tmp = t_2;
} else if ((z * z) <= 1e+37) {
tmp = t_1;
} else if ((z * z) <= 1e+105) {
tmp = t_2;
} else if ((z * z) <= 4e+258) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * x) - ((z * z) * (y * 4.0d0))
t_2 = (x * x) - (t * (y * (-4.0d0)))
if ((z * z) <= 1d-57) then
tmp = t_2
else if ((z * z) <= 1d+37) then
tmp = t_1
else if ((z * z) <= 1d+105) then
tmp = t_2
else if ((z * z) <= 4d+258) then
tmp = t_1
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 t_1 = (x * x) - ((z * z) * (y * 4.0));
double t_2 = (x * x) - (t * (y * -4.0));
double tmp;
if ((z * z) <= 1e-57) {
tmp = t_2;
} else if ((z * z) <= 1e+37) {
tmp = t_1;
} else if ((z * z) <= 1e+105) {
tmp = t_2;
} else if ((z * z) <= 4e+258) {
tmp = t_1;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * x) - ((z * z) * (y * 4.0)) t_2 = (x * x) - (t * (y * -4.0)) tmp = 0 if (z * z) <= 1e-57: tmp = t_2 elif (z * z) <= 1e+37: tmp = t_1 elif (z * z) <= 1e+105: tmp = t_2 elif (z * z) <= 4e+258: tmp = t_1 else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(Float64(z * z) * Float64(y * 4.0))) t_2 = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))) tmp = 0.0 if (Float64(z * z) <= 1e-57) tmp = t_2; elseif (Float64(z * z) <= 1e+37) tmp = t_1; elseif (Float64(z * z) <= 1e+105) tmp = t_2; elseif (Float64(z * z) <= 4e+258) tmp = t_1; else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * x) - ((z * z) * (y * 4.0)); t_2 = (x * x) - (t * (y * -4.0)); tmp = 0.0; if ((z * z) <= 1e-57) tmp = t_2; elseif ((z * z) <= 1e+37) tmp = t_1; elseif ((z * z) <= 1e+105) tmp = t_2; elseif ((z * z) <= 4e+258) tmp = t_1; else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(N[(z * z), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 1e-57], t$95$2, If[LessEqual[N[(z * z), $MachinePrecision], 1e+37], t$95$1, If[LessEqual[N[(z * z), $MachinePrecision], 1e+105], t$95$2, If[LessEqual[N[(z * z), $MachinePrecision], 4e+258], t$95$1, N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot x - \left(z \cdot z\right) \cdot \left(y \cdot 4\right)\\
t_2 := x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{if}\;z \cdot z \leq 10^{-57}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \cdot z \leq 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot z \leq 10^{+105}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{+258}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999955e-58 or 9.99999999999999954e36 < (*.f64 z z) < 9.9999999999999994e104Initial program 98.5%
Taylor expanded in z around 0 95.2%
associate-*r*95.2%
Simplified95.2%
if 9.99999999999999955e-58 < (*.f64 z z) < 9.99999999999999954e36 or 9.9999999999999994e104 < (*.f64 z z) < 4.00000000000000023e258Initial program 99.9%
Taylor expanded in z around inf 97.7%
unpow297.7%
Simplified97.7%
if 4.00000000000000023e258 < (*.f64 z z) Initial program 75.8%
Taylor expanded in z around inf 80.0%
unpow280.0%
*-commutative80.0%
associate-*l*89.0%
Simplified89.0%
Final simplification94.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= (* x x) 2.7e+66)
(and (not (<= (* x x) 1.7e+187)) (<= (* x x) 1.1e+217)))
(* (- (* z z) t) (* y -4.0))
(* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) <= 2.7e+66) || (!((x * x) <= 1.7e+187) && ((x * x) <= 1.1e+217))) {
tmp = ((z * z) - 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 * x) <= 2.7d+66) .or. (.not. ((x * x) <= 1.7d+187)) .and. ((x * x) <= 1.1d+217)) then
tmp = ((z * z) - 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 * x) <= 2.7e+66) || (!((x * x) <= 1.7e+187) && ((x * x) <= 1.1e+217))) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x * x) <= 2.7e+66) or (not ((x * x) <= 1.7e+187) and ((x * x) <= 1.1e+217)): tmp = ((z * z) - t) * (y * -4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x * x) <= 2.7e+66) || (!(Float64(x * x) <= 1.7e+187) && (Float64(x * x) <= 1.1e+217))) tmp = Float64(Float64(Float64(z * z) - 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 * x) <= 2.7e+66) || (~(((x * x) <= 1.7e+187)) && ((x * x) <= 1.1e+217))) tmp = ((z * z) - t) * (y * -4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 2.7e+66], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 1.7e+187]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 1.1e+217]]], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.7 \cdot 10^{+66} \lor \neg \left(x \cdot x \leq 1.7 \cdot 10^{+187}\right) \land x \cdot x \leq 1.1 \cdot 10^{+217}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.7e66 or 1.7e187 < (*.f64 x x) < 1.1e217Initial program 92.9%
Taylor expanded in x around 0 83.0%
*-commutative83.0%
*-commutative83.0%
unpow283.0%
*-commutative83.0%
associate-*l*83.0%
Simplified83.0%
if 2.7e66 < (*.f64 x x) < 1.7e187 or 1.1e217 < (*.f64 x x) Initial program 92.0%
Taylor expanded in x around inf 82.6%
unpow282.6%
Simplified82.6%
Final simplification82.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* t (* y -4.0)))))
(if (<= (* z z) 2e+149)
t_1
(if (<= (* z z) 1e+187)
(* (- (* z z) t) (* y -4.0))
(if (<= (* z z) 1e+252) t_1 (* -4.0 (* z (* z y))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (t * (y * -4.0));
double tmp;
if ((z * z) <= 2e+149) {
tmp = t_1;
} else if ((z * z) <= 1e+187) {
tmp = ((z * z) - t) * (y * -4.0);
} else if ((z * z) <= 1e+252) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * x) - (t * (y * (-4.0d0)))
if ((z * z) <= 2d+149) then
tmp = t_1
else if ((z * z) <= 1d+187) then
tmp = ((z * z) - t) * (y * (-4.0d0))
else if ((z * z) <= 1d+252) then
tmp = t_1
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 t_1 = (x * x) - (t * (y * -4.0));
double tmp;
if ((z * z) <= 2e+149) {
tmp = t_1;
} else if ((z * z) <= 1e+187) {
tmp = ((z * z) - t) * (y * -4.0);
} else if ((z * z) <= 1e+252) {
tmp = t_1;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * x) - (t * (y * -4.0)) tmp = 0 if (z * z) <= 2e+149: tmp = t_1 elif (z * z) <= 1e+187: tmp = ((z * z) - t) * (y * -4.0) elif (z * z) <= 1e+252: tmp = t_1 else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))) tmp = 0.0 if (Float64(z * z) <= 2e+149) tmp = t_1; elseif (Float64(z * z) <= 1e+187) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)); elseif (Float64(z * z) <= 1e+252) tmp = t_1; else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * x) - (t * (y * -4.0)); tmp = 0.0; if ((z * z) <= 2e+149) tmp = t_1; elseif ((z * z) <= 1e+187) tmp = ((z * z) - t) * (y * -4.0); elseif ((z * z) <= 1e+252) tmp = t_1; else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 2e+149], t$95$1, If[LessEqual[N[(z * z), $MachinePrecision], 1e+187], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+252], t$95$1, N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot z \leq 10^{+187}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+252}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e149 or 9.99999999999999907e186 < (*.f64 z z) < 1.0000000000000001e252Initial program 98.8%
Taylor expanded in z around 0 90.0%
associate-*r*90.0%
Simplified90.0%
if 2.0000000000000001e149 < (*.f64 z z) < 9.99999999999999907e186Initial program 100.0%
Taylor expanded in x around 0 79.0%
*-commutative79.0%
*-commutative79.0%
unpow279.0%
*-commutative79.0%
associate-*l*79.0%
Simplified79.0%
if 1.0000000000000001e252 < (*.f64 z z) Initial program 76.1%
Taylor expanded in z around inf 80.3%
unpow280.3%
*-commutative80.3%
associate-*l*89.2%
Simplified89.2%
Final simplification89.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* (* z z) y))))
(if (<= (* x x) 6.5e-217)
t_1
(if (<= (* x x) 1.9e-151)
(* 4.0 (* t y))
(if (<= (* x x) 7e+20) 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) <= 6.5e-217) {
tmp = t_1;
} else if ((x * x) <= 1.9e-151) {
tmp = 4.0 * (t * y);
} else if ((x * x) <= 7e+20) {
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) <= 6.5d-217) then
tmp = t_1
else if ((x * x) <= 1.9d-151) then
tmp = 4.0d0 * (t * y)
else if ((x * x) <= 7d+20) 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) <= 6.5e-217) {
tmp = t_1;
} else if ((x * x) <= 1.9e-151) {
tmp = 4.0 * (t * y);
} else if ((x * x) <= 7e+20) {
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) <= 6.5e-217: tmp = t_1 elif (x * x) <= 1.9e-151: tmp = 4.0 * (t * y) elif (x * x) <= 7e+20: 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) <= 6.5e-217) tmp = t_1; elseif (Float64(x * x) <= 1.9e-151) tmp = Float64(4.0 * Float64(t * y)); elseif (Float64(x * x) <= 7e+20) 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) <= 6.5e-217) tmp = t_1; elseif ((x * x) <= 1.9e-151) tmp = 4.0 * (t * y); elseif ((x * x) <= 7e+20) 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], 6.5e-217], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.9e-151], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 7e+20], 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 6.5 \cdot 10^{-217}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 1.9 \cdot 10^{-151}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{elif}\;x \cdot x \leq 7 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 6.4999999999999996e-217 or 1.89999999999999985e-151 < (*.f64 x x) < 7e20Initial program 92.7%
Taylor expanded in z around inf 54.6%
unpow254.6%
Simplified54.6%
if 6.4999999999999996e-217 < (*.f64 x x) < 1.89999999999999985e-151Initial program 93.2%
Taylor expanded in t around inf 60.7%
if 7e20 < (*.f64 x x) Initial program 92.2%
Taylor expanded in x around inf 76.2%
unpow276.2%
Simplified76.2%
Final simplification65.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* z (* z y)))))
(if (<= (* x x) 8e-219)
t_1
(if (<= (* x x) 1.65e-152)
(* 4.0 (* t y))
(if (<= (* x x) 6e+63) 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) <= 8e-219) {
tmp = t_1;
} else if ((x * x) <= 1.65e-152) {
tmp = 4.0 * (t * y);
} else if ((x * x) <= 6e+63) {
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) <= 8d-219) then
tmp = t_1
else if ((x * x) <= 1.65d-152) then
tmp = 4.0d0 * (t * y)
else if ((x * x) <= 6d+63) 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) <= 8e-219) {
tmp = t_1;
} else if ((x * x) <= 1.65e-152) {
tmp = 4.0 * (t * y);
} else if ((x * x) <= 6e+63) {
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) <= 8e-219: tmp = t_1 elif (x * x) <= 1.65e-152: tmp = 4.0 * (t * y) elif (x * x) <= 6e+63: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(-4.0 * Float64(z * Float64(z * y))) tmp = 0.0 if (Float64(x * x) <= 8e-219) tmp = t_1; elseif (Float64(x * x) <= 1.65e-152) tmp = Float64(4.0 * Float64(t * y)); elseif (Float64(x * x) <= 6e+63) 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) <= 8e-219) tmp = t_1; elseif ((x * x) <= 1.65e-152) tmp = 4.0 * (t * y); elseif ((x * x) <= 6e+63) 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[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 8e-219], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.65e-152], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 6e+63], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;x \cdot x \leq 8 \cdot 10^{-219}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 1.65 \cdot 10^{-152}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{elif}\;x \cdot x \leq 6 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 8.0000000000000003e-219 or 1.64999999999999999e-152 < (*.f64 x x) < 5.99999999999999998e63Initial program 92.5%
Taylor expanded in z around inf 52.8%
unpow252.8%
*-commutative52.8%
associate-*l*60.1%
Simplified60.1%
if 8.0000000000000003e-219 < (*.f64 x x) < 1.64999999999999999e-152Initial program 93.2%
Taylor expanded in t around inf 60.7%
if 5.99999999999999998e63 < (*.f64 x x) Initial program 92.3%
Taylor expanded in x around inf 79.2%
unpow279.2%
Simplified79.2%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e+132) (* x x) (+ (* x x) (- (* 4.0 (* t y)) (* z (* z (* y 4.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e+132) {
tmp = x * x;
} else {
tmp = (x * x) + ((4.0 * (t * y)) - (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 (x <= (-2.8d+132)) then
tmp = x * x
else
tmp = (x * x) + ((4.0d0 * (t * y)) - (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 (x <= -2.8e+132) {
tmp = x * x;
} else {
tmp = (x * x) + ((4.0 * (t * y)) - (z * (z * (y * 4.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e+132: tmp = x * x else: tmp = (x * x) + ((4.0 * (t * y)) - (z * (z * (y * 4.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e+132) tmp = Float64(x * x); else tmp = Float64(Float64(x * x) + Float64(Float64(4.0 * Float64(t * y)) - Float64(z * Float64(z * Float64(y * 4.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.8e+132) tmp = x * x; else tmp = (x * x) + ((4.0 * (t * y)) - (z * (z * (y * 4.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e+132], N[(x * x), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+132}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(4 \cdot \left(t \cdot y\right) - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.7999999999999999e132Initial program 84.6%
Taylor expanded in x around inf 92.5%
unpow292.5%
Simplified92.5%
if -2.7999999999999999e132 < x Initial program 93.9%
add-cube-cbrt93.4%
pow393.4%
Applied egg-rr93.4%
unpow393.4%
add-cube-cbrt93.9%
sub-neg93.9%
distribute-lft-in92.0%
*-commutative92.0%
Applied egg-rr92.0%
fma-def92.5%
distribute-rgt-neg-out92.5%
add-sqr-sqrt48.5%
sqrt-prod71.3%
sqr-neg71.3%
sqrt-prod31.0%
add-sqr-sqrt65.0%
*-commutative65.0%
*-commutative65.0%
fma-neg65.0%
associate-*l*70.5%
add-sqr-sqrt43.8%
add-sqr-sqrt70.5%
add-sqr-sqrt34.0%
sqrt-prod73.8%
sqr-neg73.8%
sqrt-prod50.6%
add-sqr-sqrt97.6%
Applied egg-rr97.6%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4e+258) (- (* x x) (* (- (* z z) t) (* y 4.0))) (* -4.0 (* z (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e+258) {
tmp = (x * x) - (((z * z) - t) * (y * 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 * z) <= 4d+258) then
tmp = (x * x) - (((z * z) - t) * (y * 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 * z) <= 4e+258) {
tmp = (x * x) - (((z * z) - t) * (y * 4.0));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 4e+258: tmp = (x * x) - (((z * z) - t) * (y * 4.0)) else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e+258) tmp = Float64(Float64(x * x) - Float64(Float64(Float64(z * z) - t) * Float64(y * 4.0))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 4e+258) tmp = (x * x) - (((z * z) - t) * (y * 4.0)); else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+258], N[(N[(x * x), $MachinePrecision] - N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+258}:\\
\;\;\;\;x \cdot x - \left(z \cdot z - t\right) \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000023e258Initial program 98.9%
if 4.00000000000000023e258 < (*.f64 z z) Initial program 75.8%
Taylor expanded in z around inf 80.0%
unpow280.0%
*-commutative80.0%
associate-*l*89.0%
Simplified89.0%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.16e+17) (* 4.0 (* t y)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.16e+17) {
tmp = 4.0 * (t * 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 * x) <= 1.16d+17) then
tmp = 4.0d0 * (t * 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 * x) <= 1.16e+17) {
tmp = 4.0 * (t * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.16e+17: tmp = 4.0 * (t * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.16e+17) tmp = Float64(4.0 * Float64(t * y)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 1.16e+17) tmp = 4.0 * (t * y); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.16e+17], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.16 \cdot 10^{+17}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.16e17Initial program 92.7%
Taylor expanded in t around inf 43.2%
if 1.16e17 < (*.f64 x x) Initial program 92.2%
Taylor expanded in x around inf 76.2%
unpow276.2%
Simplified76.2%
Final simplification59.5%
(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 92.5%
Taylor expanded in x around inf 44.2%
unpow244.2%
Simplified44.2%
Final simplification44.2%
(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 2023195
(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))))