
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (cos re) (fma 0.5 (exp im) (/ 0.5 (exp im)))))
double code(double re, double im) {
return cos(re) * fma(0.5, exp(im), (0.5 / exp(im)));
}
function code(re, im) return Float64(cos(re) * fma(0.5, exp(im), Float64(0.5 / exp(im)))) end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[Exp[im], $MachinePrecision] + N[(0.5 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \mathsf{fma}\left(0.5, e^{im}, \frac{0.5}{e^{im}}\right)
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im -365.0)
(* (cos re) (log1p (expm1 (* im (* 0.5 im)))))
(if (<= im 1.3)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(* (cos re) (+ (* 0.5 (exp im)) 0.001953125)))))
double code(double re, double im) {
double tmp;
if (im <= -365.0) {
tmp = cos(re) * log1p(expm1((im * (0.5 * im))));
} else if (im <= 1.3) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = cos(re) * ((0.5 * exp(im)) + 0.001953125);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= -365.0) {
tmp = Math.cos(re) * Math.log1p(Math.expm1((im * (0.5 * im))));
} else if (im <= 1.3) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = Math.cos(re) * ((0.5 * Math.exp(im)) + 0.001953125);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -365.0: tmp = math.cos(re) * math.log1p(math.expm1((im * (0.5 * im)))) elif im <= 1.3: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) else: tmp = math.cos(re) * ((0.5 * math.exp(im)) + 0.001953125) return tmp
function code(re, im) tmp = 0.0 if (im <= -365.0) tmp = Float64(cos(re) * log1p(expm1(Float64(im * Float64(0.5 * im))))); elseif (im <= 1.3) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); else tmp = Float64(cos(re) * Float64(Float64(0.5 * exp(im)) + 0.001953125)); end return tmp end
code[re_, im_] := If[LessEqual[im, -365.0], N[(N[Cos[re], $MachinePrecision] * N[Log[1 + N[(Exp[N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.3], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -365:\\
\;\;\;\;\cos re \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(0.5 \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq 1.3:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(0.5 \cdot e^{im} + 0.001953125\right)\\
\end{array}
\end{array}
if im < -365Initial program 100.0%
Taylor expanded in im around 0 44.4%
unpow244.4%
Simplified44.4%
Taylor expanded in im around inf 44.4%
unpow244.4%
associate-*r*44.4%
*-commutative44.4%
associate-*r*44.4%
Simplified44.4%
log1p-expm1-u100.0%
*-commutative100.0%
associate-*l*100.0%
Applied egg-rr100.0%
if -365 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
if 1.30000000000000004 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im -1.5e+85)
(* 0.041666666666666664 (* (cos re) (pow im 4.0)))
(if (<= im -430.0)
(log1p (expm1 (* 0.041666666666666664 (pow im 4.0))))
(if (<= im 1.3)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(* (cos re) (+ (* 0.5 (exp im)) 0.001953125))))))
double code(double re, double im) {
double tmp;
if (im <= -1.5e+85) {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
} else if (im <= -430.0) {
tmp = log1p(expm1((0.041666666666666664 * pow(im, 4.0))));
} else if (im <= 1.3) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = cos(re) * ((0.5 * exp(im)) + 0.001953125);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= -1.5e+85) {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
} else if (im <= -430.0) {
tmp = Math.log1p(Math.expm1((0.041666666666666664 * Math.pow(im, 4.0))));
} else if (im <= 1.3) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = Math.cos(re) * ((0.5 * Math.exp(im)) + 0.001953125);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.5e+85: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) elif im <= -430.0: tmp = math.log1p(math.expm1((0.041666666666666664 * math.pow(im, 4.0)))) elif im <= 1.3: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) else: tmp = math.cos(re) * ((0.5 * math.exp(im)) + 0.001953125) return tmp
function code(re, im) tmp = 0.0 if (im <= -1.5e+85) tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); elseif (im <= -430.0) tmp = log1p(expm1(Float64(0.041666666666666664 * (im ^ 4.0)))); elseif (im <= 1.3) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); else tmp = Float64(cos(re) * Float64(Float64(0.5 * exp(im)) + 0.001953125)); end return tmp end
code[re_, im_] := If[LessEqual[im, -1.5e+85], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -430.0], N[Log[1 + N[(Exp[N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.3], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.5 \cdot 10^{+85}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq -430:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.041666666666666664 \cdot {im}^{4}\right)\right)\\
\mathbf{elif}\;im \leq 1.3:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(0.5 \cdot e^{im} + 0.001953125\right)\\
\end{array}
\end{array}
if im < -1.5e85Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.5e85 < im < -430Initial program 100.0%
Taylor expanded in im around 0 21.9%
unpow221.9%
*-commutative21.9%
Simplified21.9%
Taylor expanded in im around inf 21.9%
Taylor expanded in re around 0 21.3%
*-commutative21.3%
Simplified21.3%
log1p-expm1-u82.4%
Applied egg-rr82.4%
if -430 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
if 1.30000000000000004 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification98.8%
(FPCore (re im) :precision binary64 (* (* (cos re) 0.5) (+ (exp im) (exp (- im)))))
double code(double re, double im) {
return (cos(re) * 0.5) * (exp(im) + exp(-im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (cos(re) * 0.5d0) * (exp(im) + exp(-im))
end function
public static double code(double re, double im) {
return (Math.cos(re) * 0.5) * (Math.exp(im) + Math.exp(-im));
}
def code(re, im): return (math.cos(re) * 0.5) * (math.exp(im) + math.exp(-im))
function code(re, im) return Float64(Float64(cos(re) * 0.5) * Float64(exp(im) + exp(Float64(-im)))) end
function tmp = code(re, im) tmp = (cos(re) * 0.5) * (exp(im) + exp(-im)); end
code[re_, im_] := N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[Exp[im], $MachinePrecision] + N[Exp[(-im)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\cos re \cdot 0.5\right) \cdot \left(e^{im} + e^{-im}\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im -1.5e+85)
(* 0.041666666666666664 (* (cos re) (pow im 4.0)))
(if (<= im -4.9e+25)
(*
0.5
(+ 2.0 (+ (* im im) (cbrt (* (pow im 12.0) 0.0005787037037037037)))))
(if (<= im 1.92)
(*
(* (cos re) 0.5)
(+ 2.0 (+ (* im im) (* (pow im 4.0) 0.08333333333333333))))
(* (cos re) (+ (* 0.5 (exp im)) 0.001953125))))))
double code(double re, double im) {
double tmp;
if (im <= -1.5e+85) {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
} else if (im <= -4.9e+25) {
tmp = 0.5 * (2.0 + ((im * im) + cbrt((pow(im, 12.0) * 0.0005787037037037037))));
} else if (im <= 1.92) {
tmp = (cos(re) * 0.5) * (2.0 + ((im * im) + (pow(im, 4.0) * 0.08333333333333333)));
} else {
tmp = cos(re) * ((0.5 * exp(im)) + 0.001953125);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= -1.5e+85) {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
} else if (im <= -4.9e+25) {
tmp = 0.5 * (2.0 + ((im * im) + Math.cbrt((Math.pow(im, 12.0) * 0.0005787037037037037))));
} else if (im <= 1.92) {
tmp = (Math.cos(re) * 0.5) * (2.0 + ((im * im) + (Math.pow(im, 4.0) * 0.08333333333333333)));
} else {
tmp = Math.cos(re) * ((0.5 * Math.exp(im)) + 0.001953125);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= -1.5e+85) tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); elseif (im <= -4.9e+25) tmp = Float64(0.5 * Float64(2.0 + Float64(Float64(im * im) + cbrt(Float64((im ^ 12.0) * 0.0005787037037037037))))); elseif (im <= 1.92) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(Float64(im * im) + Float64((im ^ 4.0) * 0.08333333333333333)))); else tmp = Float64(cos(re) * Float64(Float64(0.5 * exp(im)) + 0.001953125)); end return tmp end
code[re_, im_] := If[LessEqual[im, -1.5e+85], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -4.9e+25], N[(0.5 * N[(2.0 + N[(N[(im * im), $MachinePrecision] + N[Power[N[(N[Power[im, 12.0], $MachinePrecision] * 0.0005787037037037037), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.92], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(N[(im * im), $MachinePrecision] + N[(N[Power[im, 4.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.5 \cdot 10^{+85}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq -4.9 \cdot 10^{+25}:\\
\;\;\;\;0.5 \cdot \left(2 + \left(im \cdot im + \sqrt[3]{{im}^{12} \cdot 0.0005787037037037037}\right)\right)\\
\mathbf{elif}\;im \leq 1.92:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(0.5 \cdot e^{im} + 0.001953125\right)\\
\end{array}
\end{array}
if im < -1.5e85Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.5e85 < im < -4.9000000000000001e25Initial program 100.0%
Taylor expanded in im around 0 31.9%
unpow231.9%
*-commutative31.9%
Simplified31.9%
Taylor expanded in re around 0 31.5%
*-un-lft-identity31.5%
*-commutative31.5%
unpow231.5%
Applied egg-rr31.5%
add-cbrt-cube90.9%
pow1/390.9%
pow390.9%
*-commutative90.9%
unpow-prod-down90.9%
metadata-eval90.9%
Applied egg-rr90.9%
unpow1/390.9%
metadata-eval90.9%
pow-sqr90.9%
unpow290.9%
unpow290.9%
cube-prod90.9%
cube-prod90.9%
pow-sqr90.9%
metadata-eval90.9%
cube-prod90.9%
pow-sqr90.9%
metadata-eval90.9%
pow-sqr90.9%
metadata-eval90.9%
Simplified90.9%
if -4.9000000000000001e25 < im < 1.9199999999999999Initial program 100.0%
Taylor expanded in im around 0 95.5%
unpow295.5%
*-commutative95.5%
Simplified95.5%
if 1.9199999999999999 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification97.3%
(FPCore (re im)
:precision binary64
(if (<= im -1e+86)
(* 0.041666666666666664 (* (cos re) (pow im 4.0)))
(if (<= im -4.9e+25)
(*
0.5
(+ 2.0 (+ (* im im) (cbrt (* (pow im 12.0) 0.0005787037037037037)))))
(if (<= im 1.3)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(* (cos re) (+ (* 0.5 (exp im)) 0.001953125))))))
double code(double re, double im) {
double tmp;
if (im <= -1e+86) {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
} else if (im <= -4.9e+25) {
tmp = 0.5 * (2.0 + ((im * im) + cbrt((pow(im, 12.0) * 0.0005787037037037037))));
} else if (im <= 1.3) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = cos(re) * ((0.5 * exp(im)) + 0.001953125);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= -1e+86) {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
} else if (im <= -4.9e+25) {
tmp = 0.5 * (2.0 + ((im * im) + Math.cbrt((Math.pow(im, 12.0) * 0.0005787037037037037))));
} else if (im <= 1.3) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = Math.cos(re) * ((0.5 * Math.exp(im)) + 0.001953125);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (im <= -1e+86) tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); elseif (im <= -4.9e+25) tmp = Float64(0.5 * Float64(2.0 + Float64(Float64(im * im) + cbrt(Float64((im ^ 12.0) * 0.0005787037037037037))))); elseif (im <= 1.3) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); else tmp = Float64(cos(re) * Float64(Float64(0.5 * exp(im)) + 0.001953125)); end return tmp end
code[re_, im_] := If[LessEqual[im, -1e+86], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -4.9e+25], N[(0.5 * N[(2.0 + N[(N[(im * im), $MachinePrecision] + N[Power[N[(N[Power[im, 12.0], $MachinePrecision] * 0.0005787037037037037), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.3], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1 \cdot 10^{+86}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq -4.9 \cdot 10^{+25}:\\
\;\;\;\;0.5 \cdot \left(2 + \left(im \cdot im + \sqrt[3]{{im}^{12} \cdot 0.0005787037037037037}\right)\right)\\
\mathbf{elif}\;im \leq 1.3:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(0.5 \cdot e^{im} + 0.001953125\right)\\
\end{array}
\end{array}
if im < -1e86Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1e86 < im < -4.9000000000000001e25Initial program 100.0%
Taylor expanded in im around 0 31.9%
unpow231.9%
*-commutative31.9%
Simplified31.9%
Taylor expanded in re around 0 31.5%
*-un-lft-identity31.5%
*-commutative31.5%
unpow231.5%
Applied egg-rr31.5%
add-cbrt-cube90.9%
pow1/390.9%
pow390.9%
*-commutative90.9%
unpow-prod-down90.9%
metadata-eval90.9%
Applied egg-rr90.9%
unpow1/390.9%
metadata-eval90.9%
pow-sqr90.9%
unpow290.9%
unpow290.9%
cube-prod90.9%
cube-prod90.9%
pow-sqr90.9%
metadata-eval90.9%
cube-prod90.9%
pow-sqr90.9%
metadata-eval90.9%
pow-sqr90.9%
metadata-eval90.9%
Simplified90.9%
if -4.9000000000000001e25 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 95.5%
unpow295.5%
Simplified95.5%
if 1.30000000000000004 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification97.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.041666666666666664 (* (cos re) (pow im 4.0)))))
(if (<= im -2e+88)
t_0
(if (<= im -1.46e+41)
(sqrt (* (pow im 8.0) 0.001736111111111111))
(if (<= im 2.2)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1.16e+77) (+ (* 0.5 (exp im)) 0.001953125) t_0))))))
double code(double re, double im) {
double t_0 = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
double tmp;
if (im <= -2e+88) {
tmp = t_0;
} else if (im <= -1.46e+41) {
tmp = sqrt((pow(im, 8.0) * 0.001736111111111111));
} else if (im <= 2.2) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.16e+77) {
tmp = (0.5 * exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
if (im <= (-2d+88)) then
tmp = t_0
else if (im <= (-1.46d+41)) then
tmp = sqrt(((im ** 8.0d0) * 0.001736111111111111d0))
else if (im <= 2.2d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1.16d+77) then
tmp = (0.5d0 * exp(im)) + 0.001953125d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
double tmp;
if (im <= -2e+88) {
tmp = t_0;
} else if (im <= -1.46e+41) {
tmp = Math.sqrt((Math.pow(im, 8.0) * 0.001736111111111111));
} else if (im <= 2.2) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.16e+77) {
tmp = (0.5 * Math.exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) tmp = 0 if im <= -2e+88: tmp = t_0 elif im <= -1.46e+41: tmp = math.sqrt((math.pow(im, 8.0) * 0.001736111111111111)) elif im <= 2.2: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1.16e+77: tmp = (0.5 * math.exp(im)) + 0.001953125 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))) tmp = 0.0 if (im <= -2e+88) tmp = t_0; elseif (im <= -1.46e+41) tmp = sqrt(Float64((im ^ 8.0) * 0.001736111111111111)); elseif (im <= 2.2) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.16e+77) tmp = Float64(Float64(0.5 * exp(im)) + 0.001953125); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); tmp = 0.0; if (im <= -2e+88) tmp = t_0; elseif (im <= -1.46e+41) tmp = sqrt(((im ^ 8.0) * 0.001736111111111111)); elseif (im <= 2.2) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1.16e+77) tmp = (0.5 * exp(im)) + 0.001953125; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+88], t$95$0, If[LessEqual[im, -1.46e+41], N[Sqrt[N[(N[Power[im, 8.0], $MachinePrecision] * 0.001736111111111111), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 2.2], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.16e+77], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{if}\;im \leq -2 \cdot 10^{+88}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{{im}^{8} \cdot 0.001736111111111111}\\
\mathbf{elif}\;im \leq 2.2:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot e^{im} + 0.001953125\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.99999999999999992e88 or 1.1600000000000001e77 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.99999999999999992e88 < im < -1.4600000000000001e41Initial program 100.0%
Taylor expanded in im around 0 38.0%
unpow238.0%
*-commutative38.0%
Simplified38.0%
Taylor expanded in im around inf 38.0%
Taylor expanded in re around 0 38.0%
*-commutative38.0%
Simplified38.0%
add-sqr-sqrt38.0%
sqrt-unprod100.0%
swap-sqr100.0%
pow-prod-up100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if -1.4600000000000001e41 < im < 2.2000000000000002Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
if 2.2000000000000002 < im < 1.1600000000000001e77Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 92.3%
Final simplification96.2%
(FPCore (re im)
:precision binary64
(if (<= im -1.5e+85)
(* 0.041666666666666664 (* (cos re) (pow im 4.0)))
(if (<= im -1.46e+41)
(sqrt (* (pow im 8.0) 0.001736111111111111))
(if (<= im 1.3)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(* (cos re) (+ (* 0.5 (exp im)) 0.001953125))))))
double code(double re, double im) {
double tmp;
if (im <= -1.5e+85) {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
} else if (im <= -1.46e+41) {
tmp = sqrt((pow(im, 8.0) * 0.001736111111111111));
} else if (im <= 1.3) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = cos(re) * ((0.5 * exp(im)) + 0.001953125);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-1.5d+85)) then
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
else if (im <= (-1.46d+41)) then
tmp = sqrt(((im ** 8.0d0) * 0.001736111111111111d0))
else if (im <= 1.3d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else
tmp = cos(re) * ((0.5d0 * exp(im)) + 0.001953125d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.5e+85) {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
} else if (im <= -1.46e+41) {
tmp = Math.sqrt((Math.pow(im, 8.0) * 0.001736111111111111));
} else if (im <= 1.3) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = Math.cos(re) * ((0.5 * Math.exp(im)) + 0.001953125);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.5e+85: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) elif im <= -1.46e+41: tmp = math.sqrt((math.pow(im, 8.0) * 0.001736111111111111)) elif im <= 1.3: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) else: tmp = math.cos(re) * ((0.5 * math.exp(im)) + 0.001953125) return tmp
function code(re, im) tmp = 0.0 if (im <= -1.5e+85) tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); elseif (im <= -1.46e+41) tmp = sqrt(Float64((im ^ 8.0) * 0.001736111111111111)); elseif (im <= 1.3) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); else tmp = Float64(cos(re) * Float64(Float64(0.5 * exp(im)) + 0.001953125)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.5e+85) tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); elseif (im <= -1.46e+41) tmp = sqrt(((im ^ 8.0) * 0.001736111111111111)); elseif (im <= 1.3) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); else tmp = cos(re) * ((0.5 * exp(im)) + 0.001953125); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.5e+85], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -1.46e+41], N[Sqrt[N[(N[Power[im, 8.0], $MachinePrecision] * 0.001736111111111111), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.3], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.5 \cdot 10^{+85}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{{im}^{8} \cdot 0.001736111111111111}\\
\mathbf{elif}\;im \leq 1.3:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(0.5 \cdot e^{im} + 0.001953125\right)\\
\end{array}
\end{array}
if im < -1.5e85Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.5e85 < im < -1.4600000000000001e41Initial program 100.0%
Taylor expanded in im around 0 38.0%
unpow238.0%
*-commutative38.0%
Simplified38.0%
Taylor expanded in im around inf 38.0%
Taylor expanded in re around 0 38.0%
*-commutative38.0%
Simplified38.0%
add-sqr-sqrt38.0%
sqrt-unprod100.0%
swap-sqr100.0%
pow-prod-up100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
if -1.4600000000000001e41 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
if 1.30000000000000004 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
fma-udef100.0%
Applied egg-rr100.0%
Final simplification97.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* 0.5 (* im im)))))
(if (<= im -5e+167)
t_0
(if (<= im -1.46e+41)
(sqrt (* (pow im 8.0) 0.001736111111111111))
(if (<= im 2.35)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1.35e+154) (+ (* 0.5 (exp im)) 0.001953125) t_0))))))
double code(double re, double im) {
double t_0 = cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -5e+167) {
tmp = t_0;
} else if (im <= -1.46e+41) {
tmp = sqrt((pow(im, 8.0) * 0.001736111111111111));
} else if (im <= 2.35) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.35e+154) {
tmp = (0.5 * exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (0.5d0 * (im * im))
if (im <= (-5d+167)) then
tmp = t_0
else if (im <= (-1.46d+41)) then
tmp = sqrt(((im ** 8.0d0) * 0.001736111111111111d0))
else if (im <= 2.35d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1.35d+154) then
tmp = (0.5d0 * exp(im)) + 0.001953125d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -5e+167) {
tmp = t_0;
} else if (im <= -1.46e+41) {
tmp = Math.sqrt((Math.pow(im, 8.0) * 0.001736111111111111));
} else if (im <= 2.35) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.35e+154) {
tmp = (0.5 * Math.exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (0.5 * (im * im)) tmp = 0 if im <= -5e+167: tmp = t_0 elif im <= -1.46e+41: tmp = math.sqrt((math.pow(im, 8.0) * 0.001736111111111111)) elif im <= 2.35: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1.35e+154: tmp = (0.5 * math.exp(im)) + 0.001953125 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(0.5 * Float64(im * im))) tmp = 0.0 if (im <= -5e+167) tmp = t_0; elseif (im <= -1.46e+41) tmp = sqrt(Float64((im ^ 8.0) * 0.001736111111111111)); elseif (im <= 2.35) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.35e+154) tmp = Float64(Float64(0.5 * exp(im)) + 0.001953125); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (0.5 * (im * im)); tmp = 0.0; if (im <= -5e+167) tmp = t_0; elseif (im <= -1.46e+41) tmp = sqrt(((im ^ 8.0) * 0.001736111111111111)); elseif (im <= 2.35) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1.35e+154) tmp = (0.5 * exp(im)) + 0.001953125; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5e+167], t$95$0, If[LessEqual[im, -1.46e+41], N[Sqrt[N[(N[Power[im, 8.0], $MachinePrecision] * 0.001736111111111111), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 2.35], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{if}\;im \leq -5 \cdot 10^{+167}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{{im}^{8} \cdot 0.001736111111111111}\\
\mathbf{elif}\;im \leq 2.35:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + 0.001953125\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.9999999999999997e167 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -4.9999999999999997e167 < im < -1.4600000000000001e41Initial program 100.0%
Taylor expanded in im around 0 75.7%
unpow275.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in im around inf 75.7%
Taylor expanded in re around 0 62.7%
*-commutative62.7%
Simplified62.7%
add-sqr-sqrt62.7%
sqrt-unprod87.0%
swap-sqr87.0%
pow-prod-up87.0%
metadata-eval87.0%
metadata-eval87.0%
Applied egg-rr87.0%
if -1.4600000000000001e41 < im < 2.35000000000000009Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
if 2.35000000000000009 < im < 1.35000000000000003e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 93.2%
Final simplification94.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* 0.5 (* im im)))))
(if (<= im -1.6e+166)
t_0
(if (<= im -1.46e+41)
(* 0.041666666666666664 (pow im 4.0))
(if (<= im 1.3)
(cos re)
(if (<= im 1.35e+154) (+ (* 0.5 (exp im)) 0.001953125) t_0))))))
double code(double re, double im) {
double t_0 = cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -1.6e+166) {
tmp = t_0;
} else if (im <= -1.46e+41) {
tmp = 0.041666666666666664 * pow(im, 4.0);
} else if (im <= 1.3) {
tmp = cos(re);
} else if (im <= 1.35e+154) {
tmp = (0.5 * exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (0.5d0 * (im * im))
if (im <= (-1.6d+166)) then
tmp = t_0
else if (im <= (-1.46d+41)) then
tmp = 0.041666666666666664d0 * (im ** 4.0d0)
else if (im <= 1.3d0) then
tmp = cos(re)
else if (im <= 1.35d+154) then
tmp = (0.5d0 * exp(im)) + 0.001953125d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -1.6e+166) {
tmp = t_0;
} else if (im <= -1.46e+41) {
tmp = 0.041666666666666664 * Math.pow(im, 4.0);
} else if (im <= 1.3) {
tmp = Math.cos(re);
} else if (im <= 1.35e+154) {
tmp = (0.5 * Math.exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (0.5 * (im * im)) tmp = 0 if im <= -1.6e+166: tmp = t_0 elif im <= -1.46e+41: tmp = 0.041666666666666664 * math.pow(im, 4.0) elif im <= 1.3: tmp = math.cos(re) elif im <= 1.35e+154: tmp = (0.5 * math.exp(im)) + 0.001953125 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(0.5 * Float64(im * im))) tmp = 0.0 if (im <= -1.6e+166) tmp = t_0; elseif (im <= -1.46e+41) tmp = Float64(0.041666666666666664 * (im ^ 4.0)); elseif (im <= 1.3) tmp = cos(re); elseif (im <= 1.35e+154) tmp = Float64(Float64(0.5 * exp(im)) + 0.001953125); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (0.5 * (im * im)); tmp = 0.0; if (im <= -1.6e+166) tmp = t_0; elseif (im <= -1.46e+41) tmp = 0.041666666666666664 * (im ^ 4.0); elseif (im <= 1.3) tmp = cos(re); elseif (im <= 1.35e+154) tmp = (0.5 * exp(im)) + 0.001953125; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.6e+166], t$95$0, If[LessEqual[im, -1.46e+41], N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.3], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{if}\;im \leq -1.6 \cdot 10^{+166}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;0.041666666666666664 \cdot {im}^{4}\\
\mathbf{elif}\;im \leq 1.3:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + 0.001953125\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.59999999999999984e166 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -1.59999999999999984e166 < im < -1.4600000000000001e41Initial program 100.0%
Taylor expanded in im around 0 75.7%
unpow275.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in im around inf 75.7%
Taylor expanded in re around 0 62.7%
*-commutative62.7%
Simplified62.7%
if -1.4600000000000001e41 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
Taylor expanded in im around 0 93.8%
if 1.30000000000000004 < im < 1.35000000000000003e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 93.2%
Final simplification92.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* 0.5 (* im im)))))
(if (<= im -1.6e+166)
t_0
(if (<= im -1.85e+42)
(* 0.041666666666666664 (pow im 4.0))
(if (<= im 2.1)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1.35e+154) (+ (* 0.5 (exp im)) 0.001953125) t_0))))))
double code(double re, double im) {
double t_0 = cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -1.6e+166) {
tmp = t_0;
} else if (im <= -1.85e+42) {
tmp = 0.041666666666666664 * pow(im, 4.0);
} else if (im <= 2.1) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.35e+154) {
tmp = (0.5 * exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (0.5d0 * (im * im))
if (im <= (-1.6d+166)) then
tmp = t_0
else if (im <= (-1.85d+42)) then
tmp = 0.041666666666666664d0 * (im ** 4.0d0)
else if (im <= 2.1d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1.35d+154) then
tmp = (0.5d0 * exp(im)) + 0.001953125d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -1.6e+166) {
tmp = t_0;
} else if (im <= -1.85e+42) {
tmp = 0.041666666666666664 * Math.pow(im, 4.0);
} else if (im <= 2.1) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.35e+154) {
tmp = (0.5 * Math.exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (0.5 * (im * im)) tmp = 0 if im <= -1.6e+166: tmp = t_0 elif im <= -1.85e+42: tmp = 0.041666666666666664 * math.pow(im, 4.0) elif im <= 2.1: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1.35e+154: tmp = (0.5 * math.exp(im)) + 0.001953125 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(0.5 * Float64(im * im))) tmp = 0.0 if (im <= -1.6e+166) tmp = t_0; elseif (im <= -1.85e+42) tmp = Float64(0.041666666666666664 * (im ^ 4.0)); elseif (im <= 2.1) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.35e+154) tmp = Float64(Float64(0.5 * exp(im)) + 0.001953125); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (0.5 * (im * im)); tmp = 0.0; if (im <= -1.6e+166) tmp = t_0; elseif (im <= -1.85e+42) tmp = 0.041666666666666664 * (im ^ 4.0); elseif (im <= 2.1) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1.35e+154) tmp = (0.5 * exp(im)) + 0.001953125; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.6e+166], t$95$0, If[LessEqual[im, -1.85e+42], N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.1], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{if}\;im \leq -1.6 \cdot 10^{+166}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.85 \cdot 10^{+42}:\\
\;\;\;\;0.041666666666666664 \cdot {im}^{4}\\
\mathbf{elif}\;im \leq 2.1:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + 0.001953125\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.59999999999999984e166 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -1.59999999999999984e166 < im < -1.84999999999999998e42Initial program 100.0%
Taylor expanded in im around 0 75.7%
unpow275.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in im around inf 75.7%
Taylor expanded in re around 0 62.7%
*-commutative62.7%
Simplified62.7%
if -1.84999999999999998e42 < im < 2.10000000000000009Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
if 2.10000000000000009 < im < 1.35000000000000003e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 93.2%
Final simplification92.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* 0.5 (* im im)))))
(if (<= im -1.32e+154)
t_0
(if (<= im -750.0)
(*
(pow im 4.0)
(+ 0.041666666666666664 (* -0.020833333333333332 (* re re))))
(if (<= im 1.82)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1.35e+154) (+ (* 0.5 (exp im)) 0.001953125) t_0))))))
double code(double re, double im) {
double t_0 = cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -1.32e+154) {
tmp = t_0;
} else if (im <= -750.0) {
tmp = pow(im, 4.0) * (0.041666666666666664 + (-0.020833333333333332 * (re * re)));
} else if (im <= 1.82) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.35e+154) {
tmp = (0.5 * exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (0.5d0 * (im * im))
if (im <= (-1.32d+154)) then
tmp = t_0
else if (im <= (-750.0d0)) then
tmp = (im ** 4.0d0) * (0.041666666666666664d0 + ((-0.020833333333333332d0) * (re * re)))
else if (im <= 1.82d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1.35d+154) then
tmp = (0.5d0 * exp(im)) + 0.001953125d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (0.5 * (im * im));
double tmp;
if (im <= -1.32e+154) {
tmp = t_0;
} else if (im <= -750.0) {
tmp = Math.pow(im, 4.0) * (0.041666666666666664 + (-0.020833333333333332 * (re * re)));
} else if (im <= 1.82) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.35e+154) {
tmp = (0.5 * Math.exp(im)) + 0.001953125;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (0.5 * (im * im)) tmp = 0 if im <= -1.32e+154: tmp = t_0 elif im <= -750.0: tmp = math.pow(im, 4.0) * (0.041666666666666664 + (-0.020833333333333332 * (re * re))) elif im <= 1.82: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1.35e+154: tmp = (0.5 * math.exp(im)) + 0.001953125 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(0.5 * Float64(im * im))) tmp = 0.0 if (im <= -1.32e+154) tmp = t_0; elseif (im <= -750.0) tmp = Float64((im ^ 4.0) * Float64(0.041666666666666664 + Float64(-0.020833333333333332 * Float64(re * re)))); elseif (im <= 1.82) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.35e+154) tmp = Float64(Float64(0.5 * exp(im)) + 0.001953125); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (0.5 * (im * im)); tmp = 0.0; if (im <= -1.32e+154) tmp = t_0; elseif (im <= -750.0) tmp = (im ^ 4.0) * (0.041666666666666664 + (-0.020833333333333332 * (re * re))); elseif (im <= 1.82) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1.35e+154) tmp = (0.5 * exp(im)) + 0.001953125; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.32e+154], t$95$0, If[LessEqual[im, -750.0], N[(N[Power[im, 4.0], $MachinePrecision] * N[(0.041666666666666664 + N[(-0.020833333333333332 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.82], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{if}\;im \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -750:\\
\;\;\;\;{im}^{4} \cdot \left(0.041666666666666664 + -0.020833333333333332 \cdot \left(re \cdot re\right)\right)\\
\mathbf{elif}\;im \leq 1.82:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + 0.001953125\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.31999999999999998e154 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -1.31999999999999998e154 < im < -750Initial program 100.0%
Taylor expanded in im around 0 55.7%
unpow255.7%
*-commutative55.7%
Simplified55.7%
Taylor expanded in im around inf 55.7%
Taylor expanded in re around 0 5.3%
+-commutative5.3%
associate-*r*5.3%
distribute-rgt-out52.0%
unpow252.0%
Simplified52.0%
if -750 < im < 1.82000000000000006Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
Simplified100.0%
if 1.82000000000000006 < im < 1.35000000000000003e154Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 93.2%
Final simplification93.2%
(FPCore (re im) :precision binary64 (if (<= im -1.46e+41) (* 0.041666666666666664 (pow im 4.0)) (if (<= im 2.0) (cos re) (+ (* 0.5 (exp im)) 0.001953125))))
double code(double re, double im) {
double tmp;
if (im <= -1.46e+41) {
tmp = 0.041666666666666664 * pow(im, 4.0);
} else if (im <= 2.0) {
tmp = cos(re);
} else {
tmp = (0.5 * exp(im)) + 0.001953125;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-1.46d+41)) then
tmp = 0.041666666666666664d0 * (im ** 4.0d0)
else if (im <= 2.0d0) then
tmp = cos(re)
else
tmp = (0.5d0 * exp(im)) + 0.001953125d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.46e+41) {
tmp = 0.041666666666666664 * Math.pow(im, 4.0);
} else if (im <= 2.0) {
tmp = Math.cos(re);
} else {
tmp = (0.5 * Math.exp(im)) + 0.001953125;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.46e+41: tmp = 0.041666666666666664 * math.pow(im, 4.0) elif im <= 2.0: tmp = math.cos(re) else: tmp = (0.5 * math.exp(im)) + 0.001953125 return tmp
function code(re, im) tmp = 0.0 if (im <= -1.46e+41) tmp = Float64(0.041666666666666664 * (im ^ 4.0)); elseif (im <= 2.0) tmp = cos(re); else tmp = Float64(Float64(0.5 * exp(im)) + 0.001953125); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.46e+41) tmp = 0.041666666666666664 * (im ^ 4.0); elseif (im <= 2.0) tmp = cos(re); else tmp = (0.5 * exp(im)) + 0.001953125; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.46e+41], N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.0], N[Cos[re], $MachinePrecision], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + 0.001953125), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;0.041666666666666664 \cdot {im}^{4}\\
\mathbf{elif}\;im \leq 2:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot e^{im} + 0.001953125\\
\end{array}
\end{array}
if im < -1.4600000000000001e41Initial program 100.0%
Taylor expanded in im around 0 87.0%
unpow287.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in im around inf 87.0%
Taylor expanded in re around 0 68.4%
*-commutative68.4%
Simplified68.4%
if -1.4600000000000001e41 < im < 2Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
Taylor expanded in im around 0 93.8%
if 2 < im Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 81.9%
Final simplification85.7%
(FPCore (re im) :precision binary64 (if (or (<= im -1.7e+41) (not (<= im 12.6))) (* 0.041666666666666664 (pow im 4.0)) (cos re)))
double code(double re, double im) {
double tmp;
if ((im <= -1.7e+41) || !(im <= 12.6)) {
tmp = 0.041666666666666664 * pow(im, 4.0);
} else {
tmp = cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1.7d+41)) .or. (.not. (im <= 12.6d0))) then
tmp = 0.041666666666666664d0 * (im ** 4.0d0)
else
tmp = cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.7e+41) || !(im <= 12.6)) {
tmp = 0.041666666666666664 * Math.pow(im, 4.0);
} else {
tmp = Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.7e+41) or not (im <= 12.6): tmp = 0.041666666666666664 * math.pow(im, 4.0) else: tmp = math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.7e+41) || !(im <= 12.6)) tmp = Float64(0.041666666666666664 * (im ^ 4.0)); else tmp = cos(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.7e+41) || ~((im <= 12.6))) tmp = 0.041666666666666664 * (im ^ 4.0); else tmp = cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.7e+41], N[Not[LessEqual[im, 12.6]], $MachinePrecision]], N[(0.041666666666666664 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision], N[Cos[re], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.7 \cdot 10^{+41} \lor \neg \left(im \leq 12.6\right):\\
\;\;\;\;0.041666666666666664 \cdot {im}^{4}\\
\mathbf{else}:\\
\;\;\;\;\cos re\\
\end{array}
\end{array}
if im < -1.69999999999999999e41 or 12.5999999999999996 < im Initial program 100.0%
Taylor expanded in im around 0 76.2%
unpow276.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in im around inf 76.2%
Taylor expanded in re around 0 59.5%
*-commutative59.5%
Simplified59.5%
if -1.69999999999999999e41 < im < 12.5999999999999996Initial program 100.0%
Taylor expanded in im around 0 94.1%
unpow294.1%
Simplified94.1%
Taylor expanded in im around 0 93.8%
Final simplification76.9%
(FPCore (re im) :precision binary64 (if (or (<= im -510.0) (not (<= im 2.2e+14))) (* (* im im) (+ 0.5 (* (* re re) -0.25))) (cos re)))
double code(double re, double im) {
double tmp;
if ((im <= -510.0) || !(im <= 2.2e+14)) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-510.0d0)) .or. (.not. (im <= 2.2d+14))) then
tmp = (im * im) * (0.5d0 + ((re * re) * (-0.25d0)))
else
tmp = cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -510.0) || !(im <= 2.2e+14)) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -510.0) or not (im <= 2.2e+14): tmp = (im * im) * (0.5 + ((re * re) * -0.25)) else: tmp = math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -510.0) || !(im <= 2.2e+14)) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(re * re) * -0.25))); else tmp = cos(re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -510.0) || ~((im <= 2.2e+14))) tmp = (im * im) * (0.5 + ((re * re) * -0.25)); else tmp = cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -510.0], N[Not[LessEqual[im, 2.2e+14]], $MachinePrecision]], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cos[re], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -510 \lor \neg \left(im \leq 2.2 \cdot 10^{+14}\right):\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re\\
\end{array}
\end{array}
if im < -510 or 2.2e14 < im Initial program 100.0%
Taylor expanded in im around 0 48.8%
unpow248.8%
Simplified48.8%
Taylor expanded in im around inf 48.8%
unpow248.8%
associate-*r*48.8%
*-commutative48.8%
associate-*r*48.8%
Simplified48.8%
Taylor expanded in re around 0 6.0%
+-commutative6.0%
unpow26.0%
associate-*r*6.0%
unpow26.0%
distribute-rgt-out38.8%
unpow238.8%
Simplified38.8%
if -510 < im < 2.2e14Initial program 100.0%
Taylor expanded in im around 0 97.7%
unpow297.7%
Simplified97.7%
Taylor expanded in im around 0 97.5%
Final simplification67.5%
(FPCore (re im) :precision binary64 (if (<= re -5.7e+200) (* (* im im) (+ 0.5 (* (* re re) -0.25))) (* 0.5 (+ 2.0 (* im im)))))
double code(double re, double im) {
double tmp;
if (re <= -5.7e+200) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = 0.5 * (2.0 + (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-5.7d+200)) then
tmp = (im * im) * (0.5d0 + ((re * re) * (-0.25d0)))
else
tmp = 0.5d0 * (2.0d0 + (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -5.7e+200) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = 0.5 * (2.0 + (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -5.7e+200: tmp = (im * im) * (0.5 + ((re * re) * -0.25)) else: tmp = 0.5 * (2.0 + (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= -5.7e+200) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(re * re) * -0.25))); else tmp = Float64(0.5 * Float64(2.0 + Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -5.7e+200) tmp = (im * im) * (0.5 + ((re * re) * -0.25)); else tmp = 0.5 * (2.0 + (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -5.7e+200], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -5.7 \cdot 10^{+200}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if re < -5.70000000000000007e200Initial program 100.0%
Taylor expanded in im around 0 77.4%
unpow277.4%
Simplified77.4%
Taylor expanded in im around inf 31.6%
unpow231.6%
associate-*r*31.6%
*-commutative31.6%
associate-*r*31.6%
Simplified31.6%
Taylor expanded in re around 0 9.7%
+-commutative9.7%
unpow29.7%
associate-*r*9.7%
unpow29.7%
distribute-rgt-out33.5%
unpow233.5%
Simplified33.5%
if -5.70000000000000007e200 < re Initial program 100.0%
Taylor expanded in im around 0 85.2%
unpow285.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in re around 0 64.2%
Taylor expanded in im around 0 52.4%
unpow252.4%
Simplified52.4%
Final simplification50.9%
(FPCore (re im) :precision binary64 (if (or (<= im -1.42) (not (<= im 1.4))) (* 0.5 (* im im)) 1.0))
double code(double re, double im) {
double tmp;
if ((im <= -1.42) || !(im <= 1.4)) {
tmp = 0.5 * (im * im);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1.42d0)) .or. (.not. (im <= 1.4d0))) then
tmp = 0.5d0 * (im * im)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.42) || !(im <= 1.4)) {
tmp = 0.5 * (im * im);
} else {
tmp = 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.42) or not (im <= 1.4): tmp = 0.5 * (im * im) else: tmp = 1.0 return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.42) || !(im <= 1.4)) tmp = Float64(0.5 * Float64(im * im)); else tmp = 1.0; end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.42) || ~((im <= 1.4))) tmp = 0.5 * (im * im); else tmp = 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.42], N[Not[LessEqual[im, 1.4]], $MachinePrecision]], N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.42 \lor \neg \left(im \leq 1.4\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if im < -1.4199999999999999 or 1.3999999999999999 < im Initial program 100.0%
Taylor expanded in im around 0 71.9%
unpow271.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in re around 0 56.1%
Taylor expanded in im around 0 34.8%
unpow234.8%
Simplified34.8%
Taylor expanded in im around inf 34.8%
unpow234.8%
Simplified34.8%
if -1.4199999999999999 < im < 1.3999999999999999Initial program 100.0%
Taylor expanded in im around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 64.6%
Taylor expanded in im around 0 64.6%
unpow264.6%
Simplified64.6%
Taylor expanded in im around 0 64.4%
Final simplification48.9%
(FPCore (re im) :precision binary64 (* 0.5 (+ 2.0 (* im im))))
double code(double re, double im) {
return 0.5 * (2.0 + (im * im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (2.0d0 + (im * im))
end function
public static double code(double re, double im) {
return 0.5 * (2.0 + (im * im));
}
def code(re, im): return 0.5 * (2.0 + (im * im))
function code(re, im) return Float64(0.5 * Float64(2.0 + Float64(im * im))) end
function tmp = code(re, im) tmp = 0.5 * (2.0 + (im * im)); end
code[re_, im_] := N[(0.5 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(2 + im \cdot im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 85.3%
unpow285.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in re around 0 60.1%
Taylor expanded in im around 0 49.0%
unpow249.0%
Simplified49.0%
Final simplification49.0%
(FPCore (re im) :precision binary64 0.501953125)
double code(double re, double im) {
return 0.501953125;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.501953125d0
end function
public static double code(double re, double im) {
return 0.501953125;
}
def code(re, im): return 0.501953125
function code(re, im) return 0.501953125 end
function tmp = code(re, im) tmp = 0.501953125; end
code[re_, im_] := 0.501953125
\begin{array}{l}
\\
0.501953125
\end{array}
Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
+-commutative100.0%
distribute-lft-in100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
fma-def100.0%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Applied egg-rr42.0%
Taylor expanded in re around 0 34.9%
Taylor expanded in im around 0 9.2%
Final simplification9.2%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 85.3%
unpow285.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in re around 0 60.1%
Taylor expanded in im around 0 49.0%
unpow249.0%
Simplified49.0%
Taylor expanded in im around 0 32.1%
Final simplification32.1%
herbie shell --seed 2023194
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))