
(FPCore (x.re x.im) :precision binary64 (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
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_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
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_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re)) 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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re); 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$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\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.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
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_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
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_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re)) 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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re); 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$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\end{array}
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -6.4e+103) (not (<= x.im 5e+86))) (* x.im (* (+ x.im x.re) (- x.re x.im))) (- (* x.re (* 3.0 (* x.im x.re))) (pow x.im 3.0))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -6.4e+103) || !(x_46_im <= 5e+86)) {
tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
} else {
tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - pow(x_46_im, 3.0);
}
return tmp;
}
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.4d+103)) .or. (.not. (x_46im <= 5d+86))) then
tmp = x_46im * ((x_46im + x_46re) * (x_46re - x_46im))
else
tmp = (x_46re * (3.0d0 * (x_46im * x_46re))) - (x_46im ** 3.0d0)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -6.4e+103) || !(x_46_im <= 5e+86)) {
tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
} else {
tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - Math.pow(x_46_im, 3.0);
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -6.4e+103) or not (x_46_im <= 5e+86): tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im)) else: tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - math.pow(x_46_im, 3.0) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -6.4e+103) || !(x_46_im <= 5e+86)) tmp = Float64(x_46_im * Float64(Float64(x_46_im + x_46_re) * Float64(x_46_re - x_46_im))); else tmp = Float64(Float64(x_46_re * Float64(3.0 * Float64(x_46_im * x_46_re))) - (x_46_im ^ 3.0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -6.4e+103) || ~((x_46_im <= 5e+86))) tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im)); else tmp = (x_46_re * (3.0 * (x_46_im * x_46_re))) - (x_46_im ^ 3.0); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -6.4e+103], N[Not[LessEqual[x$46$im, 5e+86]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re * N[(3.0 * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -6.4 \cdot 10^{+103} \lor \neg \left(x.im \leq 5 \cdot 10^{+86}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right) - {x.im}^{3}\\
\end{array}
\end{array}
if x.im < -6.39999999999999985e103 or 4.9999999999999998e86 < x.im Initial program 72.8%
*-commutative72.8%
*-commutative72.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+78.3%
distribute-lft-in78.3%
Applied egg-rr78.3%
+-commutative78.3%
add-cube-cbrt78.3%
fma-def78.3%
Applied egg-rr0.0%
Simplified100.0%
if -6.39999999999999985e103 < x.im < 4.9999999999999998e86Initial program 89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
distribute-lft-in89.4%
associate-+r+89.4%
distribute-rgt-neg-out89.4%
unsub-neg89.4%
associate-*r*99.6%
distribute-rgt-out99.7%
*-commutative99.7%
count-299.7%
distribute-lft1-in99.7%
metadata-eval99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.6%
cube-unmult99.7%
Simplified99.7%
Taylor expanded in x.re around 0 99.8%
Final simplification99.9%
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.im (* (+ x.im x.re) (- x.re x.im))))
(t_1
(+
(* x.im (- (* x.re x.re) (* x.im x.im)))
(* x.re (+ (* x.im x.re) (* x.im x.re))))))
(if (<= x.im -4e+163)
t_0
(if (<= x.im -4.4e-95)
t_1
(if (<= x.im 1.32e-106)
(* x.re (* x.im (* x.re 3.0)))
(if (<= x.im 5e+86) t_1 t_0))))))
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
double t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
double tmp;
if (x_46_im <= -4e+163) {
tmp = t_0;
} else if (x_46_im <= -4.4e-95) {
tmp = t_1;
} else if (x_46_im <= 1.32e-106) {
tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
} else if (x_46_im <= 5e+86) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
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) :: t_1
real(8) :: tmp
t_0 = x_46im * ((x_46im + x_46re) * (x_46re - x_46im))
t_1 = (x_46im * ((x_46re * x_46re) - (x_46im * x_46im))) + (x_46re * ((x_46im * x_46re) + (x_46im * x_46re)))
if (x_46im <= (-4d+163)) then
tmp = t_0
else if (x_46im <= (-4.4d-95)) then
tmp = t_1
else if (x_46im <= 1.32d-106) then
tmp = x_46re * (x_46im * (x_46re * 3.0d0))
else if (x_46im <= 5d+86) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
double t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re)));
double tmp;
if (x_46_im <= -4e+163) {
tmp = t_0;
} else if (x_46_im <= -4.4e-95) {
tmp = t_1;
} else if (x_46_im <= 1.32e-106) {
tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
} else if (x_46_im <= 5e+86) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im): t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im)) t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re))) tmp = 0 if x_46_im <= -4e+163: tmp = t_0 elif x_46_im <= -4.4e-95: tmp = t_1 elif x_46_im <= 1.32e-106: tmp = x_46_re * (x_46_im * (x_46_re * 3.0)) elif x_46_im <= 5e+86: tmp = t_1 else: tmp = t_0 return tmp
function code(x_46_re, x_46_im) t_0 = Float64(x_46_im * Float64(Float64(x_46_im + x_46_re) * Float64(x_46_re - x_46_im))) t_1 = Float64(Float64(x_46_im * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im))) + Float64(x_46_re * Float64(Float64(x_46_im * x_46_re) + Float64(x_46_im * x_46_re)))) tmp = 0.0 if (x_46_im <= -4e+163) tmp = t_0; elseif (x_46_im <= -4.4e-95) tmp = t_1; elseif (x_46_im <= 1.32e-106) tmp = Float64(x_46_re * Float64(x_46_im * Float64(x_46_re * 3.0))); elseif (x_46_im <= 5e+86) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im)); t_1 = (x_46_im * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) + (x_46_re * ((x_46_im * x_46_re) + (x_46_im * x_46_re))); tmp = 0.0; if (x_46_im <= -4e+163) tmp = t_0; elseif (x_46_im <= -4.4e-95) tmp = t_1; elseif (x_46_im <= 1.32e-106) tmp = x_46_re * (x_46_im * (x_46_re * 3.0)); elseif (x_46_im <= 5e+86) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(N[(x$46$im * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -4e+163], t$95$0, If[LessEqual[x$46$im, -4.4e-95], t$95$1, If[LessEqual[x$46$im, 1.32e-106], N[(x$46$re * N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 5e+86], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\
t_1 := x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.im \cdot x.re + x.im \cdot x.re\right)\\
\mathbf{if}\;x.im \leq -4 \cdot 10^{+163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq -4.4 \cdot 10^{-95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq 1.32 \cdot 10^{-106}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\
\mathbf{elif}\;x.im \leq 5 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x.im < -3.9999999999999998e163 or 4.9999999999999998e86 < x.im Initial program 67.9%
*-commutative67.9%
*-commutative67.9%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+75.6%
distribute-lft-in75.6%
Applied egg-rr75.6%
+-commutative75.6%
add-cube-cbrt75.6%
fma-def75.6%
Applied egg-rr0.0%
Simplified100.0%
if -3.9999999999999998e163 < x.im < -4.3999999999999998e-95 or 1.32000000000000001e-106 < x.im < 4.9999999999999998e86Initial program 99.7%
if -4.3999999999999998e-95 < x.im < 1.32000000000000001e-106Initial program 80.4%
Taylor expanded in x.re around inf 80.4%
Simplified80.4%
Taylor expanded in x.re around 0 80.3%
Simplified80.3%
add-log-exp47.3%
*-un-lft-identity47.3%
log-prod47.3%
metadata-eval47.3%
add-log-exp80.3%
associate-*l*99.6%
associate-*r*99.7%
Applied egg-rr99.7%
Final simplification99.8%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -3.4e-51) (not (<= x.im 2.05e-104))) (* x.im (* (+ x.im x.re) (- x.re x.im))) (* x.re (* x.im (* x.re 3.0)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -3.4e-51) || !(x_46_im <= 2.05e-104)) {
tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
} else {
tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
}
return tmp;
}
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.4d-51)) .or. (.not. (x_46im <= 2.05d-104))) then
tmp = x_46im * ((x_46im + x_46re) * (x_46re - x_46im))
else
tmp = x_46re * (x_46im * (x_46re * 3.0d0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -3.4e-51) || !(x_46_im <= 2.05e-104)) {
tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im));
} else {
tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -3.4e-51) or not (x_46_im <= 2.05e-104): tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im)) else: tmp = x_46_re * (x_46_im * (x_46_re * 3.0)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -3.4e-51) || !(x_46_im <= 2.05e-104)) tmp = Float64(x_46_im * Float64(Float64(x_46_im + x_46_re) * Float64(x_46_re - x_46_im))); else tmp = Float64(x_46_re * Float64(x_46_im * Float64(x_46_re * 3.0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -3.4e-51) || ~((x_46_im <= 2.05e-104))) tmp = x_46_im * ((x_46_im + x_46_re) * (x_46_re - x_46_im)); else tmp = x_46_re * (x_46_im * (x_46_re * 3.0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -3.4e-51], N[Not[LessEqual[x$46$im, 2.05e-104]], $MachinePrecision]], N[(x$46$im * N[(N[(x$46$im + x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -3.4 \cdot 10^{-51} \lor \neg \left(x.im \leq 2.05 \cdot 10^{-104}\right):\\
\;\;\;\;x.im \cdot \left(\left(x.im + x.re\right) \cdot \left(x.re - x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -3.40000000000000003e-51 or 2.04999999999999992e-104 < x.im Initial program 84.0%
*-commutative84.0%
*-commutative84.0%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+77.4%
distribute-lft-in77.4%
Applied egg-rr77.4%
+-commutative77.4%
add-cube-cbrt77.4%
fma-def77.4%
Applied egg-rr0.0%
Simplified92.6%
if -3.40000000000000003e-51 < x.im < 2.04999999999999992e-104Initial program 82.5%
Taylor expanded in x.re around inf 81.7%
Simplified81.7%
Taylor expanded in x.re around 0 81.7%
Simplified81.7%
add-log-exp46.4%
*-un-lft-identity46.4%
log-prod46.4%
metadata-eval46.4%
add-log-exp81.7%
associate-*l*98.8%
associate-*r*98.9%
Applied egg-rr98.9%
Final simplification95.0%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -1.95e+109) (not (<= x.im 1.4e-57))) (* x.im (* x.im (- x.im))) (* 3.0 (* x.re (* x.im x.re)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.95e+109) || !(x_46_im <= 1.4e-57)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = 3.0 * (x_46_re * (x_46_im * x_46_re));
}
return tmp;
}
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 <= (-1.95d+109)) .or. (.not. (x_46im <= 1.4d-57))) then
tmp = x_46im * (x_46im * -x_46im)
else
tmp = 3.0d0 * (x_46re * (x_46im * x_46re))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.95e+109) || !(x_46_im <= 1.4e-57)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = 3.0 * (x_46_re * (x_46_im * x_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -1.95e+109) or not (x_46_im <= 1.4e-57): tmp = x_46_im * (x_46_im * -x_46_im) else: tmp = 3.0 * (x_46_re * (x_46_im * x_46_re)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -1.95e+109) || !(x_46_im <= 1.4e-57)) tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); else tmp = Float64(3.0 * Float64(x_46_re * Float64(x_46_im * x_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -1.95e+109) || ~((x_46_im <= 1.4e-57))) tmp = x_46_im * (x_46_im * -x_46_im); else tmp = 3.0 * (x_46_re * (x_46_im * x_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -1.95e+109], N[Not[LessEqual[x$46$im, 1.4e-57]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.95 \cdot 10^{+109} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.re \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < -1.95000000000000008e109 or 1.4e-57 < x.im Initial program 78.4%
*-commutative78.4%
*-commutative78.4%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+78.9%
distribute-lft-in78.9%
Applied egg-rr78.9%
+-commutative78.9%
add-cube-cbrt78.9%
fma-def78.9%
Applied egg-rr0.0%
Simplified97.1%
Taylor expanded in x.re around 0 84.5%
unpow284.5%
neg-mul-184.5%
distribute-rgt-neg-in84.5%
Simplified84.5%
if -1.95000000000000008e109 < x.im < 1.4e-57Initial program 87.7%
+-commutative87.7%
*-commutative87.7%
sub-neg87.7%
distribute-lft-in86.2%
associate-+r+86.2%
distribute-rgt-neg-out86.2%
unsub-neg86.2%
associate-*r*98.2%
distribute-rgt-out98.3%
*-commutative98.3%
count-298.3%
distribute-lft1-in98.3%
metadata-eval98.3%
*-commutative98.3%
*-commutative98.3%
associate-*r*98.2%
cube-unmult98.3%
Simplified98.3%
Taylor expanded in x.re around 0 98.4%
associate-*r*98.3%
fma-neg98.3%
Applied egg-rr98.3%
Taylor expanded in x.re around inf 74.9%
unpow274.9%
*-commutative74.9%
Simplified74.9%
Taylor expanded in x.im around 0 74.9%
unpow274.9%
associate-*l*86.8%
Simplified86.8%
Final simplification85.8%
(FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -1.95e+109) (not (<= x.im 1.4e-57))) (* x.im (* x.im (- x.im))) (* x.re (* x.im (* x.re 3.0)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.95e+109) || !(x_46_im <= 1.4e-57)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
}
return tmp;
}
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 <= (-1.95d+109)) .or. (.not. (x_46im <= 1.4d-57))) then
tmp = x_46im * (x_46im * -x_46im)
else
tmp = x_46re * (x_46im * (x_46re * 3.0d0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -1.95e+109) || !(x_46_im <= 1.4e-57)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_re * (x_46_im * (x_46_re * 3.0));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -1.95e+109) or not (x_46_im <= 1.4e-57): tmp = x_46_im * (x_46_im * -x_46_im) else: tmp = x_46_re * (x_46_im * (x_46_re * 3.0)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -1.95e+109) || !(x_46_im <= 1.4e-57)) tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); else tmp = Float64(x_46_re * Float64(x_46_im * Float64(x_46_re * 3.0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -1.95e+109) || ~((x_46_im <= 1.4e-57))) tmp = x_46_im * (x_46_im * -x_46_im); else tmp = x_46_re * (x_46_im * (x_46_re * 3.0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -1.95e+109], N[Not[LessEqual[x$46$im, 1.4e-57]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$im * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.95 \cdot 10^{+109} \lor \neg \left(x.im \leq 1.4 \cdot 10^{-57}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.im \cdot \left(x.re \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -1.95000000000000008e109 or 1.4e-57 < x.im Initial program 78.4%
*-commutative78.4%
*-commutative78.4%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+78.9%
distribute-lft-in78.9%
Applied egg-rr78.9%
+-commutative78.9%
add-cube-cbrt78.9%
fma-def78.9%
Applied egg-rr0.0%
Simplified97.1%
Taylor expanded in x.re around 0 84.5%
unpow284.5%
neg-mul-184.5%
distribute-rgt-neg-in84.5%
Simplified84.5%
if -1.95000000000000008e109 < x.im < 1.4e-57Initial program 87.7%
Taylor expanded in x.re around inf 74.8%
Simplified74.8%
Taylor expanded in x.re around 0 74.8%
Simplified74.8%
add-log-exp43.4%
*-un-lft-identity43.4%
log-prod43.4%
metadata-eval43.4%
add-log-exp74.8%
associate-*l*86.8%
associate-*r*86.9%
Applied egg-rr86.9%
Final simplification85.8%
(FPCore (x.re x.im) :precision binary64 (if (<= x.im -2.5e+134) (* x.im x.re) (* 3.0 (* x.im (* x.re x.re)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= -2.5e+134) {
tmp = x_46_im * x_46_re;
} else {
tmp = 3.0 * (x_46_im * (x_46_re * x_46_re));
}
return tmp;
}
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.5d+134)) then
tmp = x_46im * x_46re
else
tmp = 3.0d0 * (x_46im * (x_46re * x_46re))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= -2.5e+134) {
tmp = x_46_im * x_46_re;
} else {
tmp = 3.0 * (x_46_im * (x_46_re * x_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= -2.5e+134: tmp = x_46_im * x_46_re else: tmp = 3.0 * (x_46_im * (x_46_re * x_46_re)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= -2.5e+134) tmp = Float64(x_46_im * x_46_re); else tmp = Float64(3.0 * Float64(x_46_im * Float64(x_46_re * x_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= -2.5e+134) tmp = x_46_im * x_46_re; else tmp = 3.0 * (x_46_im * (x_46_re * x_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, -2.5e+134], N[(x$46$im * x$46$re), $MachinePrecision], N[(3.0 * N[(x$46$im * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2.5 \cdot 10^{+134}:\\
\;\;\;\;x.im \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < -2.4999999999999999e134Initial program 64.3%
Taylor expanded in x.re around 0 64.3%
Simplified7.5%
*-commutative7.5%
*-commutative7.5%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+20.7%
distribute-lft-in20.7%
*-un-lft-identity20.7%
fma-def20.7%
Applied egg-rr20.7%
Simplified20.7%
Taylor expanded in x.im around inf 20.7%
if -2.4999999999999999e134 < x.im Initial program 87.2%
+-commutative87.2%
*-commutative87.2%
sub-neg87.2%
distribute-lft-in84.4%
associate-+r+84.4%
distribute-rgt-neg-out84.4%
unsub-neg84.4%
associate-*r*92.2%
distribute-rgt-out92.3%
*-commutative92.3%
count-292.3%
distribute-lft1-in92.3%
metadata-eval92.3%
*-commutative92.3%
*-commutative92.3%
associate-*r*92.2%
cube-unmult92.3%
Simplified92.3%
Taylor expanded in x.re around 0 92.4%
associate-*r*92.4%
fma-neg93.3%
Applied egg-rr93.3%
Taylor expanded in x.re around inf 56.3%
unpow256.3%
*-commutative56.3%
Simplified56.3%
Final simplification50.5%
(FPCore (x.re x.im) :precision binary64 (if (<= x.im -2.5e+134) (* x.im x.re) (* 3.0 (* x.re (* x.im x.re)))))
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= -2.5e+134) {
tmp = x_46_im * x_46_re;
} else {
tmp = 3.0 * (x_46_re * (x_46_im * x_46_re));
}
return tmp;
}
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.5d+134)) then
tmp = x_46im * x_46re
else
tmp = 3.0d0 * (x_46re * (x_46im * x_46re))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_im <= -2.5e+134) {
tmp = x_46_im * x_46_re;
} else {
tmp = 3.0 * (x_46_re * (x_46_im * x_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im): tmp = 0 if x_46_im <= -2.5e+134: tmp = x_46_im * x_46_re else: tmp = 3.0 * (x_46_re * (x_46_im * x_46_re)) return tmp
function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_im <= -2.5e+134) tmp = Float64(x_46_im * x_46_re); else tmp = Float64(3.0 * Float64(x_46_re * Float64(x_46_im * x_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_im <= -2.5e+134) tmp = x_46_im * x_46_re; else tmp = 3.0 * (x_46_re * (x_46_im * x_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_] := If[LessEqual[x$46$im, -2.5e+134], N[(x$46$im * x$46$re), $MachinePrecision], N[(3.0 * N[(x$46$re * N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2.5 \cdot 10^{+134}:\\
\;\;\;\;x.im \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.re \cdot \left(x.im \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < -2.4999999999999999e134Initial program 64.3%
Taylor expanded in x.re around 0 64.3%
Simplified7.5%
*-commutative7.5%
*-commutative7.5%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+20.7%
distribute-lft-in20.7%
*-un-lft-identity20.7%
fma-def20.7%
Applied egg-rr20.7%
Simplified20.7%
Taylor expanded in x.im around inf 20.7%
if -2.4999999999999999e134 < x.im Initial program 87.2%
+-commutative87.2%
*-commutative87.2%
sub-neg87.2%
distribute-lft-in84.4%
associate-+r+84.4%
distribute-rgt-neg-out84.4%
unsub-neg84.4%
associate-*r*92.2%
distribute-rgt-out92.3%
*-commutative92.3%
count-292.3%
distribute-lft1-in92.3%
metadata-eval92.3%
*-commutative92.3%
*-commutative92.3%
associate-*r*92.2%
cube-unmult92.3%
Simplified92.3%
Taylor expanded in x.re around 0 92.4%
associate-*r*92.4%
fma-neg93.3%
Applied egg-rr93.3%
Taylor expanded in x.re around inf 56.3%
unpow256.3%
*-commutative56.3%
Simplified56.3%
Taylor expanded in x.im around 0 56.3%
unpow256.3%
associate-*l*64.2%
Simplified64.2%
Final simplification57.0%
(FPCore (x.re x.im) :precision binary64 (* x.im x.re))
double code(double x_46_re, double x_46_im) {
return x_46_im * x_46_re;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = x_46im * x_46re
end function
public static double code(double x_46_re, double x_46_im) {
return x_46_im * x_46_re;
}
def code(x_46_re, x_46_im): return x_46_im * x_46_re
function code(x_46_re, x_46_im) return Float64(x_46_im * x_46_re) end
function tmp = code(x_46_re, x_46_im) tmp = x_46_im * x_46_re; end
code[x$46$re_, x$46$im_] := N[(x$46$im * x$46$re), $MachinePrecision]
\begin{array}{l}
\\
x.im \cdot x.re
\end{array}
Initial program 83.4%
Taylor expanded in x.re around 0 65.5%
Simplified21.2%
*-commutative21.2%
*-commutative21.2%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
+-inverses0.0%
flip-+10.1%
distribute-lft-in10.1%
*-un-lft-identity10.1%
fma-def10.1%
Applied egg-rr10.1%
Simplified10.1%
Taylor expanded in x.im around inf 19.4%
Final simplification19.4%
(FPCore (x.re x.im) :precision binary64 -10.0)
double code(double x_46_re, double x_46_im) {
return -10.0;
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = -10.0d0
end function
public static double code(double x_46_re, double x_46_im) {
return -10.0;
}
def code(x_46_re, x_46_im): return -10.0
function code(x_46_re, x_46_im) return -10.0 end
function tmp = code(x_46_re, x_46_im) tmp = -10.0; end
code[x$46$re_, x$46$im_] := -10.0
\begin{array}{l}
\\
-10
\end{array}
Initial program 83.4%
+-commutative83.4%
*-commutative83.4%
sub-neg83.4%
distribute-lft-in81.1%
associate-+r+81.1%
distribute-rgt-neg-out81.1%
unsub-neg81.1%
associate-*r*87.7%
distribute-rgt-out87.7%
*-commutative87.7%
count-287.7%
distribute-lft1-in87.7%
metadata-eval87.7%
*-commutative87.7%
*-commutative87.7%
associate-*r*87.6%
cube-unmult87.7%
Simplified87.7%
associate-*r*87.8%
associate-*l*87.7%
flip--26.8%
div-inv26.4%
swap-sqr26.3%
pow226.3%
metadata-eval26.3%
pow-prod-up26.2%
metadata-eval26.2%
associate-*l*26.2%
associate-*r*26.2%
fma-def26.2%
Applied egg-rr26.2%
Simplified2.9%
Final simplification2.9%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - 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_46im) * (2.0d0 * x_46re)) + ((x_46im * (x_46re - 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_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_im) * Float64(2.0 * x_46_re)) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(2.0 * x$46$re), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)
\end{array}
herbie shell --seed 2023178
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))