
(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 7 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 6.5e+153) (* x.re (fma x.re x.re (* x.im (* x.im -3.0)))) (* x.im (* x.im (* x.re -3.0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 6.5e+153) {
tmp = x_46_re * fma(x_46_re, x_46_re, (x_46_im * (x_46_im * -3.0)));
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -3.0));
}
return tmp;
}
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 6.5e+153) tmp = Float64(x_46_re * fma(x_46_re, x_46_re, Float64(x_46_im * Float64(x_46_im * -3.0)))); else tmp = Float64(x_46_im * Float64(x_46_im * Float64(x_46_re * -3.0))); 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, 6.5e+153], N[(x$46$re * N[(x$46$re * x$46$re + N[(x$46$im * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$im * N[(x$46$re * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 6.5 \cdot 10^{+153}:\\
\;\;\;\;x.re \cdot \mathsf{fma}\left(x.re, x.re, x.im \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re \cdot -3\right)\right)\\
\end{array}
\end{array}
if x.im < 6.49999999999999972e153Initial program 85.9%
*-commutative85.9%
distribute-lft-out85.9%
associate-*l*85.9%
*-commutative85.9%
distribute-rgt-out--92.1%
associate--l-92.1%
associate--l-92.1%
sub-neg92.1%
associate--l+92.1%
fma-udef94.8%
neg-mul-194.8%
count-294.8%
associate-*l*94.8%
distribute-rgt-out--94.8%
associate-*r*94.7%
metadata-eval94.7%
Simplified94.7%
if 6.49999999999999972e153 < x.im Initial program 60.0%
*-commutative60.0%
distribute-lft-out60.0%
associate-*l*60.0%
*-commutative60.0%
distribute-rgt-out--60.0%
associate--l-60.0%
associate--l-60.0%
sub-neg60.0%
associate--l+60.0%
fma-udef70.3%
neg-mul-170.3%
count-270.3%
associate-*l*70.3%
distribute-rgt-out--70.3%
associate-*r*70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in x.re around 0 70.3%
associate-*r*70.3%
unpow270.3%
Simplified70.3%
add-sqr-sqrt21.4%
pow221.4%
*-commutative21.4%
sqrt-prod21.4%
sqrt-prod34.3%
add-sqr-sqrt34.3%
*-commutative34.3%
Applied egg-rr34.3%
add-cbrt-cube27.9%
unpow227.9%
pow127.9%
pow-prod-up27.9%
metadata-eval27.9%
Applied egg-rr27.9%
rem-cbrt-cube34.3%
unpow-prod-down21.4%
pow221.4%
pow221.4%
add-sqr-sqrt70.3%
*-commutative70.3%
associate-*l*96.5%
Applied egg-rr96.5%
Final simplification94.9%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.im 3.6e-34) (and (not (<= x.im 4.4e+100)) (<= x.im 2.4e+126))) (* 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_im <= 3.6e-34) || (!(x_46_im <= 4.4e+100) && (x_46_im <= 2.4e+126))) {
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_46im <= 3.6d-34) .or. (.not. (x_46im <= 4.4d+100)) .and. (x_46im <= 2.4d+126)) 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_im <= 3.6e-34) || (!(x_46_im <= 4.4e+100) && (x_46_im <= 2.4e+126))) {
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_im <= 3.6e-34) or (not (x_46_im <= 4.4e+100) and (x_46_im <= 2.4e+126)): 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_im <= 3.6e-34) || (!(x_46_im <= 4.4e+100) && (x_46_im <= 2.4e+126))) 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_im <= 3.6e-34) || (~((x_46_im <= 4.4e+100)) && (x_46_im <= 2.4e+126))) 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$im, 3.6e-34], And[N[Not[LessEqual[x$46$im, 4.4e+100]], $MachinePrecision], LessEqual[x$46$im, 2.4e+126]]], 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.im \leq 3.6 \cdot 10^{-34} \lor \neg \left(x.im \leq 4.4 \cdot 10^{+100}\right) \land x.im \leq 2.4 \cdot 10^{+126}:\\
\;\;\;\;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.im < 3.60000000000000008e-34 or 4.4000000000000001e100 < x.im < 2.40000000000000012e126Initial program 85.2%
*-commutative85.2%
distribute-lft-out85.2%
associate-*l*85.2%
*-commutative85.2%
distribute-rgt-out--90.6%
associate--l-90.6%
associate--l-90.6%
sub-neg90.6%
associate--l+90.6%
fma-udef93.8%
neg-mul-193.8%
count-293.8%
associate-*l*93.8%
distribute-rgt-out--93.8%
associate-*r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in x.re around inf 65.9%
unpow265.9%
Simplified65.9%
if 3.60000000000000008e-34 < x.im < 4.4000000000000001e100 or 2.40000000000000012e126 < x.im Initial program 76.8%
*-commutative76.8%
distribute-lft-out76.8%
associate-*l*76.8%
*-commutative76.8%
distribute-rgt-out--82.7%
associate--l-82.7%
associate--l-82.7%
sub-neg82.7%
associate--l+82.7%
fma-udef87.1%
neg-mul-187.1%
count-287.1%
associate-*l*87.1%
distribute-rgt-out--87.1%
associate-*r*87.1%
metadata-eval87.1%
Simplified87.1%
fma-udef82.7%
Applied egg-rr82.7%
Taylor expanded in x.re around 0 69.5%
unpow269.5%
Simplified69.5%
Final simplification66.9%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.im 9e-34) (and (not (<= x.im 4.4e+100)) (<= x.im 1.3e+126))) (* x.re (* x.re x.re)) (* x.im (* x.im (* x.re -3.0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= 9e-34) || (!(x_46_im <= 4.4e+100) && (x_46_im <= 1.3e+126))) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -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_46im <= 9d-34) .or. (.not. (x_46im <= 4.4d+100)) .and. (x_46im <= 1.3d+126)) then
tmp = x_46re * (x_46re * x_46re)
else
tmp = x_46im * (x_46im * (x_46re * (-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_im <= 9e-34) || (!(x_46_im <= 4.4e+100) && (x_46_im <= 1.3e+126))) {
tmp = x_46_re * (x_46_re * x_46_re);
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -3.0));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= 9e-34) or (not (x_46_im <= 4.4e+100) and (x_46_im <= 1.3e+126)): tmp = x_46_re * (x_46_re * x_46_re) else: tmp = x_46_im * (x_46_im * (x_46_re * -3.0)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= 9e-34) || (!(x_46_im <= 4.4e+100) && (x_46_im <= 1.3e+126))) tmp = Float64(x_46_re * Float64(x_46_re * x_46_re)); else tmp = Float64(x_46_im * Float64(x_46_im * Float64(x_46_re * -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_im <= 9e-34) || (~((x_46_im <= 4.4e+100)) && (x_46_im <= 1.3e+126))) tmp = x_46_re * (x_46_re * x_46_re); else tmp = x_46_im * (x_46_im * (x_46_re * -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$im, 9e-34], And[N[Not[LessEqual[x$46$im, 4.4e+100]], $MachinePrecision], LessEqual[x$46$im, 1.3e+126]]], N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$im * N[(x$46$re * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 9 \cdot 10^{-34} \lor \neg \left(x.im \leq 4.4 \cdot 10^{+100}\right) \land x.im \leq 1.3 \cdot 10^{+126}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re \cdot -3\right)\right)\\
\end{array}
\end{array}
if x.im < 9.00000000000000085e-34 or 4.4000000000000001e100 < x.im < 1.3e126Initial program 85.2%
*-commutative85.2%
distribute-lft-out85.2%
associate-*l*85.2%
*-commutative85.2%
distribute-rgt-out--90.6%
associate--l-90.6%
associate--l-90.6%
sub-neg90.6%
associate--l+90.6%
fma-udef93.8%
neg-mul-193.8%
count-293.8%
associate-*l*93.8%
distribute-rgt-out--93.8%
associate-*r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in x.re around inf 65.9%
unpow265.9%
Simplified65.9%
if 9.00000000000000085e-34 < x.im < 4.4000000000000001e100 or 1.3e126 < x.im Initial program 76.8%
*-commutative76.8%
distribute-lft-out76.8%
associate-*l*76.8%
*-commutative76.8%
distribute-rgt-out--82.7%
associate--l-82.7%
associate--l-82.7%
sub-neg82.7%
associate--l+82.7%
fma-udef87.1%
neg-mul-187.1%
count-287.1%
associate-*l*87.1%
distribute-rgt-out--87.1%
associate-*r*87.1%
metadata-eval87.1%
Simplified87.1%
Taylor expanded in x.re around 0 69.5%
associate-*r*69.6%
unpow269.6%
Simplified69.6%
add-sqr-sqrt26.7%
pow226.7%
*-commutative26.7%
sqrt-prod26.7%
sqrt-prod32.1%
add-sqr-sqrt32.2%
*-commutative32.2%
Applied egg-rr32.2%
add-cbrt-cube26.7%
unpow226.7%
pow126.7%
pow-prod-up26.8%
metadata-eval26.8%
Applied egg-rr26.8%
rem-cbrt-cube32.2%
unpow-prod-down26.6%
pow226.6%
pow226.6%
add-sqr-sqrt69.6%
*-commutative69.6%
associate-*l*80.7%
Applied egg-rr80.7%
Final simplification69.8%
NOTE: x.im should be positive before calling this function
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.re (* x.re x.re))))
(if (<= x.im 7.6e-34)
t_0
(if (<= x.im 4.4e+100)
(* x.re (* -3.0 (* x.im x.im)))
(if (<= x.im 1.3e+126) t_0 (* x.im (* x.im (* x.re -3.0))))))))x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_re * (x_46_re * x_46_re);
double tmp;
if (x_46_im <= 7.6e-34) {
tmp = t_0;
} else if (x_46_im <= 4.4e+100) {
tmp = x_46_re * (-3.0 * (x_46_im * x_46_im));
} else if (x_46_im <= 1.3e+126) {
tmp = t_0;
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -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) :: t_0
real(8) :: tmp
t_0 = x_46re * (x_46re * x_46re)
if (x_46im <= 7.6d-34) then
tmp = t_0
else if (x_46im <= 4.4d+100) then
tmp = x_46re * ((-3.0d0) * (x_46im * x_46im))
else if (x_46im <= 1.3d+126) then
tmp = t_0
else
tmp = x_46im * (x_46im * (x_46re * (-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 t_0 = x_46_re * (x_46_re * x_46_re);
double tmp;
if (x_46_im <= 7.6e-34) {
tmp = t_0;
} else if (x_46_im <= 4.4e+100) {
tmp = x_46_re * (-3.0 * (x_46_im * x_46_im));
} else if (x_46_im <= 1.3e+126) {
tmp = t_0;
} else {
tmp = x_46_im * (x_46_im * (x_46_re * -3.0));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): t_0 = x_46_re * (x_46_re * x_46_re) tmp = 0 if x_46_im <= 7.6e-34: tmp = t_0 elif x_46_im <= 4.4e+100: tmp = x_46_re * (-3.0 * (x_46_im * x_46_im)) elif x_46_im <= 1.3e+126: tmp = t_0 else: tmp = x_46_im * (x_46_im * (x_46_re * -3.0)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) t_0 = Float64(x_46_re * Float64(x_46_re * x_46_re)) tmp = 0.0 if (x_46_im <= 7.6e-34) tmp = t_0; elseif (x_46_im <= 4.4e+100) tmp = Float64(x_46_re * Float64(-3.0 * Float64(x_46_im * x_46_im))); elseif (x_46_im <= 1.3e+126) tmp = t_0; else tmp = Float64(x_46_im * Float64(x_46_im * Float64(x_46_re * -3.0))); end return tmp end
x.im = abs(x.im) function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_re * (x_46_re * x_46_re); tmp = 0.0; if (x_46_im <= 7.6e-34) tmp = t_0; elseif (x_46_im <= 4.4e+100) tmp = x_46_re * (-3.0 * (x_46_im * x_46_im)); elseif (x_46_im <= 1.3e+126) tmp = t_0; else tmp = x_46_im * (x_46_im * (x_46_re * -3.0)); end tmp_2 = tmp; end
NOTE: x.im should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 7.6e-34], t$95$0, If[LessEqual[x$46$im, 4.4e+100], N[(x$46$re * N[(-3.0 * N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.3e+126], t$95$0, N[(x$46$im * N[(x$46$im * N[(x$46$re * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
t_0 := x.re \cdot \left(x.re \cdot x.re\right)\\
\mathbf{if}\;x.im \leq 7.6 \cdot 10^{-34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq 4.4 \cdot 10^{+100}:\\
\;\;\;\;x.re \cdot \left(-3 \cdot \left(x.im \cdot x.im\right)\right)\\
\mathbf{elif}\;x.im \leq 1.3 \cdot 10^{+126}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re \cdot -3\right)\right)\\
\end{array}
\end{array}
if x.im < 7.6000000000000002e-34 or 4.4000000000000001e100 < x.im < 1.3e126Initial program 85.2%
*-commutative85.2%
distribute-lft-out85.2%
associate-*l*85.2%
*-commutative85.2%
distribute-rgt-out--90.6%
associate--l-90.6%
associate--l-90.6%
sub-neg90.6%
associate--l+90.6%
fma-udef93.8%
neg-mul-193.8%
count-293.8%
associate-*l*93.8%
distribute-rgt-out--93.8%
associate-*r*93.7%
metadata-eval93.7%
Simplified93.7%
Taylor expanded in x.re around inf 65.9%
unpow265.9%
Simplified65.9%
if 7.6000000000000002e-34 < x.im < 4.4000000000000001e100Initial program 90.2%
*-commutative90.2%
distribute-lft-out90.2%
associate-*l*90.2%
*-commutative90.2%
distribute-rgt-out--99.5%
associate--l-99.5%
associate--l-99.5%
sub-neg99.5%
associate--l+99.5%
fma-udef99.5%
neg-mul-199.5%
count-299.5%
associate-*l*99.5%
distribute-rgt-out--99.5%
associate-*r*99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x.re around 0 65.4%
associate-*r*65.5%
*-commutative65.5%
metadata-eval65.5%
distribute-rgt-out65.5%
metadata-eval65.5%
cancel-sign-sub-inv65.5%
*-commutative65.5%
cancel-sign-sub-inv65.5%
metadata-eval65.5%
+-commutative65.5%
distribute-lft-in65.4%
Simplified65.4%
if 1.3e126 < x.im Initial program 64.9%
*-commutative64.9%
distribute-lft-out64.9%
associate-*l*64.9%
*-commutative64.9%
distribute-rgt-out--67.7%
associate--l-67.7%
associate--l-67.7%
sub-neg67.7%
associate--l+67.7%
fma-udef76.0%
neg-mul-176.0%
count-276.0%
associate-*l*76.0%
distribute-rgt-out--76.0%
associate-*r*76.0%
metadata-eval76.0%
Simplified76.0%
Taylor expanded in x.re around 0 73.2%
associate-*r*73.3%
unpow273.3%
Simplified73.3%
add-sqr-sqrt28.4%
pow228.4%
*-commutative28.4%
sqrt-prod28.4%
sqrt-prod38.7%
add-sqr-sqrt38.8%
*-commutative38.8%
Applied egg-rr38.8%
add-cbrt-cube31.1%
unpow231.1%
pow131.1%
pow-prod-up31.1%
metadata-eval31.1%
Applied egg-rr31.1%
rem-cbrt-cube38.8%
unpow-prod-down28.3%
pow228.3%
pow228.3%
add-sqr-sqrt73.3%
*-commutative73.3%
associate-*l*94.3%
Applied egg-rr94.3%
Final simplification69.8%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 6.5e+153) (* x.re (+ (* x.im (* x.im -3.0)) (* x.re x.re))) (* x.im (* x.im (* x.re -3.0)))))
x.im = abs(x.im);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= 6.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 * (x_46_im * (x_46_re * -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_46im <= 6.5d+153) then
tmp = x_46re * ((x_46im * (x_46im * (-3.0d0))) + (x_46re * x_46re))
else
tmp = x_46im * (x_46im * (x_46re * (-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_im <= 6.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 * (x_46_im * (x_46_re * -3.0));
}
return tmp;
}
x.im = abs(x.im) def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= 6.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 * (x_46_im * (x_46_re * -3.0)) return tmp
x.im = abs(x.im) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= 6.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(x_46_im * Float64(x_46_re * -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_im <= 6.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 * (x_46_im * (x_46_re * -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[LessEqual[x$46$im, 6.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[(x$46$im * N[(x$46$re * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im = |x.im|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 6.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(x.im \cdot \left(x.re \cdot -3\right)\right)\\
\end{array}
\end{array}
if x.im < 6.49999999999999972e153Initial program 85.9%
*-commutative85.9%
distribute-lft-out85.9%
associate-*l*85.9%
*-commutative85.9%
distribute-rgt-out--92.1%
associate--l-92.1%
associate--l-92.1%
sub-neg92.1%
associate--l+92.1%
fma-udef94.8%
neg-mul-194.8%
count-294.8%
associate-*l*94.8%
distribute-rgt-out--94.8%
associate-*r*94.7%
metadata-eval94.7%
Simplified94.7%
fma-udef92.1%
Applied egg-rr92.1%
if 6.49999999999999972e153 < x.im Initial program 60.0%
*-commutative60.0%
distribute-lft-out60.0%
associate-*l*60.0%
*-commutative60.0%
distribute-rgt-out--60.0%
associate--l-60.0%
associate--l-60.0%
sub-neg60.0%
associate--l+60.0%
fma-udef70.3%
neg-mul-170.3%
count-270.3%
associate-*l*70.3%
distribute-rgt-out--70.3%
associate-*r*70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in x.re around 0 70.3%
associate-*r*70.3%
unpow270.3%
Simplified70.3%
add-sqr-sqrt21.4%
pow221.4%
*-commutative21.4%
sqrt-prod21.4%
sqrt-prod34.3%
add-sqr-sqrt34.3%
*-commutative34.3%
Applied egg-rr34.3%
add-cbrt-cube27.9%
unpow227.9%
pow127.9%
pow-prod-up27.9%
metadata-eval27.9%
Applied egg-rr27.9%
rem-cbrt-cube34.3%
unpow-prod-down21.4%
pow221.4%
pow221.4%
add-sqr-sqrt70.3%
*-commutative70.3%
associate-*l*96.5%
Applied egg-rr96.5%
Final simplification92.6%
NOTE: x.im should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.im 2.3e+126) (* 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.3e+126) {
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.3d+126) 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.3e+126) {
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.3e+126: 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.3e+126) 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.3e+126) 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.3e+126], 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.3 \cdot 10^{+126}:\\
\;\;\;\;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.3000000000000001e126Initial program 86.0%
*-commutative86.0%
distribute-lft-out86.0%
associate-*l*85.9%
*-commutative85.9%
distribute-rgt-out--91.9%
associate--l-91.9%
associate--l-91.9%
sub-neg91.9%
associate--l+91.9%
fma-udef94.6%
neg-mul-194.6%
count-294.6%
associate-*l*94.6%
distribute-rgt-out--94.6%
associate-*r*94.6%
metadata-eval94.6%
Simplified94.6%
Taylor expanded in x.re around inf 61.9%
unpow261.9%
Simplified61.9%
if 2.3000000000000001e126 < x.im Initial program 64.9%
*-commutative64.9%
fma-neg64.9%
distribute-lft-neg-in64.9%
*-commutative64.9%
*-commutative64.9%
count-264.9%
distribute-lft-neg-in64.9%
metadata-eval64.9%
*-commutative64.9%
Simplified64.9%
Taylor expanded in x.re around 0 73.2%
mul-1-neg73.2%
unpow273.2%
distribute-rgt-neg-out73.2%
Simplified73.2%
fma-udef73.2%
add-sqr-sqrt0.0%
sqrt-unprod0.1%
distribute-rgt-neg-out0.1%
distribute-rgt-neg-out0.1%
sqr-neg0.1%
sqrt-unprod2.0%
add-sqr-sqrt2.0%
associate-*r*2.0%
Applied egg-rr2.0%
associate-*r*5.9%
*-commutative5.9%
distribute-lft-out67.0%
Simplified67.0%
Taylor expanded in x.re around 0 67.0%
distribute-lft1-in67.0%
metadata-eval67.0%
neg-mul-167.0%
*-commutative67.0%
associate-*r*64.2%
Simplified64.2%
Final simplification62.2%
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 83.0%
*-commutative83.0%
distribute-lft-out83.0%
associate-*l*83.0%
*-commutative83.0%
distribute-rgt-out--88.5%
associate--l-88.5%
associate--l-88.5%
sub-neg88.5%
associate--l+88.5%
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 54.1%
unpow254.1%
Simplified54.1%
Final simplification54.1%
(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 2023200
(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)))