
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (x_46im * x_46re)) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (x_46im * x_46re)) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 3.3e+153) (fma x.re (* x.im (* x.im -3.0)) (pow x.re 3.0)) (* x.im (* -3.0 (* x.im x.re)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 3.3e+153) {
tmp = fma(x_46_re, (x_46_im * (x_46_im * -3.0)), pow(x_46_re, 3.0));
} else {
tmp = x_46_im * (-3.0 * (x_46_im * x_46_re));
}
return tmp;
}
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 3.3e+153) tmp = fma(x_46_re, Float64(x_46_im * Float64(x_46_im * -3.0)), (x_46_re ^ 3.0)); else tmp = Float64(x_46_im * Float64(-3.0 * Float64(x_46_im * x_46_re))); end return tmp end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 3.3e+153], N[(x$46$re * N[(x$46$im * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision] + N[Power[x$46$re, 3.0], $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(-3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 3.3 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(x.re, x.im \cdot \left(x.im \cdot -3\right), {x.re}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(-3 \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < 3.29999999999999994e153Initial program 84.9%
*-commutative84.9%
sub-neg84.9%
distribute-rgt-in84.5%
associate--l+84.5%
associate-*r*84.5%
+-commutative84.5%
*-commutative84.5%
*-commutative84.5%
distribute-lft-out84.5%
associate-*l*84.5%
distribute-lft-out--84.5%
fma-def94.2%
Simplified94.3%
if 3.29999999999999994e153 < x.im Initial program 49.8%
*-commutative49.8%
distribute-lft-out49.8%
associate-*l*49.8%
*-commutative49.8%
distribute-rgt-out--49.8%
associate--l-49.8%
associate--l-49.8%
sub-neg49.8%
associate--l+49.8%
fma-udef53.2%
neg-mul-153.2%
count-253.2%
associate-*l*53.2%
distribute-rgt-out--53.2%
associate-*r*53.2%
metadata-eval53.2%
Simplified53.2%
Taylor expanded in x.re around 0 53.2%
associate-*r*53.2%
unpow253.2%
Simplified53.2%
add-sqr-sqrt28.2%
pow228.2%
*-commutative28.2%
sqrt-prod28.2%
sqrt-prod34.3%
add-sqr-sqrt34.3%
*-commutative34.3%
Applied egg-rr34.3%
unpow234.3%
swap-sqr28.2%
add-sqr-sqrt53.2%
*-commutative53.2%
*-commutative53.2%
associate-*r*53.2%
associate-*r*72.3%
associate-*r*72.4%
Applied egg-rr72.4%
Final simplification91.8%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 7.5e+153) (* x.re (+ (* x.im (* x.im -3.0)) (* x.re x.re))) (* x.im (* -3.0 (* x.im x.re)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 7.5e+153) {
tmp = x_46_re * ((x_46_im * (x_46_im * -3.0)) + (x_46_re * x_46_re));
} else {
tmp = x_46_im * (-3.0 * (x_46_im * x_46_re));
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46im <= 7.5d+153) then
tmp = x_46re * ((x_46im * (x_46im * (-3.0d0))) + (x_46re * x_46re))
else
tmp = x_46im * ((-3.0d0) * (x_46im * x_46re))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 7.5e+153) {
tmp = x_46_re * ((x_46_im * (x_46_im * -3.0)) + (x_46_re * x_46_re));
} else {
tmp = x_46_im * (-3.0 * (x_46_im * x_46_re));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 7.5e+153: tmp = x_46_re * ((x_46_im * (x_46_im * -3.0)) + (x_46_re * x_46_re)) else: tmp = x_46_im * (-3.0 * (x_46_im * x_46_re)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 7.5e+153) tmp = Float64(x_46_re * Float64(Float64(x_46_im * Float64(x_46_im * -3.0)) + Float64(x_46_re * x_46_re))); else tmp = Float64(x_46_im * Float64(-3.0 * Float64(x_46_im * x_46_re))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 7.5e+153) tmp = x_46_re * ((x_46_im * (x_46_im * -3.0)) + (x_46_re * x_46_re)); else tmp = x_46_im * (-3.0 * (x_46_im * x_46_re)); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 7.5e+153], N[(x$46$re * N[(N[(x$46$im * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(-3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 7.5 \cdot 10^{+153}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(x.im \cdot -3\right) + x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(-3 \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < 7.50000000000000065e153Initial program 84.9%
*-commutative84.9%
distribute-lft-out84.9%
associate-*l*84.9%
*-commutative84.9%
distribute-rgt-out--94.6%
associate--l-94.7%
associate--l-94.6%
sub-neg94.6%
associate--l+94.7%
fma-udef95.5%
neg-mul-195.5%
count-295.5%
associate-*l*95.5%
distribute-rgt-out--95.5%
associate-*r*95.5%
metadata-eval95.5%
Simplified95.5%
fma-udef94.6%
Applied egg-rr94.6%
if 7.50000000000000065e153 < x.im Initial program 49.8%
*-commutative49.8%
distribute-lft-out49.8%
associate-*l*49.8%
*-commutative49.8%
distribute-rgt-out--49.8%
associate--l-49.8%
associate--l-49.8%
sub-neg49.8%
associate--l+49.8%
fma-udef53.2%
neg-mul-153.2%
count-253.2%
associate-*l*53.2%
distribute-rgt-out--53.2%
associate-*r*53.2%
metadata-eval53.2%
Simplified53.2%
Taylor expanded in x.re around 0 53.2%
associate-*r*53.2%
unpow253.2%
Simplified53.2%
add-sqr-sqrt28.2%
pow228.2%
*-commutative28.2%
sqrt-prod28.2%
sqrt-prod34.3%
add-sqr-sqrt34.3%
*-commutative34.3%
Applied egg-rr34.3%
unpow234.3%
swap-sqr28.2%
add-sqr-sqrt53.2%
*-commutative53.2%
*-commutative53.2%
associate-*r*53.2%
associate-*r*72.3%
associate-*r*72.4%
Applied egg-rr72.4%
Final simplification92.1%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -5.3e-44) (not (<= x.re 1.4e+18))) (* x.re (* x.re x.re)) (* -3.0 (* x.re (* x.im x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -5.3e-44) || !(x_46_re <= 1.4e+18)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_re * (x_46_im * x_46_im));
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-5.3d-44)) .or. (.not. (x_46re <= 1.4d+18))) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (-3.0d0) * (x_46re * (x_46im * x_46im))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -5.3e-44) || !(x_46_re <= 1.4e+18)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = -3.0 * (x_46_re * (x_46_im * x_46_im));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -5.3e-44) or not (x_46_re <= 1.4e+18): tmp = x_46_re * (x_46_re * x_46_re) else: tmp = -3.0 * (x_46_re * (x_46_im * x_46_im)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -5.3e-44) || !(x_46_re <= 1.4e+18)) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(-3.0 * Float64(x_46_re * Float64(x_46_im * x_46_im))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -5.3e-44) || ~((x_46_re <= 1.4e+18))) tmp = x_46_re * (x_46_re * x_46_re); else tmp = -3.0 * (x_46_re * (x_46_im * x_46_im)); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -5.3e-44], N[Not[LessEqual[x$46$re, 1.4e+18]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$re * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -5.3 \cdot 10^{-44} \lor \neg \left(x.re \leq 1.4 \cdot 10^{+18}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.re \cdot \left(x.im \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.re < -5.29999999999999971e-44 or 1.4e18 < x.re Initial program 72.5%
*-commutative72.5%
distribute-lft-out72.5%
associate-*l*72.5%
*-commutative72.5%
distribute-rgt-out--89.7%
associate--l-89.7%
associate--l-89.7%
sub-neg89.7%
associate--l+89.7%
fma-udef92.0%
neg-mul-192.0%
count-292.0%
associate-*l*92.0%
distribute-rgt-out--92.0%
associate-*r*92.0%
metadata-eval92.0%
Simplified92.0%
Taylor expanded in x.re around inf 83.0%
unpow283.0%
Simplified83.0%
if -5.29999999999999971e-44 < x.re < 1.4e18Initial program 89.4%
*-commutative89.4%
distribute-lft-out89.4%
associate-*l*89.4%
*-commutative89.4%
distribute-rgt-out--89.4%
associate--l-89.5%
associate--l-89.4%
sub-neg89.4%
associate--l+89.5%
fma-udef89.5%
neg-mul-189.5%
count-289.5%
associate-*l*89.5%
distribute-rgt-out--89.5%
associate-*r*89.4%
metadata-eval89.4%
Simplified89.4%
fma-udef89.4%
Applied egg-rr89.4%
Taylor expanded in x.re around 0 75.4%
unpow275.4%
Simplified75.4%
Final simplification79.2%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -5e-44) (not (<= x.re 3.6e+17))) (* x.re (* x.re x.re)) (* x.re (* -3.0 (* x.im x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -5e-44) || !(x_46_re <= 3.6e+17)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_re * (-3.0 * (x_46_im * x_46_im));
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-5d-44)) .or. (.not. (x_46re <= 3.6d+17))) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = x_46re * ((-3.0d0) * (x_46im * x_46im))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -5e-44) || !(x_46_re <= 3.6e+17)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_re * (-3.0 * (x_46_im * x_46_im));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -5e-44) or not (x_46_re <= 3.6e+17): tmp = x_46_re * (x_46_re * x_46_re) else: tmp = x_46_re * (-3.0 * (x_46_im * x_46_im)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -5e-44) || !(x_46_re <= 3.6e+17)) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(x_46_re * Float64(-3.0 * Float64(x_46_im * x_46_im))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -5e-44) || ~((x_46_re <= 3.6e+17))) tmp = x_46_re * (x_46_re * x_46_re); else tmp = x_46_re * (-3.0 * (x_46_im * x_46_im)); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -5e-44], N[Not[LessEqual[x$46$re, 3.6e+17]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(-3.0 * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -5 \cdot 10^{-44} \lor \neg \left(x.re \leq 3.6 \cdot 10^{+17}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(-3 \cdot \left(x.im \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.re < -5.00000000000000039e-44 or 3.6e17 < x.re Initial program 72.5%
*-commutative72.5%
distribute-lft-out72.5%
associate-*l*72.5%
*-commutative72.5%
distribute-rgt-out--89.7%
associate--l-89.7%
associate--l-89.7%
sub-neg89.7%
associate--l+89.7%
fma-udef92.0%
neg-mul-192.0%
count-292.0%
associate-*l*92.0%
distribute-rgt-out--92.0%
associate-*r*92.0%
metadata-eval92.0%
Simplified92.0%
Taylor expanded in x.re around inf 83.0%
unpow283.0%
Simplified83.0%
if -5.00000000000000039e-44 < x.re < 3.6e17Initial program 89.4%
*-commutative89.4%
distribute-lft-out89.4%
associate-*l*89.4%
*-commutative89.4%
distribute-rgt-out--89.4%
associate--l-89.5%
associate--l-89.4%
sub-neg89.4%
associate--l+89.5%
fma-udef89.5%
neg-mul-189.5%
count-289.5%
associate-*l*89.5%
distribute-rgt-out--89.5%
associate-*r*89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in x.re around 0 75.4%
associate-*r*75.5%
*-commutative75.5%
metadata-eval75.5%
distribute-rgt-out--75.5%
*-commutative75.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
+-commutative75.5%
distribute-rgt-in75.4%
Simplified75.4%
Final simplification79.2%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -4.9e-44) (not (<= x.re 1.12e+17))) (* x.re (* x.re x.re)) (* (* x.re -3.0) (* x.im x.im))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -4.9e-44) || !(x_46_re <= 1.12e+17)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = (x_46_re * -3.0) * (x_46_im * x_46_im);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-4.9d-44)) .or. (.not. (x_46re <= 1.12d+17))) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (x_46re * (-3.0d0)) * (x_46im * x_46im)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -4.9e-44) || !(x_46_re <= 1.12e+17)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = (x_46_re * -3.0) * (x_46_im * x_46_im);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -4.9e-44) or not (x_46_re <= 1.12e+17): tmp = x_46_re * (x_46_re * x_46_re) else: tmp = (x_46_re * -3.0) * (x_46_im * x_46_im) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -4.9e-44) || !(x_46_re <= 1.12e+17)) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(Float64(x_46_re * -3.0) * Float64(x_46_im * x_46_im)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -4.9e-44) || ~((x_46_re <= 1.12e+17))) tmp = x_46_re * (x_46_re * x_46_re); else tmp = (x_46_re * -3.0) * (x_46_im * x_46_im); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -4.9e-44], N[Not[LessEqual[x$46$re, 1.12e+17]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * -3.0), $MachinePrecision] * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -4.9 \cdot 10^{-44} \lor \neg \left(x.re \leq 1.12 \cdot 10^{+17}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot -3\right) \cdot \left(x.im \cdot x.im\right)\\
\end{array}
\end{array}
if x.re < -4.9000000000000003e-44 or 1.12e17 < x.re Initial program 72.5%
*-commutative72.5%
distribute-lft-out72.5%
associate-*l*72.5%
*-commutative72.5%
distribute-rgt-out--89.7%
associate--l-89.7%
associate--l-89.7%
sub-neg89.7%
associate--l+89.7%
fma-udef92.0%
neg-mul-192.0%
count-292.0%
associate-*l*92.0%
distribute-rgt-out--92.0%
associate-*r*92.0%
metadata-eval92.0%
Simplified92.0%
Taylor expanded in x.re around inf 83.0%
unpow283.0%
Simplified83.0%
if -4.9000000000000003e-44 < x.re < 1.12e17Initial program 89.4%
*-commutative89.4%
distribute-lft-out89.4%
associate-*l*89.4%
*-commutative89.4%
distribute-rgt-out--89.4%
associate--l-89.5%
associate--l-89.4%
sub-neg89.4%
associate--l+89.5%
fma-udef89.5%
neg-mul-189.5%
count-289.5%
associate-*l*89.5%
distribute-rgt-out--89.5%
associate-*r*89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in x.re around 0 75.4%
associate-*r*75.5%
unpow275.5%
Simplified75.5%
Final simplification79.2%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -3.65e-44) (not (<= x.re 3.6e+17))) (* x.re (* x.re x.re)) (* x.im (* -3.0 (* x.im x.re)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -3.65e-44) || !(x_46_re <= 3.6e+17)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_im * (-3.0 * (x_46_im * x_46_re));
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-3.65d-44)) .or. (.not. (x_46re <= 3.6d+17))) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = x_46im * ((-3.0d0) * (x_46im * x_46re))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -3.65e-44) || !(x_46_re <= 3.6e+17)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_im * (-3.0 * (x_46_im * x_46_re));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -3.65e-44) or not (x_46_re <= 3.6e+17): tmp = x_46_re * (x_46_re * x_46_re) else: tmp = x_46_im * (-3.0 * (x_46_im * x_46_re)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -3.65e-44) || !(x_46_re <= 3.6e+17)) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(x_46_im * Float64(-3.0 * Float64(x_46_im * x_46_re))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -3.65e-44) || ~((x_46_re <= 3.6e+17))) tmp = x_46_re * (x_46_re * x_46_re); else tmp = x_46_im * (-3.0 * (x_46_im * x_46_re)); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -3.65e-44], N[Not[LessEqual[x$46$re, 3.6e+17]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(-3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -3.65 \cdot 10^{-44} \lor \neg \left(x.re \leq 3.6 \cdot 10^{+17}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(-3 \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.re < -3.64999999999999993e-44 or 3.6e17 < x.re Initial program 72.5%
*-commutative72.5%
distribute-lft-out72.5%
associate-*l*72.5%
*-commutative72.5%
distribute-rgt-out--89.7%
associate--l-89.7%
associate--l-89.7%
sub-neg89.7%
associate--l+89.7%
fma-udef92.0%
neg-mul-192.0%
count-292.0%
associate-*l*92.0%
distribute-rgt-out--92.0%
associate-*r*92.0%
metadata-eval92.0%
Simplified92.0%
Taylor expanded in x.re around inf 83.0%
unpow283.0%
Simplified83.0%
if -3.64999999999999993e-44 < x.re < 3.6e17Initial program 89.4%
*-commutative89.4%
distribute-lft-out89.4%
associate-*l*89.4%
*-commutative89.4%
distribute-rgt-out--89.4%
associate--l-89.5%
associate--l-89.4%
sub-neg89.4%
associate--l+89.5%
fma-udef89.5%
neg-mul-189.5%
count-289.5%
associate-*l*89.5%
distribute-rgt-out--89.5%
associate-*r*89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in x.re around 0 75.4%
associate-*r*75.5%
unpow275.5%
Simplified75.5%
add-sqr-sqrt45.7%
pow245.7%
*-commutative45.7%
sqrt-prod35.9%
sqrt-prod16.4%
add-sqr-sqrt38.0%
*-commutative38.0%
Applied egg-rr38.0%
unpow238.0%
swap-sqr35.8%
add-sqr-sqrt75.5%
*-commutative75.5%
*-commutative75.5%
associate-*r*75.4%
associate-*r*85.6%
associate-*r*85.6%
Applied egg-rr85.6%
Final simplification84.3%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re -5.6e-44) (not (<= x.re 4.7e+16))) (* x.re (* x.re x.re)) (* (* x.im x.re) (* x.im -3.0))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -5.6e-44) || !(x_46_re <= 4.7e+16)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = (x_46_im * x_46_re) * (x_46_im * -3.0);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if ((x_46re <= (-5.6d-44)) .or. (.not. (x_46re <= 4.7d+16))) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = (x_46im * x_46re) * (x_46im * (-3.0d0))
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -5.6e-44) || !(x_46_re <= 4.7e+16)) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = (x_46_im * x_46_re) * (x_46_im * -3.0);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= -5.6e-44) or not (x_46_re <= 4.7e+16): tmp = x_46_re * (x_46_re * x_46_re) else: tmp = (x_46_im * x_46_re) * (x_46_im * -3.0) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= -5.6e-44) || !(x_46_re <= 4.7e+16)) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(Float64(x_46_im * x_46_re) * Float64(x_46_im * -3.0)); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= -5.6e-44) || ~((x_46_re <= 4.7e+16))) tmp = x_46_re * (x_46_re * x_46_re); else tmp = (x_46_im * x_46_re) * (x_46_im * -3.0); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, -5.6e-44], N[Not[LessEqual[x$46$re, 4.7e+16]], $MachinePrecision]], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im * x$46$re), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -5.6 \cdot 10^{-44} \lor \neg \left(x.re \leq 4.7 \cdot 10^{+16}\right):\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x.im \cdot x.re\right) \cdot \left(x.im \cdot -3\right)\\
\end{array}
\end{array}
if x.re < -5.6e-44 or 4.7e16 < x.re Initial program 72.5%
*-commutative72.5%
distribute-lft-out72.5%
associate-*l*72.5%
*-commutative72.5%
distribute-rgt-out--89.7%
associate--l-89.7%
associate--l-89.7%
sub-neg89.7%
associate--l+89.7%
fma-udef92.0%
neg-mul-192.0%
count-292.0%
associate-*l*92.0%
distribute-rgt-out--92.0%
associate-*r*92.0%
metadata-eval92.0%
Simplified92.0%
Taylor expanded in x.re around inf 83.0%
unpow283.0%
Simplified83.0%
if -5.6e-44 < x.re < 4.7e16Initial program 89.4%
*-commutative89.4%
distribute-lft-out89.4%
associate-*l*89.4%
*-commutative89.4%
distribute-rgt-out--89.4%
associate--l-89.5%
associate--l-89.4%
sub-neg89.4%
associate--l+89.5%
fma-udef89.5%
neg-mul-189.5%
count-289.5%
associate-*l*89.5%
distribute-rgt-out--89.5%
associate-*r*89.4%
metadata-eval89.4%
Simplified89.4%
Taylor expanded in x.re around 0 75.4%
associate-*r*75.5%
unpow275.5%
Simplified75.5%
add-sqr-sqrt45.7%
pow245.7%
*-commutative45.7%
sqrt-prod35.9%
sqrt-prod16.4%
add-sqr-sqrt38.0%
*-commutative38.0%
Applied egg-rr38.0%
unpow238.0%
swap-sqr35.8%
add-sqr-sqrt75.5%
associate-*l*75.4%
*-commutative75.4%
associate-*r*85.6%
associate-*l*85.7%
*-commutative85.7%
Applied egg-rr85.7%
Final simplification84.3%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 2.45e+178) (* x.re (* x.re x.re)) (* x.re (* x.im (- x.im)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 2.45e+178) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_re * (x_46_im * -x_46_im);
}
return tmp;
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46im <= 2.45d+178) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = x_46re * (x_46im * -x_46im)
end if
code = tmp
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 2.45e+178) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_re * (x_46_im * -x_46_im);
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 2.45e+178: tmp = x_46_re * (x_46_re * x_46_re) else: tmp = x_46_re * (x_46_im * -x_46_im) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 2.45e+178) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(x_46_re * Float64(x_46_im * Float64(-x_46_im))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= 2.45e+178) tmp = x_46_re * (x_46_re * x_46_re); else tmp = x_46_re * (x_46_im * -x_46_im); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, 2.45e+178], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 2.45 \cdot 10^{+178}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\end{array}
\end{array}
if x.im < 2.4500000000000001e178Initial program 82.8%
*-commutative82.8%
distribute-lft-out82.8%
associate-*l*82.8%
*-commutative82.8%
distribute-rgt-out--92.3%
associate--l-92.3%
associate--l-92.3%
sub-neg92.3%
associate--l+92.3%
fma-udef93.1%
neg-mul-193.1%
count-293.1%
associate-*l*93.1%
distribute-rgt-out--93.1%
associate-*r*93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in x.re around inf 66.6%
unpow266.6%
Simplified66.6%
if 2.4500000000000001e178 < x.im Initial program 62.3%
*-commutative62.3%
fma-neg62.3%
distribute-lft-neg-in62.3%
*-commutative62.3%
*-commutative62.3%
count-262.3%
distribute-lft-neg-in62.3%
metadata-eval62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in x.re around 0 66.6%
neg-mul-166.6%
unpow266.6%
distribute-rgt-neg-in66.6%
Simplified66.6%
fma-udef66.6%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
swap-sqr0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
associate-*r*0.0%
Applied egg-rr0.0%
associate-*r*3.1%
*-commutative3.1%
distribute-lft-out68.3%
Simplified68.3%
Taylor expanded in x.re around 0 68.3%
*-commutative68.3%
distribute-lft1-in68.3%
metadata-eval68.3%
*-commutative68.3%
associate-*r*66.6%
*-commutative66.6%
neg-mul-166.6%
Simplified66.6%
Final simplification66.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (* x.re (* x.re x.re)))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_re);
}
NOTE: x.im should be positive before calling this function
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = x_46re * (x_46re * x_46re)
end function
x.im = Math.abs(x.im);
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_re);
}
x.im = abs(x.im) def code(x_46_re, x_46_im): return x_46_re * (x_46_re * x_46_re)
x.im = abs(x.im) function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(x_46_re * x_46_re)) end
x.im = abs(x.im) function tmp = code(x_46_re, x_46_im) tmp = x_46_re * (x_46_re * x_46_re); end
NOTE: x.im should be positive before calling this function code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im = |x.im|\\
\\
x.re \cdot \left(x.re \cdot x.re\right)
\end{array}
Initial program 80.9%
*-commutative80.9%
distribute-lft-out80.9%
associate-*l*80.9%
*-commutative80.9%
distribute-rgt-out--89.6%
associate--l-89.6%
associate--l-89.6%
sub-neg89.6%
associate--l+89.6%
fma-udef90.7%
neg-mul-190.7%
count-290.7%
associate-*l*90.7%
distribute-rgt-out--90.7%
associate-*r*90.7%
metadata-eval90.7%
Simplified90.7%
Taylor expanded in x.re around inf 62.3%
unpow262.3%
Simplified62.3%
Final simplification62.3%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im)))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = ((x_46re * x_46re) * (x_46re - x_46im)) + ((x_46re * x_46im) * (x_46re - (3.0d0 * x_46im)))
end function
public static double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im)) + Float64(Float64(x_46_re * x_46_im) * Float64(x_46_re - Float64(3.0 * x_46_im)))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im))); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$re - N[(3.0 * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)
\end{array}
herbie shell --seed 2023189
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))