
(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}
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (<= x.re 7.8e+150) (* x.im (+ (- (* x.re x.re) (* x.im x.im)) (* (* x.re x.re) 2.0))) (* x.re (* x.re (* x.im 3.0)))))
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_re <= 7.8e+150) {
tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + ((x_46_re * x_46_re) * 2.0));
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
NOTE: x.re 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 <= 7.8d+150) then
tmp = x_46im * (((x_46re * x_46re) - (x_46im * x_46im)) + ((x_46re * x_46re) * 2.0d0))
else
tmp = x_46re * (x_46re * (x_46im * 3.0d0))
end if
code = tmp
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if (x_46_re <= 7.8e+150) {
tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + ((x_46_re * x_46_re) * 2.0));
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): tmp = 0 if x_46_re <= 7.8e+150: tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + ((x_46_re * x_46_re) * 2.0)) else: tmp = x_46_re * (x_46_re * (x_46_im * 3.0)) return tmp
x.re = abs(x.re) function code(x_46_re, x_46_im) tmp = 0.0 if (x_46_re <= 7.8e+150) tmp = Float64(x_46_im * Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) + Float64(Float64(x_46_re * x_46_re) * 2.0))); else tmp = Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))); end return tmp end
x.re = abs(x.re) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if (x_46_re <= 7.8e+150) tmp = x_46_im * (((x_46_re * x_46_re) - (x_46_im * x_46_im)) + ((x_46_re * x_46_re) * 2.0)); else tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); end tmp_2 = tmp; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := If[LessEqual[x$46$re, 7.8e+150], N[(x$46$im * N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$re * x$46$re), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re = |x.re|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 7.8 \cdot 10^{+150}:\\
\;\;\;\;x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(x.re \cdot x.re\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.re < 7.79999999999999981e150Initial program 80.7%
Taylor expanded in x.re around 0 80.7%
associate-*r*80.7%
*-commutative80.7%
unpow280.7%
Simplified80.7%
*-commutative80.7%
distribute-lft-out86.7%
*-commutative86.7%
Applied egg-rr86.7%
if 7.79999999999999981e150 < x.re Initial program 46.8%
Taylor expanded in x.re around 0 46.8%
associate-*r*46.8%
*-commutative46.8%
unpow246.8%
Simplified46.8%
Taylor expanded in x.re around 0 42.6%
*-commutative42.6%
fma-def42.6%
mul-1-neg42.6%
fma-neg42.6%
unpow242.6%
Simplified42.6%
Taylor expanded in x.im around 0 67.6%
unpow267.6%
unpow267.6%
distribute-lft1-in67.6%
metadata-eval67.6%
*-commutative67.6%
associate-*r*67.6%
*-commutative67.6%
associate-*l*87.4%
Simplified87.4%
Final simplification86.8%
NOTE: x.re should be positive before calling this function
(FPCore (x.re x.im)
:precision binary64
(let* ((t_0 (* x.im (- (* x.re (* x.re 2.0)) (* x.im x.im)))))
(if (<= x.im -1.8e+162)
(* (+ x.re x.im) (* x.re x.im))
(if (<= x.im -5.9e-64)
t_0
(if (<= x.im 2.6e-101)
(* x.re (* x.re (* x.im 3.0)))
(if (<= x.im 1.6e+146) t_0 (* x.im (* x.im (- x.im)))))))))x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * ((x_46_re * (x_46_re * 2.0)) - (x_46_im * x_46_im));
double tmp;
if (x_46_im <= -1.8e+162) {
tmp = (x_46_re + x_46_im) * (x_46_re * x_46_im);
} else if (x_46_im <= -5.9e-64) {
tmp = t_0;
} else if (x_46_im <= 2.6e-101) {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
} else if (x_46_im <= 1.6e+146) {
tmp = t_0;
} else {
tmp = x_46_im * (x_46_im * -x_46_im);
}
return tmp;
}
NOTE: x.re 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_46im * ((x_46re * (x_46re * 2.0d0)) - (x_46im * x_46im))
if (x_46im <= (-1.8d+162)) then
tmp = (x_46re + x_46im) * (x_46re * x_46im)
else if (x_46im <= (-5.9d-64)) then
tmp = t_0
else if (x_46im <= 2.6d-101) then
tmp = x_46re * (x_46re * (x_46im * 3.0d0))
else if (x_46im <= 1.6d+146) then
tmp = t_0
else
tmp = x_46im * (x_46im * -x_46im)
end if
code = tmp
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
double t_0 = x_46_im * ((x_46_re * (x_46_re * 2.0)) - (x_46_im * x_46_im));
double tmp;
if (x_46_im <= -1.8e+162) {
tmp = (x_46_re + x_46_im) * (x_46_re * x_46_im);
} else if (x_46_im <= -5.9e-64) {
tmp = t_0;
} else if (x_46_im <= 2.6e-101) {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
} else if (x_46_im <= 1.6e+146) {
tmp = t_0;
} else {
tmp = x_46_im * (x_46_im * -x_46_im);
}
return tmp;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): t_0 = x_46_im * ((x_46_re * (x_46_re * 2.0)) - (x_46_im * x_46_im)) tmp = 0 if x_46_im <= -1.8e+162: tmp = (x_46_re + x_46_im) * (x_46_re * x_46_im) elif x_46_im <= -5.9e-64: tmp = t_0 elif x_46_im <= 2.6e-101: tmp = x_46_re * (x_46_re * (x_46_im * 3.0)) elif x_46_im <= 1.6e+146: tmp = t_0 else: tmp = x_46_im * (x_46_im * -x_46_im) return tmp
x.re = abs(x.re) function code(x_46_re, x_46_im) t_0 = Float64(x_46_im * Float64(Float64(x_46_re * Float64(x_46_re * 2.0)) - Float64(x_46_im * x_46_im))) tmp = 0.0 if (x_46_im <= -1.8e+162) tmp = Float64(Float64(x_46_re + x_46_im) * Float64(x_46_re * x_46_im)); elseif (x_46_im <= -5.9e-64) tmp = t_0; elseif (x_46_im <= 2.6e-101) tmp = Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))); elseif (x_46_im <= 1.6e+146) tmp = t_0; else tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); end return tmp end
x.re = abs(x.re) function tmp_2 = code(x_46_re, x_46_im) t_0 = x_46_im * ((x_46_re * (x_46_re * 2.0)) - (x_46_im * x_46_im)); tmp = 0.0; if (x_46_im <= -1.8e+162) tmp = (x_46_re + x_46_im) * (x_46_re * x_46_im); elseif (x_46_im <= -5.9e-64) tmp = t_0; elseif (x_46_im <= 2.6e-101) tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); elseif (x_46_im <= 1.6e+146) tmp = t_0; else tmp = x_46_im * (x_46_im * -x_46_im); end tmp_2 = tmp; end
NOTE: x.re should be positive before calling this function
code[x$46$re_, x$46$im_] := Block[{t$95$0 = N[(x$46$im * N[(N[(x$46$re * N[(x$46$re * 2.0), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -1.8e+162], N[(N[(x$46$re + x$46$im), $MachinePrecision] * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, -5.9e-64], t$95$0, If[LessEqual[x$46$im, 2.6e-101], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.6e+146], t$95$0, N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
x.re = |x.re|\\
\\
\begin{array}{l}
t_0 := x.im \cdot \left(x.re \cdot \left(x.re \cdot 2\right) - x.im \cdot x.im\right)\\
\mathbf{if}\;x.im \leq -1.8 \cdot 10^{+162}:\\
\;\;\;\;\left(x.re + x.im\right) \cdot \left(x.re \cdot x.im\right)\\
\mathbf{elif}\;x.im \leq -5.9 \cdot 10^{-64}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq 2.6 \cdot 10^{-101}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\mathbf{elif}\;x.im \leq 1.6 \cdot 10^{+146}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\end{array}
\end{array}
if x.im < -1.79999999999999997e162Initial program 41.4%
Applied egg-rr17.2%
Taylor expanded in x.re around inf 45.0%
if -1.79999999999999997e162 < x.im < -5.89999999999999995e-64 or 2.6000000000000001e-101 < x.im < 1.6e146Initial program 98.5%
Taylor expanded in x.re around 0 98.5%
associate-*r*98.5%
*-commutative98.5%
unpow298.5%
Simplified98.5%
*-commutative98.5%
distribute-lft-out98.5%
*-commutative98.5%
Applied egg-rr98.5%
Taylor expanded in x.re around 0 90.1%
unpow290.1%
mul-1-neg90.1%
distribute-rgt-neg-in90.1%
Simplified90.1%
Taylor expanded in x.im around 0 90.1%
unpow290.1%
*-commutative90.1%
associate-*r*90.1%
unpow290.1%
mul-1-neg90.1%
sub-neg90.1%
Simplified90.1%
if -5.89999999999999995e-64 < x.im < 2.6000000000000001e-101Initial program 88.3%
Taylor expanded in x.re around 0 88.2%
associate-*r*88.3%
*-commutative88.3%
unpow288.3%
Simplified88.3%
Taylor expanded in x.re around 0 88.3%
*-commutative88.3%
fma-def88.3%
mul-1-neg88.3%
fma-neg88.3%
unpow288.3%
Simplified88.3%
Taylor expanded in x.im around 0 85.4%
unpow285.4%
unpow285.4%
distribute-lft1-in85.4%
metadata-eval85.4%
*-commutative85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*96.9%
Simplified96.9%
if 1.6e146 < x.im Initial program 39.5%
Taylor expanded in x.re around 0 39.5%
associate-*r*39.5%
*-commutative39.5%
unpow239.5%
Simplified39.5%
*-commutative39.5%
distribute-lft-out58.1%
*-commutative58.1%
Applied egg-rr58.1%
Taylor expanded in x.re around 0 76.7%
unpow276.7%
mul-1-neg76.7%
distribute-rgt-neg-in76.7%
Simplified76.7%
Final simplification85.8%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.re 1.45e+170) (and (not (<= x.re 9.2e+179)) (<= x.re 4.2e+221))) (* x.im (* x.im (- x.im))) (* x.re (* x.re x.im))))
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= 1.45e+170) || (!(x_46_re <= 9.2e+179) && (x_46_re <= 4.2e+221))) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_re * (x_46_re * x_46_im);
}
return tmp;
}
NOTE: x.re 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 <= 1.45d+170) .or. (.not. (x_46re <= 9.2d+179)) .and. (x_46re <= 4.2d+221)) then
tmp = x_46im * (x_46im * -x_46im)
else
tmp = x_46re * (x_46re * x_46im)
end if
code = tmp
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= 1.45e+170) || (!(x_46_re <= 9.2e+179) && (x_46_re <= 4.2e+221))) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_re * (x_46_re * x_46_im);
}
return tmp;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): tmp = 0 if (x_46_re <= 1.45e+170) or (not (x_46_re <= 9.2e+179) and (x_46_re <= 4.2e+221)): tmp = x_46_im * (x_46_im * -x_46_im) else: tmp = x_46_re * (x_46_re * x_46_im) return tmp
x.re = abs(x.re) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_re <= 1.45e+170) || (!(x_46_re <= 9.2e+179) && (x_46_re <= 4.2e+221))) tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); else tmp = Float64(x_46_re * Float64(x_46_re * x_46_im)); end return tmp end
x.re = abs(x.re) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_re <= 1.45e+170) || (~((x_46_re <= 9.2e+179)) && (x_46_re <= 4.2e+221))) tmp = x_46_im * (x_46_im * -x_46_im); else tmp = x_46_re * (x_46_re * x_46_im); end tmp_2 = tmp; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$re, 1.45e+170], And[N[Not[LessEqual[x$46$re, 9.2e+179]], $MachinePrecision], LessEqual[x$46$re, 4.2e+221]]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re = |x.re|\\
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 1.45 \cdot 10^{+170} \lor \neg \left(x.re \leq 9.2 \cdot 10^{+179}\right) \land x.re \leq 4.2 \cdot 10^{+221}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.im\right)\\
\end{array}
\end{array}
if x.re < 1.45e170 or 9.19999999999999976e179 < x.re < 4.20000000000000004e221Initial program 78.8%
Taylor expanded in x.re around 0 78.8%
associate-*r*78.8%
*-commutative78.8%
unpow278.8%
Simplified78.8%
*-commutative78.8%
distribute-lft-out84.6%
*-commutative84.6%
Applied egg-rr84.6%
Taylor expanded in x.re around 0 64.3%
unpow264.3%
mul-1-neg64.3%
distribute-rgt-neg-in64.3%
Simplified64.3%
if 1.45e170 < x.re < 9.19999999999999976e179 or 4.20000000000000004e221 < x.re Initial program 59.6%
Taylor expanded in x.re around inf 89.0%
unpow289.0%
Simplified89.0%
*-commutative89.0%
*-un-lft-identity89.0%
*-un-lft-identity89.0%
distribute-rgt-out89.0%
metadata-eval89.0%
Applied egg-rr89.0%
add-log-exp89.0%
+-commutative89.0%
exp-sum89.0%
*-commutative89.0%
exp-prod89.0%
*-commutative89.0%
count-289.0%
*-commutative89.0%
add-sqr-sqrt41.5%
sqrt-prod77.3%
sqr-neg77.3%
sqrt-unprod23.5%
add-sqr-sqrt53.7%
cancel-sign-sub-inv53.7%
*-commutative53.7%
+-inverses89.0%
metadata-eval89.0%
*-un-lft-identity89.0%
Applied egg-rr90.3%
Final simplification66.0%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -0.00038) (not (<= x.im 0.00025))) (* x.im (* x.im (- x.im))) (* 3.0 (* x.im (* x.re x.re)))))
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -0.00038) || !(x_46_im <= 0.00025)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = 3.0 * (x_46_im * (x_46_re * x_46_re));
}
return tmp;
}
NOTE: x.re 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 <= (-0.00038d0)) .or. (.not. (x_46im <= 0.00025d0))) then
tmp = x_46im * (x_46im * -x_46im)
else
tmp = 3.0d0 * (x_46im * (x_46re * x_46re))
end if
code = tmp
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -0.00038) || !(x_46_im <= 0.00025)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = 3.0 * (x_46_im * (x_46_re * x_46_re));
}
return tmp;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -0.00038) or not (x_46_im <= 0.00025): tmp = x_46_im * (x_46_im * -x_46_im) else: tmp = 3.0 * (x_46_im * (x_46_re * x_46_re)) return tmp
x.re = abs(x.re) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -0.00038) || !(x_46_im <= 0.00025)) tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); else tmp = Float64(3.0 * Float64(x_46_im * Float64(x_46_re * x_46_re))); end return tmp end
x.re = abs(x.re) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -0.00038) || ~((x_46_im <= 0.00025))) tmp = x_46_im * (x_46_im * -x_46_im); else tmp = 3.0 * (x_46_im * (x_46_re * x_46_re)); end tmp_2 = tmp; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -0.00038], N[Not[LessEqual[x$46$im, 0.00025]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$im * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re = |x.re|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -0.00038 \lor \neg \left(x.im \leq 0.00025\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right)\\
\end{array}
\end{array}
if x.im < -3.8000000000000002e-4 or 2.5000000000000001e-4 < x.im Initial program 62.9%
Taylor expanded in x.re around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
unpow262.9%
Simplified62.9%
*-commutative62.9%
distribute-lft-out75.0%
*-commutative75.0%
Applied egg-rr75.0%
Taylor expanded in x.re around 0 78.4%
unpow278.4%
mul-1-neg78.4%
distribute-rgt-neg-in78.4%
Simplified78.4%
if -3.8000000000000002e-4 < x.im < 2.5000000000000001e-4Initial program 89.7%
+-commutative89.7%
*-commutative89.7%
sub-neg89.7%
distribute-lft-in89.7%
associate-+r+89.7%
distribute-rgt-neg-out89.7%
unsub-neg89.7%
associate-*r*99.7%
distribute-rgt-out99.7%
*-commutative99.7%
count-299.7%
distribute-lft1-in99.7%
metadata-eval99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
cube-unmult99.7%
Simplified99.7%
Taylor expanded in x.re around inf 80.6%
*-commutative80.6%
unpow280.6%
Simplified80.6%
Final simplification79.6%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -0.00017) (not (<= x.im 3.5e-5))) (* x.im (* x.im (- x.im))) (* x.im (* x.re (* x.re 3.0)))))
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -0.00017) || !(x_46_im <= 3.5e-5)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_im * (x_46_re * (x_46_re * 3.0));
}
return tmp;
}
NOTE: x.re 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 <= (-0.00017d0)) .or. (.not. (x_46im <= 3.5d-5))) then
tmp = x_46im * (x_46im * -x_46im)
else
tmp = x_46im * (x_46re * (x_46re * 3.0d0))
end if
code = tmp
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -0.00017) || !(x_46_im <= 3.5e-5)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_im * (x_46_re * (x_46_re * 3.0));
}
return tmp;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -0.00017) or not (x_46_im <= 3.5e-5): tmp = x_46_im * (x_46_im * -x_46_im) else: tmp = x_46_im * (x_46_re * (x_46_re * 3.0)) return tmp
x.re = abs(x.re) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -0.00017) || !(x_46_im <= 3.5e-5)) tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); else tmp = Float64(x_46_im * Float64(x_46_re * Float64(x_46_re * 3.0))); end return tmp end
x.re = abs(x.re) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -0.00017) || ~((x_46_im <= 3.5e-5))) tmp = x_46_im * (x_46_im * -x_46_im); else tmp = x_46_im * (x_46_re * (x_46_re * 3.0)); end tmp_2 = tmp; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -0.00017], N[Not[LessEqual[x$46$im, 3.5e-5]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(x$46$im * N[(x$46$re * N[(x$46$re * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re = |x.re|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -0.00017 \lor \neg \left(x.im \leq 3.5 \cdot 10^{-5}\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.re \cdot \left(x.re \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -1.7e-4 or 3.4999999999999997e-5 < x.im Initial program 62.9%
Taylor expanded in x.re around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
unpow262.9%
Simplified62.9%
*-commutative62.9%
distribute-lft-out75.0%
*-commutative75.0%
Applied egg-rr75.0%
Taylor expanded in x.re around 0 78.4%
unpow278.4%
mul-1-neg78.4%
distribute-rgt-neg-in78.4%
Simplified78.4%
if -1.7e-4 < x.im < 3.4999999999999997e-5Initial program 89.7%
Taylor expanded in x.re around 0 89.6%
associate-*r*89.6%
*-commutative89.6%
unpow289.6%
Simplified89.6%
*-commutative89.6%
distribute-lft-out89.6%
*-commutative89.6%
Applied egg-rr89.6%
Taylor expanded in x.im around 0 80.5%
*-commutative80.5%
unpow280.5%
+-commutative80.5%
unpow280.5%
*-commutative80.5%
associate-*r*80.5%
*-rgt-identity80.5%
associate-*r*80.5%
distribute-lft-out80.5%
metadata-eval80.5%
associate-*l*80.6%
Simplified80.6%
Final simplification79.6%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (if (or (<= x.im -6e-7) (not (<= x.im 0.00195))) (* x.im (* x.im (- x.im))) (* x.re (* x.re (* x.im 3.0)))))
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -6e-7) || !(x_46_im <= 0.00195)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
NOTE: x.re 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 <= (-6d-7)) .or. (.not. (x_46im <= 0.00195d0))) then
tmp = x_46im * (x_46im * -x_46im)
else
tmp = x_46re * (x_46re * (x_46im * 3.0d0))
end if
code = tmp
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_im <= -6e-7) || !(x_46_im <= 0.00195)) {
tmp = x_46_im * (x_46_im * -x_46_im);
} else {
tmp = x_46_re * (x_46_re * (x_46_im * 3.0));
}
return tmp;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): tmp = 0 if (x_46_im <= -6e-7) or not (x_46_im <= 0.00195): tmp = x_46_im * (x_46_im * -x_46_im) else: tmp = x_46_re * (x_46_re * (x_46_im * 3.0)) return tmp
x.re = abs(x.re) function code(x_46_re, x_46_im) tmp = 0.0 if ((x_46_im <= -6e-7) || !(x_46_im <= 0.00195)) tmp = Float64(x_46_im * Float64(x_46_im * Float64(-x_46_im))); else tmp = Float64(x_46_re * Float64(x_46_re * Float64(x_46_im * 3.0))); end return tmp end
x.re = abs(x.re) function tmp_2 = code(x_46_re, x_46_im) tmp = 0.0; if ((x_46_im <= -6e-7) || ~((x_46_im <= 0.00195))) tmp = x_46_im * (x_46_im * -x_46_im); else tmp = x_46_re * (x_46_re * (x_46_im * 3.0)); end tmp_2 = tmp; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := If[Or[LessEqual[x$46$im, -6e-7], N[Not[LessEqual[x$46$im, 0.00195]], $MachinePrecision]], N[(x$46$im * N[(x$46$im * (-x$46$im)), $MachinePrecision]), $MachinePrecision], N[(x$46$re * N[(x$46$re * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re = |x.re|\\
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -6 \cdot 10^{-7} \lor \neg \left(x.im \leq 0.00195\right):\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(-x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.im < -5.9999999999999997e-7 or 0.0019499999999999999 < x.im Initial program 62.9%
Taylor expanded in x.re around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
unpow262.9%
Simplified62.9%
*-commutative62.9%
distribute-lft-out75.0%
*-commutative75.0%
Applied egg-rr75.0%
Taylor expanded in x.re around 0 78.4%
unpow278.4%
mul-1-neg78.4%
distribute-rgt-neg-in78.4%
Simplified78.4%
if -5.9999999999999997e-7 < x.im < 0.0019499999999999999Initial program 89.7%
Taylor expanded in x.re around 0 89.6%
associate-*r*89.6%
*-commutative89.6%
unpow289.6%
Simplified89.6%
Taylor expanded in x.re around 0 89.7%
*-commutative89.7%
fma-def89.7%
mul-1-neg89.7%
fma-neg89.7%
unpow289.7%
Simplified89.7%
Taylor expanded in x.im around 0 80.5%
unpow280.5%
unpow280.5%
distribute-lft1-in80.5%
metadata-eval80.5%
*-commutative80.5%
associate-*r*80.6%
*-commutative80.6%
associate-*l*90.6%
Simplified90.6%
Final simplification85.1%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 (* x.re (* x.re x.im)))
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_im);
}
NOTE: x.re 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_46im)
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
return x_46_re * (x_46_re * x_46_im);
}
x.re = abs(x.re) def code(x_46_re, x_46_im): return x_46_re * (x_46_re * x_46_im)
x.re = abs(x.re) function code(x_46_re, x_46_im) return Float64(x_46_re * Float64(x_46_re * x_46_im)) end
x.re = abs(x.re) function tmp = code(x_46_re, x_46_im) tmp = x_46_re * (x_46_re * x_46_im); end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := N[(x$46$re * N[(x$46$re * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re = |x.re|\\
\\
x.re \cdot \left(x.re \cdot x.im\right)
\end{array}
Initial program 77.5%
Taylor expanded in x.re around inf 54.1%
unpow254.1%
Simplified54.1%
*-commutative54.1%
*-un-lft-identity54.1%
*-un-lft-identity54.1%
distribute-rgt-out54.1%
metadata-eval54.1%
Applied egg-rr54.1%
add-log-exp36.8%
+-commutative36.8%
exp-sum36.8%
*-commutative36.8%
exp-prod36.4%
*-commutative36.4%
count-236.4%
*-commutative36.4%
add-sqr-sqrt27.1%
sqrt-prod33.7%
sqr-neg33.7%
sqrt-unprod24.2%
add-sqr-sqrt29.7%
cancel-sign-sub-inv29.7%
*-commutative29.7%
+-inverses36.7%
metadata-eval36.7%
*-un-lft-identity36.7%
Applied egg-rr39.6%
Final simplification39.6%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 -3.0)
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
return -3.0;
}
NOTE: x.re 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 = -3.0d0
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
return -3.0;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): return -3.0
x.re = abs(x.re) function code(x_46_re, x_46_im) return -3.0 end
x.re = abs(x.re) function tmp = code(x_46_re, x_46_im) tmp = -3.0; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := -3.0
\begin{array}{l}
x.re = |x.re|\\
\\
-3
\end{array}
Initial program 77.5%
+-commutative77.5%
*-commutative77.5%
sub-neg77.5%
distribute-lft-in75.2%
associate-+r+75.2%
distribute-rgt-neg-out75.2%
unsub-neg75.2%
associate-*r*80.7%
distribute-rgt-out80.7%
*-commutative80.7%
count-280.7%
distribute-lft1-in80.7%
metadata-eval80.7%
*-commutative80.7%
*-commutative80.7%
associate-*r*80.7%
cube-unmult80.7%
Simplified80.7%
Taylor expanded in x.re around 0 80.7%
associate-*r*80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in x.re around 0 60.1%
Simplified2.7%
Final simplification2.7%
NOTE: x.re should be positive before calling this function (FPCore (x.re x.im) :precision binary64 0.125)
x.re = abs(x.re);
double code(double x_46_re, double x_46_im) {
return 0.125;
}
NOTE: x.re 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 = 0.125d0
end function
x.re = Math.abs(x.re);
public static double code(double x_46_re, double x_46_im) {
return 0.125;
}
x.re = abs(x.re) def code(x_46_re, x_46_im): return 0.125
x.re = abs(x.re) function code(x_46_re, x_46_im) return 0.125 end
x.re = abs(x.re) function tmp = code(x_46_re, x_46_im) tmp = 0.125; end
NOTE: x.re should be positive before calling this function code[x$46$re_, x$46$im_] := 0.125
\begin{array}{l}
x.re = |x.re|\\
\\
0.125
\end{array}
Initial program 77.5%
+-commutative77.5%
*-commutative77.5%
sub-neg77.5%
distribute-lft-in75.2%
associate-+r+75.2%
distribute-rgt-neg-out75.2%
unsub-neg75.2%
associate-*r*80.7%
distribute-rgt-out80.7%
*-commutative80.7%
count-280.7%
distribute-lft1-in80.7%
metadata-eval80.7%
*-commutative80.7%
*-commutative80.7%
associate-*r*80.7%
cube-unmult80.7%
Simplified80.7%
Taylor expanded in x.re around 0 80.7%
associate-*r*80.7%
*-commutative80.7%
Simplified80.7%
sub-neg80.7%
flip3-+11.9%
*-commutative11.9%
Applied egg-rr6.5%
Simplified2.8%
Final simplification2.8%
(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 2023238
(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)))