
(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 26 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) (+ (* 0.5 (/ 1.0 (exp im))) (* 0.5 (exp im)))))
double code(double re, double im) {
return cos(re) * ((0.5 * (1.0 / exp(im))) + (0.5 * exp(im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(re) * ((0.5d0 * (1.0d0 / exp(im))) + (0.5d0 * exp(im)))
end function
public static double code(double re, double im) {
return Math.cos(re) * ((0.5 * (1.0 / Math.exp(im))) + (0.5 * Math.exp(im)));
}
def code(re, im): return math.cos(re) * ((0.5 * (1.0 / math.exp(im))) + (0.5 * math.exp(im)))
function code(re, im) return Float64(cos(re) * Float64(Float64(0.5 * Float64(1.0 / exp(im))) + Float64(0.5 * exp(im)))) end
function tmp = code(re, im) tmp = cos(re) * ((0.5 * (1.0 / exp(im))) + (0.5 * exp(im))); end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(N[(0.5 * N[(1.0 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \left(0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot 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%
Taylor expanded in re around inf 100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= (cos re) 0.9999985)
(*
(* (cos re) 0.5)
(+ 2.0 (+ (* im im) (* (pow im 4.0) 0.08333333333333333))))
(+ (* 0.5 (/ 1.0 (exp im))) (* 0.5 (exp im)))))
double code(double re, double im) {
double tmp;
if (cos(re) <= 0.9999985) {
tmp = (cos(re) * 0.5) * (2.0 + ((im * im) + (pow(im, 4.0) * 0.08333333333333333)));
} else {
tmp = (0.5 * (1.0 / exp(im))) + (0.5 * exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (cos(re) <= 0.9999985d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + ((im * im) + ((im ** 4.0d0) * 0.08333333333333333d0)))
else
tmp = (0.5d0 * (1.0d0 / exp(im))) + (0.5d0 * exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.cos(re) <= 0.9999985) {
tmp = (Math.cos(re) * 0.5) * (2.0 + ((im * im) + (Math.pow(im, 4.0) * 0.08333333333333333)));
} else {
tmp = (0.5 * (1.0 / Math.exp(im))) + (0.5 * Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= 0.9999985: tmp = (math.cos(re) * 0.5) * (2.0 + ((im * im) + (math.pow(im, 4.0) * 0.08333333333333333))) else: tmp = (0.5 * (1.0 / math.exp(im))) + (0.5 * math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= 0.9999985) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(Float64(im * im) + Float64((im ^ 4.0) * 0.08333333333333333)))); else tmp = Float64(Float64(0.5 * Float64(1.0 / exp(im))) + Float64(0.5 * exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= 0.9999985) tmp = (cos(re) * 0.5) * (2.0 + ((im * im) + ((im ^ 4.0) * 0.08333333333333333))); else tmp = (0.5 * (1.0 / exp(im))) + (0.5 * exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.9999985], 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[(0.5 * N[(1.0 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.9999985:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + \left(im \cdot im + {im}^{4} \cdot 0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{1}{e^{im}} + 0.5 \cdot e^{im}\\
\end{array}
\end{array}
if (cos.f64 re) < 0.99999850000000001Initial program 100.0%
Taylor expanded in im around 0 90.9%
unpow290.9%
*-commutative90.9%
Simplified90.9%
if 0.99999850000000001 < (cos.f64 re) 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%
Taylor expanded in re around 0 100.0%
Final simplification95.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
(let* ((t_0 (* 0.041666666666666664 (* (cos re) (pow im 4.0)))))
(if (<= im -1.15e+77)
t_0
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 3.4)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1.15e+77) (+ (* 0.5 (exp im)) -1.0) t_0))))))
double code(double re, double im) {
double t_0 = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
double tmp;
if (im <= -1.15e+77) {
tmp = t_0;
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 3.4) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = (0.5 * exp(im)) + -1.0;
} 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 <= (-1.15d+77)) then
tmp = t_0
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 3.4d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1.15d+77) then
tmp = (0.5d0 * exp(im)) + (-1.0d0)
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 <= -1.15e+77) {
tmp = t_0;
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 3.4) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = (0.5 * Math.exp(im)) + -1.0;
} 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 <= -1.15e+77: tmp = t_0 elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 3.4: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1.15e+77: tmp = (0.5 * math.exp(im)) + -1.0 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 <= -1.15e+77) tmp = t_0; elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 3.4) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.15e+77) tmp = Float64(Float64(0.5 * exp(im)) + -1.0); 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 <= -1.15e+77) tmp = t_0; elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 3.4) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1.15e+77) tmp = (0.5 * exp(im)) + -1.0; 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, -1.15e+77], t$95$0, If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 3.4], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + -1.0), $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 -1.15 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 3.4:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot e^{im} + -1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.14999999999999997e77 or 1.14999999999999997e77 < 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.14999999999999997e77 < im < -3.1e7Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out80.0%
rec-exp80.0%
*-commutative80.0%
associate-*l*80.0%
metadata-eval80.0%
unpow280.0%
associate-*l*80.0%
Simplified80.0%
Applied egg-rr60.6%
if -3.1e7 < im < 3.39999999999999991Initial program 100.0%
Taylor expanded in im around 0 97.7%
unpow297.7%
Simplified97.7%
if 3.39999999999999991 < im < 1.14999999999999997e77Initial 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%
Taylor expanded in re around 0 82.9%
Applied egg-rr83.3%
Taylor expanded in im around inf 83.3%
Final simplification96.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.041666666666666664 (* (cos re) (pow im 4.0)))))
(if (<= im -1.15e+77)
t_0
(if (<= im -0.0185)
(* 0.5 (+ (exp im) (exp (- im))))
(if (<= im 3.9)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1e+77) (+ (* 0.5 (exp im)) -1.0) t_0))))))
double code(double re, double im) {
double t_0 = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
double tmp;
if (im <= -1.15e+77) {
tmp = t_0;
} else if (im <= -0.0185) {
tmp = 0.5 * (exp(im) + exp(-im));
} else if (im <= 3.9) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1e+77) {
tmp = (0.5 * exp(im)) + -1.0;
} 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 <= (-1.15d+77)) then
tmp = t_0
else if (im <= (-0.0185d0)) then
tmp = 0.5d0 * (exp(im) + exp(-im))
else if (im <= 3.9d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1d+77) then
tmp = (0.5d0 * exp(im)) + (-1.0d0)
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 <= -1.15e+77) {
tmp = t_0;
} else if (im <= -0.0185) {
tmp = 0.5 * (Math.exp(im) + Math.exp(-im));
} else if (im <= 3.9) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1e+77) {
tmp = (0.5 * Math.exp(im)) + -1.0;
} 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 <= -1.15e+77: tmp = t_0 elif im <= -0.0185: tmp = 0.5 * (math.exp(im) + math.exp(-im)) elif im <= 3.9: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1e+77: tmp = (0.5 * math.exp(im)) + -1.0 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 <= -1.15e+77) tmp = t_0; elseif (im <= -0.0185) tmp = Float64(0.5 * Float64(exp(im) + exp(Float64(-im)))); elseif (im <= 3.9) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1e+77) tmp = Float64(Float64(0.5 * exp(im)) + -1.0); 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 <= -1.15e+77) tmp = t_0; elseif (im <= -0.0185) tmp = 0.5 * (exp(im) + exp(-im)); elseif (im <= 3.9) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1e+77) tmp = (0.5 * exp(im)) + -1.0; 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, -1.15e+77], t$95$0, If[LessEqual[im, -0.0185], N[(0.5 * N[(N[Exp[im], $MachinePrecision] + N[Exp[(-im)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.9], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1e+77], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + -1.0), $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 -1.15 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.0185:\\
\;\;\;\;0.5 \cdot \left(e^{im} + e^{-im}\right)\\
\mathbf{elif}\;im \leq 3.9:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 10^{+77}:\\
\;\;\;\;0.5 \cdot e^{im} + -1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.14999999999999997e77 or 9.99999999999999983e76 < 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.14999999999999997e77 < im < -0.0184999999999999991Initial program 99.7%
Taylor expanded in re around 0 72.5%
if -0.0184999999999999991 < im < 3.89999999999999991Initial program 100.0%
Taylor expanded in im around 0 99.7%
unpow299.7%
Simplified99.7%
if 3.89999999999999991 < im < 9.99999999999999983e76Initial 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%
Taylor expanded in re around 0 82.9%
Applied egg-rr83.3%
Taylor expanded in im around inf 83.3%
Final simplification97.7%
(FPCore (re im)
:precision binary64
(if (<= im -1.15e+77)
(* 0.041666666666666664 (* (cos re) (pow im 4.0)))
(if (<= im -0.053)
(* 0.5 (+ (exp im) (exp (- im))))
(if (<= im 1.3)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(* (cos re) (+ (* 0.5 (exp im)) 0.0009765625))))))
double code(double re, double im) {
double tmp;
if (im <= -1.15e+77) {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
} else if (im <= -0.053) {
tmp = 0.5 * (exp(im) + exp(-im));
} else if (im <= 1.3) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = cos(re) * ((0.5 * exp(im)) + 0.0009765625);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-1.15d+77)) then
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
else if (im <= (-0.053d0)) then
tmp = 0.5d0 * (exp(im) + exp(-im))
else if (im <= 1.3d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else
tmp = cos(re) * ((0.5d0 * exp(im)) + 0.0009765625d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.15e+77) {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
} else if (im <= -0.053) {
tmp = 0.5 * (Math.exp(im) + Math.exp(-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.0009765625);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.15e+77: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) elif im <= -0.053: tmp = 0.5 * (math.exp(im) + math.exp(-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.0009765625) return tmp
function code(re, im) tmp = 0.0 if (im <= -1.15e+77) tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); elseif (im <= -0.053) tmp = Float64(0.5 * Float64(exp(im) + exp(Float64(-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.0009765625)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.15e+77) tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); elseif (im <= -0.053) tmp = 0.5 * (exp(im) + exp(-im)); elseif (im <= 1.3) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); else tmp = cos(re) * ((0.5 * exp(im)) + 0.0009765625); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.15e+77], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -0.053], N[(0.5 * N[(N[Exp[im], $MachinePrecision] + N[Exp[(-im)], $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.0009765625), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.15 \cdot 10^{+77}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq -0.053:\\
\;\;\;\;0.5 \cdot \left(e^{im} + e^{-im}\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.0009765625\right)\\
\end{array}
\end{array}
if im < -1.14999999999999997e77Initial 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.14999999999999997e77 < im < -0.0529999999999999985Initial program 99.7%
Taylor expanded in re around 0 72.5%
if -0.0529999999999999985 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 99.7%
unpow299.7%
Simplified99.7%
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%
Taylor expanded in re around inf 100.0%
Applied egg-rr99.2%
Final simplification98.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (exp im))))
(if (<= im -1.15e+77)
(* 0.041666666666666664 (* (cos re) (pow im 4.0)))
(if (<= im -0.014)
(+ (* 0.5 (/ 1.0 (exp im))) t_0)
(if (<= im 1.3)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(* (cos re) (+ t_0 0.0009765625)))))))
double code(double re, double im) {
double t_0 = 0.5 * exp(im);
double tmp;
if (im <= -1.15e+77) {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
} else if (im <= -0.014) {
tmp = (0.5 * (1.0 / exp(im))) + t_0;
} else if (im <= 1.3) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = cos(re) * (t_0 + 0.0009765625);
}
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.5d0 * exp(im)
if (im <= (-1.15d+77)) then
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
else if (im <= (-0.014d0)) then
tmp = (0.5d0 * (1.0d0 / exp(im))) + t_0
else if (im <= 1.3d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else
tmp = cos(re) * (t_0 + 0.0009765625d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * Math.exp(im);
double tmp;
if (im <= -1.15e+77) {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
} else if (im <= -0.014) {
tmp = (0.5 * (1.0 / Math.exp(im))) + t_0;
} else if (im <= 1.3) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else {
tmp = Math.cos(re) * (t_0 + 0.0009765625);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.exp(im) tmp = 0 if im <= -1.15e+77: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) elif im <= -0.014: tmp = (0.5 * (1.0 / math.exp(im))) + t_0 elif im <= 1.3: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) else: tmp = math.cos(re) * (t_0 + 0.0009765625) return tmp
function code(re, im) t_0 = Float64(0.5 * exp(im)) tmp = 0.0 if (im <= -1.15e+77) tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); elseif (im <= -0.014) tmp = Float64(Float64(0.5 * Float64(1.0 / exp(im))) + t_0); elseif (im <= 1.3) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); else tmp = Float64(cos(re) * Float64(t_0 + 0.0009765625)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * exp(im); tmp = 0.0; if (im <= -1.15e+77) tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); elseif (im <= -0.014) tmp = (0.5 * (1.0 / exp(im))) + t_0; elseif (im <= 1.3) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); else tmp = cos(re) * (t_0 + 0.0009765625); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.15e+77], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -0.014], N[(N[(0.5 * N[(1.0 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $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[(t$95$0 + 0.0009765625), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot e^{im}\\
\mathbf{if}\;im \leq -1.15 \cdot 10^{+77}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq -0.014:\\
\;\;\;\;0.5 \cdot \frac{1}{e^{im}} + t_0\\
\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(t_0 + 0.0009765625\right)\\
\end{array}
\end{array}
if im < -1.14999999999999997e77Initial 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.14999999999999997e77 < im < -0.0140000000000000003Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
+-commutative99.7%
distribute-lft-in99.7%
distribute-lft-in99.7%
distribute-rgt-in99.7%
*-commutative99.7%
fma-def99.7%
exp-neg99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in re around 0 72.6%
if -0.0140000000000000003 < im < 1.30000000000000004Initial program 100.0%
Taylor expanded in im around 0 99.7%
unpow299.7%
Simplified99.7%
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%
Taylor expanded in re around inf 100.0%
Applied egg-rr99.2%
Final simplification98.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* (cos re) (* 0.5 im)))))
(if (<= im -3.1e+181)
t_0
(if (<= im -1.25e+76)
(*
(pow im 4.0)
(+ 0.041666666666666664 (* (* re re) -0.020833333333333332)))
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 2.9)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 1.9e+154) (+ (* 0.5 (exp im)) -1.0) t_0)))))))
double code(double re, double im) {
double t_0 = im * (cos(re) * (0.5 * im));
double tmp;
if (im <= -3.1e+181) {
tmp = t_0;
} else if (im <= -1.25e+76) {
tmp = pow(im, 4.0) * (0.041666666666666664 + ((re * re) * -0.020833333333333332));
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 2.9) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.9e+154) {
tmp = (0.5 * exp(im)) + -1.0;
} 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 = im * (cos(re) * (0.5d0 * im))
if (im <= (-3.1d+181)) then
tmp = t_0
else if (im <= (-1.25d+76)) then
tmp = (im ** 4.0d0) * (0.041666666666666664d0 + ((re * re) * (-0.020833333333333332d0)))
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 2.9d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 1.9d+154) then
tmp = (0.5d0 * exp(im)) + (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (Math.cos(re) * (0.5 * im));
double tmp;
if (im <= -3.1e+181) {
tmp = t_0;
} else if (im <= -1.25e+76) {
tmp = Math.pow(im, 4.0) * (0.041666666666666664 + ((re * re) * -0.020833333333333332));
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.9) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 1.9e+154) {
tmp = (0.5 * Math.exp(im)) + -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = im * (math.cos(re) * (0.5 * im)) tmp = 0 if im <= -3.1e+181: tmp = t_0 elif im <= -1.25e+76: tmp = math.pow(im, 4.0) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)) elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 2.9: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 1.9e+154: tmp = (0.5 * math.exp(im)) + -1.0 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(im * Float64(cos(re) * Float64(0.5 * im))) tmp = 0.0 if (im <= -3.1e+181) tmp = t_0; elseif (im <= -1.25e+76) tmp = Float64((im ^ 4.0) * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.020833333333333332))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.9) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.9e+154) tmp = Float64(Float64(0.5 * exp(im)) + -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = im * (cos(re) * (0.5 * im)); tmp = 0.0; if (im <= -3.1e+181) tmp = t_0; elseif (im <= -1.25e+76) tmp = (im ^ 4.0) * (0.041666666666666664 + ((re * re) * -0.020833333333333332)); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.9) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 1.9e+154) tmp = (0.5 * exp(im)) + -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[Cos[re], $MachinePrecision] * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.1e+181], t$95$0, If[LessEqual[im, -1.25e+76], N[(N[Power[im, 4.0], $MachinePrecision] * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.9], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(\cos re \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{if}\;im \leq -3.1 \cdot 10^{+181}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.25 \cdot 10^{+76}:\\
\;\;\;\;{im}^{4} \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.020833333333333332\right)\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.9:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + -1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.09999999999999989e181 or 1.8999999999999999e154 < 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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
associate-*l*100.0%
Simplified100.0%
if -3.09999999999999989e181 < im < -1.24999999999999998e76Initial 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%
Taylor expanded in re around 0 0.0%
associate-*r*0.0%
distribute-rgt-out92.3%
*-commutative92.3%
unpow292.3%
Simplified92.3%
if -1.24999999999999998e76 < im < -3.1e7Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out80.0%
rec-exp80.0%
*-commutative80.0%
associate-*l*80.0%
metadata-eval80.0%
unpow280.0%
associate-*l*80.0%
Simplified80.0%
Applied egg-rr60.6%
if -3.1e7 < im < 2.89999999999999991Initial program 100.0%
Taylor expanded in im around 0 97.7%
unpow297.7%
Simplified97.7%
if 2.89999999999999991 < im < 1.8999999999999999e154Initial 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%
Taylor expanded in re around 0 78.0%
Applied egg-rr78.2%
Taylor expanded in im around inf 78.2%
Final simplification94.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* (cos re) (* 0.5 im)))))
(if (<= im -6.2e+176)
t_0
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 1.95)
(cos re)
(if (<= im 2.05e+154) (+ (* 0.5 (exp im)) -1.0) t_0))))))
double code(double re, double im) {
double t_0 = im * (cos(re) * (0.5 * im));
double tmp;
if (im <= -6.2e+176) {
tmp = t_0;
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 1.95) {
tmp = cos(re);
} else if (im <= 2.05e+154) {
tmp = (0.5 * exp(im)) + -1.0;
} 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 = im * (cos(re) * (0.5d0 * im))
if (im <= (-6.2d+176)) then
tmp = t_0
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 1.95d0) then
tmp = cos(re)
else if (im <= 2.05d+154) then
tmp = (0.5d0 * exp(im)) + (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (Math.cos(re) * (0.5 * im));
double tmp;
if (im <= -6.2e+176) {
tmp = t_0;
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 1.95) {
tmp = Math.cos(re);
} else if (im <= 2.05e+154) {
tmp = (0.5 * Math.exp(im)) + -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = im * (math.cos(re) * (0.5 * im)) tmp = 0 if im <= -6.2e+176: tmp = t_0 elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 1.95: tmp = math.cos(re) elif im <= 2.05e+154: tmp = (0.5 * math.exp(im)) + -1.0 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(im * Float64(cos(re) * Float64(0.5 * im))) tmp = 0.0 if (im <= -6.2e+176) tmp = t_0; elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 1.95) tmp = cos(re); elseif (im <= 2.05e+154) tmp = Float64(Float64(0.5 * exp(im)) + -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = im * (cos(re) * (0.5 * im)); tmp = 0.0; if (im <= -6.2e+176) tmp = t_0; elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 1.95) tmp = cos(re); elseif (im <= 2.05e+154) tmp = (0.5 * exp(im)) + -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[Cos[re], $MachinePrecision] * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.2e+176], t$95$0, If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 1.95], N[Cos[re], $MachinePrecision], If[LessEqual[im, 2.05e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(\cos re \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{if}\;im \leq -6.2 \cdot 10^{+176}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 1.95:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 2.05 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + -1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -6.1999999999999998e176 or 2.05e154 < 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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
associate-*l*100.0%
Simplified100.0%
if -6.1999999999999998e176 < im < -3.1e7Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out88.2%
rec-exp88.2%
*-commutative88.2%
associate-*l*88.2%
metadata-eval88.2%
unpow288.2%
associate-*l*88.2%
Simplified88.2%
Applied egg-rr65.3%
if -3.1e7 < im < 1.94999999999999996Initial 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%
Taylor expanded in im around 0 96.8%
if 1.94999999999999996 < im < 2.05e154Initial 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%
Taylor expanded in re around 0 78.0%
Applied egg-rr78.2%
Taylor expanded in im around inf 78.2%
Final simplification91.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* (cos re) (* 0.5 im)))))
(if (<= im -6.2e+176)
t_0
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 4.5)
(* (* (cos re) 0.5) (+ 2.0 (* im im)))
(if (<= im 2.7e+154) (+ (* 0.5 (exp im)) -1.0) t_0))))))
double code(double re, double im) {
double t_0 = im * (cos(re) * (0.5 * im));
double tmp;
if (im <= -6.2e+176) {
tmp = t_0;
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 4.5) {
tmp = (cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 2.7e+154) {
tmp = (0.5 * exp(im)) + -1.0;
} 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 = im * (cos(re) * (0.5d0 * im))
if (im <= (-6.2d+176)) then
tmp = t_0
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 4.5d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
else if (im <= 2.7d+154) then
tmp = (0.5d0 * exp(im)) + (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (Math.cos(re) * (0.5 * im));
double tmp;
if (im <= -6.2e+176) {
tmp = t_0;
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 4.5) {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
} else if (im <= 2.7e+154) {
tmp = (0.5 * Math.exp(im)) + -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = im * (math.cos(re) * (0.5 * im)) tmp = 0 if im <= -6.2e+176: tmp = t_0 elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 4.5: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) elif im <= 2.7e+154: tmp = (0.5 * math.exp(im)) + -1.0 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(im * Float64(cos(re) * Float64(0.5 * im))) tmp = 0.0 if (im <= -6.2e+176) tmp = t_0; elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 4.5) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); elseif (im <= 2.7e+154) tmp = Float64(Float64(0.5 * exp(im)) + -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = im * (cos(re) * (0.5 * im)); tmp = 0.0; if (im <= -6.2e+176) tmp = t_0; elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 4.5) tmp = (cos(re) * 0.5) * (2.0 + (im * im)); elseif (im <= 2.7e+154) tmp = (0.5 * exp(im)) + -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[Cos[re], $MachinePrecision] * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.2e+176], t$95$0, If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 4.5], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.7e+154], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(\cos re \cdot \left(0.5 \cdot im\right)\right)\\
\mathbf{if}\;im \leq -6.2 \cdot 10^{+176}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 4.5:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 2.7 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot e^{im} + -1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -6.1999999999999998e176 or 2.70000000000000006e154 < 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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
associate-*l*100.0%
Simplified100.0%
if -6.1999999999999998e176 < im < -3.1e7Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out88.2%
rec-exp88.2%
*-commutative88.2%
associate-*l*88.2%
metadata-eval88.2%
unpow288.2%
associate-*l*88.2%
Simplified88.2%
Applied egg-rr65.3%
if -3.1e7 < im < 4.5Initial program 100.0%
Taylor expanded in im around 0 97.7%
unpow297.7%
Simplified97.7%
if 4.5 < im < 2.70000000000000006e154Initial 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%
Taylor expanded in re around 0 78.0%
Applied egg-rr78.2%
Taylor expanded in im around inf 78.2%
Final simplification91.9%
(FPCore (re im)
:precision binary64
(if (<= im -3.15e+128)
(* (* im im) (+ 0.5 (* re (* re -0.25))))
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 2.1e+21)
(cos re)
(if (<= im 1.26e+77)
(pow re -512.0)
(* (pow im 4.0) 0.041666666666666664))))))
double code(double re, double im) {
double tmp;
if (im <= -3.15e+128) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 2.1e+21) {
tmp = cos(re);
} else if (im <= 1.26e+77) {
tmp = pow(re, -512.0);
} else {
tmp = pow(im, 4.0) * 0.041666666666666664;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-3.15d+128)) then
tmp = (im * im) * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 2.1d+21) then
tmp = cos(re)
else if (im <= 1.26d+77) then
tmp = re ** (-512.0d0)
else
tmp = (im ** 4.0d0) * 0.041666666666666664d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.15e+128) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.1e+21) {
tmp = Math.cos(re);
} else if (im <= 1.26e+77) {
tmp = Math.pow(re, -512.0);
} else {
tmp = Math.pow(im, 4.0) * 0.041666666666666664;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.15e+128: tmp = (im * im) * (0.5 + (re * (re * -0.25))) elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 2.1e+21: tmp = math.cos(re) elif im <= 1.26e+77: tmp = math.pow(re, -512.0) else: tmp = math.pow(im, 4.0) * 0.041666666666666664 return tmp
function code(re, im) tmp = 0.0 if (im <= -3.15e+128) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.1e+21) tmp = cos(re); elseif (im <= 1.26e+77) tmp = re ^ -512.0; else tmp = Float64((im ^ 4.0) * 0.041666666666666664); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.15e+128) tmp = (im * im) * (0.5 + (re * (re * -0.25))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.1e+21) tmp = cos(re); elseif (im <= 1.26e+77) tmp = re ^ -512.0; else tmp = (im ^ 4.0) * 0.041666666666666664; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.15e+128], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.1e+21], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1.26e+77], N[Power[re, -512.0], $MachinePrecision], N[(N[Power[im, 4.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.15 \cdot 10^{+128}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+21}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 1.26 \cdot 10^{+77}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;{im}^{4} \cdot 0.041666666666666664\\
\end{array}
\end{array}
if im < -3.1499999999999999e128Initial program 100.0%
Taylor expanded in im around 0 81.2%
unpow281.2%
Simplified81.2%
Taylor expanded in im around inf 81.2%
*-commutative81.2%
associate-*r*81.2%
*-commutative81.2%
unpow281.2%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in re around 0 9.7%
associate-*r*9.7%
distribute-rgt-out74.4%
unpow274.4%
unpow274.4%
associate-*r*74.4%
Simplified74.4%
if -3.1499999999999999e128 < im < -3.1e7 or 2.1e21 < im < 1.25999999999999998e77Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out83.3%
rec-exp83.3%
*-commutative83.3%
associate-*l*83.3%
metadata-eval83.3%
unpow283.3%
associate-*l*83.3%
Simplified83.3%
Applied egg-rr67.2%
if -3.1e7 < im < 2.1e21Initial 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%
Taylor expanded in im around 0 94.9%
if 1.25999999999999998e77 < 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%
Taylor expanded in re around 0 81.3%
Final simplification86.4%
(FPCore (re im)
:precision binary64
(if (<= im -2e+131)
(* (* im im) (+ 0.5 (* re (* re -0.25))))
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 2.5) (cos re) (+ (* 0.5 (exp im)) -1.0)))))
double code(double re, double im) {
double tmp;
if (im <= -2e+131) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 2.5) {
tmp = cos(re);
} else {
tmp = (0.5 * exp(im)) + -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 <= (-2d+131)) then
tmp = (im * im) * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 2.5d0) then
tmp = cos(re)
else
tmp = (0.5d0 * exp(im)) + (-1.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -2e+131) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.5) {
tmp = Math.cos(re);
} else {
tmp = (0.5 * Math.exp(im)) + -1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2e+131: tmp = (im * im) * (0.5 + (re * (re * -0.25))) elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 2.5: tmp = math.cos(re) else: tmp = (0.5 * math.exp(im)) + -1.0 return tmp
function code(re, im) tmp = 0.0 if (im <= -2e+131) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.5) tmp = cos(re); else tmp = Float64(Float64(0.5 * exp(im)) + -1.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2e+131) tmp = (im * im) * (0.5 + (re * (re * -0.25))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.5) tmp = cos(re); else tmp = (0.5 * exp(im)) + -1.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2e+131], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.5], N[Cos[re], $MachinePrecision], N[(N[(0.5 * N[Exp[im], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2 \cdot 10^{+131}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.5:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot e^{im} + -1\\
\end{array}
\end{array}
if im < -1.9999999999999998e131Initial program 100.0%
Taylor expanded in im around 0 81.2%
unpow281.2%
Simplified81.2%
Taylor expanded in im around inf 81.2%
*-commutative81.2%
associate-*r*81.2%
*-commutative81.2%
unpow281.2%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in re around 0 9.7%
associate-*r*9.7%
distribute-rgt-out74.4%
unpow274.4%
unpow274.4%
associate-*r*74.4%
Simplified74.4%
if -1.9999999999999998e131 < im < -3.1e7Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out87.0%
rec-exp87.0%
*-commutative87.0%
associate-*l*87.0%
metadata-eval87.0%
unpow287.0%
associate-*l*87.0%
Simplified87.0%
Applied egg-rr65.8%
if -3.1e7 < im < 2.5Initial 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%
Taylor expanded in im around 0 96.8%
if 2.5 < 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%
Taylor expanded in re around 0 81.5%
Applied egg-rr81.6%
Taylor expanded in im around inf 81.6%
Final simplification87.6%
(FPCore (re im)
:precision binary64
(if (<= im -1.7e+131)
(* (* im im) (+ 0.5 (* re (* re -0.25))))
(if (<= im -31000000.0)
(pow re -512.0)
(if (<= im 2.1e+21)
(cos re)
(if (<= im 1.26e+131)
(pow re -512.0)
(+
-0.5
(* im (+ 0.5 (* im (+ 0.25 (* im 0.08333333333333333)))))))))))
double code(double re, double im) {
double tmp;
if (im <= -1.7e+131) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= -31000000.0) {
tmp = pow(re, -512.0);
} else if (im <= 2.1e+21) {
tmp = cos(re);
} else if (im <= 1.26e+131) {
tmp = pow(re, -512.0);
} else {
tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
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+131)) then
tmp = (im * im) * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= (-31000000.0d0)) then
tmp = re ** (-512.0d0)
else if (im <= 2.1d+21) then
tmp = cos(re)
else if (im <= 1.26d+131) then
tmp = re ** (-512.0d0)
else
tmp = (-0.5d0) + (im * (0.5d0 + (im * (0.25d0 + (im * 0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.7e+131) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= -31000000.0) {
tmp = Math.pow(re, -512.0);
} else if (im <= 2.1e+21) {
tmp = Math.cos(re);
} else if (im <= 1.26e+131) {
tmp = Math.pow(re, -512.0);
} else {
tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.7e+131: tmp = (im * im) * (0.5 + (re * (re * -0.25))) elif im <= -31000000.0: tmp = math.pow(re, -512.0) elif im <= 2.1e+21: tmp = math.cos(re) elif im <= 1.26e+131: tmp = math.pow(re, -512.0) else: tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))) return tmp
function code(re, im) tmp = 0.0 if (im <= -1.7e+131) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.1e+21) tmp = cos(re); elseif (im <= 1.26e+131) tmp = re ^ -512.0; else tmp = Float64(-0.5 + Float64(im * Float64(0.5 + Float64(im * Float64(0.25 + Float64(im * 0.08333333333333333)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.7e+131) tmp = (im * im) * (0.5 + (re * (re * -0.25))); elseif (im <= -31000000.0) tmp = re ^ -512.0; elseif (im <= 2.1e+21) tmp = cos(re); elseif (im <= 1.26e+131) tmp = re ^ -512.0; else tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.7e+131], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -31000000.0], N[Power[re, -512.0], $MachinePrecision], If[LessEqual[im, 2.1e+21], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1.26e+131], N[Power[re, -512.0], $MachinePrecision], N[(-0.5 + N[(im * N[(0.5 + N[(im * N[(0.25 + N[(im * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.7 \cdot 10^{+131}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq -31000000:\\
\;\;\;\;{re}^{-512}\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+21}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 1.26 \cdot 10^{+131}:\\
\;\;\;\;{re}^{-512}\\
\mathbf{else}:\\
\;\;\;\;-0.5 + im \cdot \left(0.5 + im \cdot \left(0.25 + im \cdot 0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if im < -1.69999999999999993e131Initial program 100.0%
Taylor expanded in im around 0 81.2%
unpow281.2%
Simplified81.2%
Taylor expanded in im around inf 81.2%
*-commutative81.2%
associate-*r*81.2%
*-commutative81.2%
unpow281.2%
associate-*l*78.9%
Simplified78.9%
Taylor expanded in re around 0 9.7%
associate-*r*9.7%
distribute-rgt-out74.4%
unpow274.4%
unpow274.4%
associate-*r*74.4%
Simplified74.4%
if -1.69999999999999993e131 < im < -3.1e7 or 2.1e21 < im < 1.26e131Initial 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
+-commutative0.0%
distribute-lft-out0.0%
associate-*r*0.0%
distribute-rgt-out82.1%
rec-exp82.1%
*-commutative82.1%
associate-*l*82.1%
metadata-eval82.1%
unpow282.1%
associate-*l*82.1%
Simplified82.1%
Applied egg-rr62.1%
if -3.1e7 < im < 2.1e21Initial 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%
Taylor expanded in im around 0 94.9%
if 1.26e131 < 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%
Taylor expanded in re around 0 84.6%
Applied egg-rr84.6%
Taylor expanded in im around 0 84.6%
sub-neg84.6%
metadata-eval84.6%
+-commutative84.6%
+-commutative84.6%
associate-+l+84.6%
*-commutative84.6%
*-commutative84.6%
cube-mult84.6%
unpow284.6%
associate-*l*84.6%
*-commutative84.6%
unpow284.6%
associate-*l*84.6%
distribute-lft-out84.6%
distribute-lft-out84.6%
unpow284.6%
associate-*l*84.6%
distribute-lft-out84.6%
+-commutative84.6%
Simplified84.6%
Final simplification85.6%
(FPCore (re im)
:precision binary64
(if (<= im -9.6e+42)
(* (* im im) (+ 0.5 (* re (* re -0.25))))
(if (<= im 3.3e+27)
(cos re)
(+ -0.5 (* im (+ 0.5 (* im (+ 0.25 (* im 0.08333333333333333)))))))))
double code(double re, double im) {
double tmp;
if (im <= -9.6e+42) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= 3.3e+27) {
tmp = cos(re);
} else {
tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-9.6d+42)) then
tmp = (im * im) * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= 3.3d+27) then
tmp = cos(re)
else
tmp = (-0.5d0) + (im * (0.5d0 + (im * (0.25d0 + (im * 0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -9.6e+42) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= 3.3e+27) {
tmp = Math.cos(re);
} else {
tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -9.6e+42: tmp = (im * im) * (0.5 + (re * (re * -0.25))) elif im <= 3.3e+27: tmp = math.cos(re) else: tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))) return tmp
function code(re, im) tmp = 0.0 if (im <= -9.6e+42) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= 3.3e+27) tmp = cos(re); else tmp = Float64(-0.5 + Float64(im * Float64(0.5 + Float64(im * Float64(0.25 + Float64(im * 0.08333333333333333)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -9.6e+42) tmp = (im * im) * (0.5 + (re * (re * -0.25))); elseif (im <= 3.3e+27) tmp = cos(re); else tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -9.6e+42], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3e+27], N[Cos[re], $MachinePrecision], N[(-0.5 + N[(im * N[(0.5 + N[(im * N[(0.25 + N[(im * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -9.6 \cdot 10^{+42}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+27}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;-0.5 + im \cdot \left(0.5 + im \cdot \left(0.25 + im \cdot 0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if im < -9.5999999999999994e42Initial program 100.0%
Taylor expanded in im around 0 53.9%
unpow253.9%
Simplified53.9%
Taylor expanded in im around inf 53.9%
*-commutative53.9%
associate-*r*53.9%
*-commutative53.9%
unpow253.9%
associate-*l*52.5%
Simplified52.5%
Taylor expanded in re around 0 13.3%
associate-*r*13.3%
distribute-rgt-out54.8%
unpow254.8%
unpow254.8%
associate-*r*54.8%
Simplified54.8%
if -9.5999999999999994e42 < im < 3.2999999999999998e27Initial 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%
Taylor expanded in im around 0 92.4%
if 3.2999999999999998e27 < 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%
Taylor expanded in re around 0 83.6%
Applied egg-rr83.6%
Taylor expanded in im around 0 64.8%
sub-neg64.8%
metadata-eval64.8%
+-commutative64.8%
+-commutative64.8%
associate-+l+64.8%
*-commutative64.8%
*-commutative64.8%
cube-mult64.8%
unpow264.8%
associate-*l*64.8%
*-commutative64.8%
unpow264.8%
associate-*l*64.8%
distribute-lft-out64.8%
distribute-lft-out64.8%
unpow264.8%
associate-*l*64.8%
distribute-lft-out64.8%
+-commutative64.8%
Simplified64.8%
Final simplification78.7%
(FPCore (re im) :precision binary64 (if (or (<= im -7.5e+42) (and (not (<= im 1.96e+87)) (<= im 4e+175))) (* (* im im) (+ 0.5 (* re (* re -0.25)))) (* 0.5 (+ 2.0 (* im im)))))
double code(double re, double im) {
double tmp;
if ((im <= -7.5e+42) || (!(im <= 1.96e+87) && (im <= 4e+175))) {
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 ((im <= (-7.5d+42)) .or. (.not. (im <= 1.96d+87)) .and. (im <= 4d+175)) 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 ((im <= -7.5e+42) || (!(im <= 1.96e+87) && (im <= 4e+175))) {
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 (im <= -7.5e+42) or (not (im <= 1.96e+87) and (im <= 4e+175)): 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 ((im <= -7.5e+42) || (!(im <= 1.96e+87) && (im <= 4e+175))) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(re * Float64(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 ((im <= -7.5e+42) || (~((im <= 1.96e+87)) && (im <= 4e+175))) 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[Or[LessEqual[im, -7.5e+42], And[N[Not[LessEqual[im, 1.96e+87]], $MachinePrecision], LessEqual[im, 4e+175]]], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -7.5 \cdot 10^{+42} \lor \neg \left(im \leq 1.96 \cdot 10^{+87}\right) \land im \leq 4 \cdot 10^{+175}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if im < -7.50000000000000041e42 or 1.96e87 < im < 3.9999999999999997e175Initial program 100.0%
Taylor expanded in im around 0 47.4%
unpow247.4%
Simplified47.4%
Taylor expanded in im around inf 47.4%
*-commutative47.4%
associate-*r*47.4%
*-commutative47.4%
unpow247.4%
associate-*l*46.3%
Simplified46.3%
Taylor expanded in re around 0 16.6%
associate-*r*16.6%
distribute-rgt-out53.2%
unpow253.2%
unpow253.2%
associate-*r*53.2%
Simplified53.2%
if -7.50000000000000041e42 < im < 1.96e87 or 3.9999999999999997e175 < im Initial program 100.0%
Taylor expanded in re around 0 64.9%
Taylor expanded in im around 0 56.8%
unpow256.8%
Simplified56.8%
Final simplification55.8%
(FPCore (re im)
:precision binary64
(if (<= im -7.5e+42)
(* (* im im) (+ 0.5 (* re (* re -0.25))))
(if (<= im 3.0)
(* 0.5 (+ 2.0 (* im im)))
(+ -0.5 (* im (+ 0.5 (* im (+ 0.25 (* im 0.08333333333333333)))))))))
double code(double re, double im) {
double tmp;
if (im <= -7.5e+42) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= 3.0) {
tmp = 0.5 * (2.0 + (im * im));
} else {
tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-7.5d+42)) then
tmp = (im * im) * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= 3.0d0) then
tmp = 0.5d0 * (2.0d0 + (im * im))
else
tmp = (-0.5d0) + (im * (0.5d0 + (im * (0.25d0 + (im * 0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -7.5e+42) {
tmp = (im * im) * (0.5 + (re * (re * -0.25)));
} else if (im <= 3.0) {
tmp = 0.5 * (2.0 + (im * im));
} else {
tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333)))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -7.5e+42: tmp = (im * im) * (0.5 + (re * (re * -0.25))) elif im <= 3.0: tmp = 0.5 * (2.0 + (im * im)) else: tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))) return tmp
function code(re, im) tmp = 0.0 if (im <= -7.5e+42) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= 3.0) tmp = Float64(0.5 * Float64(2.0 + Float64(im * im))); else tmp = Float64(-0.5 + Float64(im * Float64(0.5 + Float64(im * Float64(0.25 + Float64(im * 0.08333333333333333)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -7.5e+42) tmp = (im * im) * (0.5 + (re * (re * -0.25))); elseif (im <= 3.0) tmp = 0.5 * (2.0 + (im * im)); else tmp = -0.5 + (im * (0.5 + (im * (0.25 + (im * 0.08333333333333333))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -7.5e+42], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.0], N[(0.5 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 + N[(im * N[(0.5 + N[(im * N[(0.25 + N[(im * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -7.5 \cdot 10^{+42}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 3:\\
\;\;\;\;0.5 \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 + im \cdot \left(0.5 + im \cdot \left(0.25 + im \cdot 0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if im < -7.50000000000000041e42Initial program 100.0%
Taylor expanded in im around 0 53.9%
unpow253.9%
Simplified53.9%
Taylor expanded in im around inf 53.9%
*-commutative53.9%
associate-*r*53.9%
*-commutative53.9%
unpow253.9%
associate-*l*52.5%
Simplified52.5%
Taylor expanded in re around 0 13.3%
associate-*r*13.3%
distribute-rgt-out54.8%
unpow254.8%
unpow254.8%
associate-*r*54.8%
Simplified54.8%
if -7.50000000000000041e42 < im < 3Initial program 100.0%
Taylor expanded in re around 0 58.5%
Taylor expanded in im around 0 54.9%
unpow254.9%
Simplified54.9%
if 3 < 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%
Taylor expanded in re around 0 81.5%
Applied egg-rr81.6%
Taylor expanded in im around 0 61.8%
sub-neg61.8%
metadata-eval61.8%
+-commutative61.8%
+-commutative61.8%
associate-+l+61.8%
*-commutative61.8%
*-commutative61.8%
cube-mult61.8%
unpow261.8%
associate-*l*61.8%
*-commutative61.8%
unpow261.8%
associate-*l*61.8%
distribute-lft-out61.8%
distribute-lft-out61.8%
unpow261.8%
associate-*l*61.8%
distribute-lft-out61.8%
+-commutative61.8%
Simplified61.8%
Final simplification56.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.25 (* im (* re (* re im))))))
(if (<= re -4.85e+27)
t_0
(if (<= re 3.2e+95)
(* 0.5 (+ 2.0 (* im im)))
(if (<= re 1.5e+191) t_0 (- (* re re) re))))))
double code(double re, double im) {
double t_0 = -0.25 * (im * (re * (re * im)));
double tmp;
if (re <= -4.85e+27) {
tmp = t_0;
} else if (re <= 3.2e+95) {
tmp = 0.5 * (2.0 + (im * im));
} else if (re <= 1.5e+191) {
tmp = t_0;
} else {
tmp = (re * re) - re;
}
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.25d0) * (im * (re * (re * im)))
if (re <= (-4.85d+27)) then
tmp = t_0
else if (re <= 3.2d+95) then
tmp = 0.5d0 * (2.0d0 + (im * im))
else if (re <= 1.5d+191) then
tmp = t_0
else
tmp = (re * re) - re
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.25 * (im * (re * (re * im)));
double tmp;
if (re <= -4.85e+27) {
tmp = t_0;
} else if (re <= 3.2e+95) {
tmp = 0.5 * (2.0 + (im * im));
} else if (re <= 1.5e+191) {
tmp = t_0;
} else {
tmp = (re * re) - re;
}
return tmp;
}
def code(re, im): t_0 = -0.25 * (im * (re * (re * im))) tmp = 0 if re <= -4.85e+27: tmp = t_0 elif re <= 3.2e+95: tmp = 0.5 * (2.0 + (im * im)) elif re <= 1.5e+191: tmp = t_0 else: tmp = (re * re) - re return tmp
function code(re, im) t_0 = Float64(-0.25 * Float64(im * Float64(re * Float64(re * im)))) tmp = 0.0 if (re <= -4.85e+27) tmp = t_0; elseif (re <= 3.2e+95) tmp = Float64(0.5 * Float64(2.0 + Float64(im * im))); elseif (re <= 1.5e+191) tmp = t_0; else tmp = Float64(Float64(re * re) - re); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.25 * (im * (re * (re * im))); tmp = 0.0; if (re <= -4.85e+27) tmp = t_0; elseif (re <= 3.2e+95) tmp = 0.5 * (2.0 + (im * im)); elseif (re <= 1.5e+191) tmp = t_0; else tmp = (re * re) - re; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.25 * N[(im * N[(re * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -4.85e+27], t$95$0, If[LessEqual[re, 3.2e+95], N[(0.5 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.5e+191], t$95$0, N[(N[(re * re), $MachinePrecision] - re), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.25 \cdot \left(im \cdot \left(re \cdot \left(re \cdot im\right)\right)\right)\\
\mathbf{if}\;re \leq -4.85 \cdot 10^{+27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq 3.2 \cdot 10^{+95}:\\
\;\;\;\;0.5 \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+191}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot re - re\\
\end{array}
\end{array}
if re < -4.8500000000000001e27 or 3.2000000000000001e95 < re < 1.4999999999999999e191Initial program 99.9%
Taylor expanded in im around 0 79.8%
unpow279.8%
Simplified79.8%
Taylor expanded in im around inf 24.9%
*-commutative24.9%
associate-*r*24.9%
*-commutative24.9%
unpow224.9%
associate-*l*24.9%
Simplified24.9%
Taylor expanded in re around 0 12.3%
associate-*r*12.3%
distribute-rgt-out26.2%
unpow226.2%
unpow226.2%
associate-*r*26.2%
Simplified26.2%
Taylor expanded in re around inf 26.2%
unpow226.2%
associate-*r*26.5%
*-commutative26.5%
unpow226.5%
associate-*l*26.9%
Simplified26.9%
if -4.8500000000000001e27 < re < 3.2000000000000001e95Initial program 100.0%
Taylor expanded in re around 0 91.5%
Taylor expanded in im around 0 71.0%
unpow271.0%
Simplified71.0%
if 1.4999999999999999e191 < re 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 0.9%
+-commutative0.9%
distribute-lft-out0.9%
associate-*r*0.9%
+-commutative0.9%
distribute-lft-out0.9%
associate-*r*0.9%
distribute-rgt-out12.5%
rec-exp12.5%
*-commutative12.5%
associate-*l*12.5%
metadata-eval12.5%
unpow212.5%
associate-*l*12.5%
Simplified12.5%
Applied egg-rr35.7%
fma-neg35.7%
Simplified35.7%
Final simplification55.0%
(FPCore (re im) :precision binary64 (if (or (<= im -0.2) (not (<= im 1.4))) (* 0.5 (* im im)) 1.0))
double code(double re, double im) {
double tmp;
if ((im <= -0.2) || !(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 <= (-0.2d0)) .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 <= -0.2) || !(im <= 1.4)) {
tmp = 0.5 * (im * im);
} else {
tmp = 1.0;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -0.2) 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 <= -0.2) || !(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 <= -0.2) || ~((im <= 1.4))) tmp = 0.5 * (im * im); else tmp = 1.0; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -0.2], 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 -0.2 \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 < -0.20000000000000001 or 1.3999999999999999 < im Initial program 100.0%
Taylor expanded in im around 0 53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in im around inf 53.2%
*-commutative53.2%
associate-*r*53.2%
*-commutative53.2%
unpow253.2%
associate-*l*52.5%
Simplified52.5%
Taylor expanded in re around 0 42.3%
unpow242.3%
Simplified42.3%
if -0.20000000000000001 < im < 1.3999999999999999Initial program 100.0%
Taylor expanded in re around 0 57.7%
Taylor expanded in im around 0 56.8%
Final simplification50.1%
(FPCore (re im) :precision binary64 (if (<= re 8e+157) (* 0.5 (+ 2.0 (* im im))) (if (<= re 1.1e+242) (- -512.0 (* re re)) (- (* re re) re))))
double code(double re, double im) {
double tmp;
if (re <= 8e+157) {
tmp = 0.5 * (2.0 + (im * im));
} else if (re <= 1.1e+242) {
tmp = -512.0 - (re * re);
} else {
tmp = (re * re) - re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 8d+157) then
tmp = 0.5d0 * (2.0d0 + (im * im))
else if (re <= 1.1d+242) then
tmp = (-512.0d0) - (re * re)
else
tmp = (re * re) - re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 8e+157) {
tmp = 0.5 * (2.0 + (im * im));
} else if (re <= 1.1e+242) {
tmp = -512.0 - (re * re);
} else {
tmp = (re * re) - re;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 8e+157: tmp = 0.5 * (2.0 + (im * im)) elif re <= 1.1e+242: tmp = -512.0 - (re * re) else: tmp = (re * re) - re return tmp
function code(re, im) tmp = 0.0 if (re <= 8e+157) tmp = Float64(0.5 * Float64(2.0 + Float64(im * im))); elseif (re <= 1.1e+242) tmp = Float64(-512.0 - Float64(re * re)); else tmp = Float64(Float64(re * re) - re); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 8e+157) tmp = 0.5 * (2.0 + (im * im)); elseif (re <= 1.1e+242) tmp = -512.0 - (re * re); else tmp = (re * re) - re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 8e+157], N[(0.5 * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.1e+242], N[(-512.0 - N[(re * re), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] - re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 8 \cdot 10^{+157}:\\
\;\;\;\;0.5 \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;re \leq 1.1 \cdot 10^{+242}:\\
\;\;\;\;-512 - re \cdot re\\
\mathbf{else}:\\
\;\;\;\;re \cdot re - re\\
\end{array}
\end{array}
if re < 7.99999999999999987e157Initial program 100.0%
Taylor expanded in re around 0 72.6%
Taylor expanded in im around 0 55.6%
unpow255.6%
Simplified55.6%
if 7.99999999999999987e157 < re < 1.1e242Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
+-commutative99.9%
distribute-lft-in99.9%
distribute-lft-in99.9%
distribute-rgt-in99.9%
*-commutative99.9%
fma-def99.9%
exp-neg100.0%
associate-*l/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 1.2%
+-commutative1.2%
distribute-lft-out1.2%
associate-*r*1.2%
+-commutative1.2%
distribute-lft-out1.2%
associate-*r*1.2%
distribute-rgt-out31.2%
rec-exp31.2%
*-commutative31.2%
associate-*l*31.2%
metadata-eval31.2%
unpow231.2%
associate-*l*31.2%
Simplified31.2%
Applied egg-rr31.2%
cancel-sign-sub-inv31.2%
Simplified31.2%
if 1.1e242 < re 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%
Taylor expanded in re around inf 100.0%
Taylor expanded in re around 0 1.1%
+-commutative1.1%
distribute-lft-out1.1%
associate-*r*1.1%
+-commutative1.1%
distribute-lft-out1.1%
associate-*r*1.1%
distribute-rgt-out7.0%
rec-exp7.0%
*-commutative7.0%
associate-*l*7.0%
metadata-eval7.0%
unpow27.0%
associate-*l*7.0%
Simplified7.0%
Applied egg-rr36.4%
fma-neg36.4%
Simplified36.4%
Final simplification52.4%
(FPCore (re im) :precision binary64 -512.0)
double code(double re, double im) {
return -512.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -512.0d0
end function
public static double code(double re, double im) {
return -512.0;
}
def code(re, im): return -512.0
function code(re, im) return -512.0 end
function tmp = code(re, im) tmp = -512.0; end
code[re_, im_] := -512.0
\begin{array}{l}
\\
-512
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in im around inf 26.8%
*-commutative26.8%
associate-*r*26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.5%
Simplified26.5%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Applied egg-rr3.1%
Final simplification3.1%
(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 78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in im around inf 26.8%
*-commutative26.8%
associate-*r*26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.5%
Simplified26.5%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Applied egg-rr4.1%
Final simplification4.1%
(FPCore (re im) :precision binary64 0.015625)
double code(double re, double im) {
return 0.015625;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.015625d0
end function
public static double code(double re, double im) {
return 0.015625;
}
def code(re, im): return 0.015625
function code(re, im) return 0.015625 end
function tmp = code(re, im) tmp = 0.015625; end
code[re_, im_] := 0.015625
\begin{array}{l}
\\
0.015625
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in im around inf 26.8%
*-commutative26.8%
associate-*r*26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.5%
Simplified26.5%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Applied egg-rr7.5%
Final simplification7.5%
(FPCore (re im) :precision binary64 0.125)
double code(double re, double im) {
return 0.125;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.125d0
end function
public static double code(double re, double im) {
return 0.125;
}
def code(re, im): return 0.125
function code(re, im) return 0.125 end
function tmp = code(re, im) tmp = 0.125; end
code[re_, im_] := 0.125
\begin{array}{l}
\\
0.125
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in im around inf 26.8%
*-commutative26.8%
associate-*r*26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.5%
Simplified26.5%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Applied egg-rr8.1%
Final simplification8.1%
(FPCore (re im) :precision binary64 0.25)
double code(double re, double im) {
return 0.25;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.25d0
end function
public static double code(double re, double im) {
return 0.25;
}
def code(re, im): return 0.25
function code(re, im) return 0.25 end
function tmp = code(re, im) tmp = 0.25; end
code[re_, im_] := 0.25
\begin{array}{l}
\\
0.25
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in im around inf 26.8%
*-commutative26.8%
associate-*r*26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.5%
Simplified26.5%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Applied egg-rr8.5%
Final simplification8.5%
(FPCore (re im) :precision binary64 0.75)
double code(double re, double im) {
return 0.75;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.75d0
end function
public static double code(double re, double im) {
return 0.75;
}
def code(re, im): return 0.75
function code(re, im) return 0.75 end
function tmp = code(re, im) tmp = 0.75; end
code[re_, im_] := 0.75
\begin{array}{l}
\\
0.75
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 78.2%
unpow278.2%
Simplified78.2%
Taylor expanded in im around inf 26.8%
*-commutative26.8%
associate-*r*26.8%
*-commutative26.8%
unpow226.8%
associate-*l*26.5%
Simplified26.5%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Applied egg-rr9.7%
Final simplification9.7%
(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 re around 0 66.4%
Taylor expanded in im around 0 31.9%
Final simplification31.9%
herbie shell --seed 2023182
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))