
(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 19 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 (/ (* 0.5 (cos re)) (/ 1.0 (* 2.0 (cosh im)))))
double code(double re, double im) {
return (0.5 * cos(re)) / (1.0 / (2.0 * cosh(im)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) / (1.0d0 / (2.0d0 * cosh(im)))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) / (1.0 / (2.0 * Math.cosh(im)));
}
def code(re, im): return (0.5 * math.cos(re)) / (1.0 / (2.0 * math.cosh(im)))
function code(re, im) return Float64(Float64(0.5 * cos(re)) / Float64(1.0 / Float64(2.0 * cosh(im)))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) / (1.0 / (2.0 * cosh(im))); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(2.0 * N[Cosh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5 \cdot \cos re}{\frac{1}{2 \cdot \cosh im}}
\end{array}
Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
(FPCore (re im) :precision binary64 (* (cos re) (cosh im)))
double code(double re, double im) {
return cos(re) * cosh(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(re) * cosh(im)
end function
public static double code(double re, double im) {
return Math.cos(re) * Math.cosh(im);
}
def code(re, im): return math.cos(re) * math.cosh(im)
function code(re, im) return Float64(cos(re) * cosh(im)) end
function tmp = code(re, im) tmp = cos(re) * cosh(im); end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[Cosh[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \cosh im
\end{array}
Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
cosh-undefN/A
associate-*r*N/A
metadata-evalN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0
(+
0.5
(*
(* im im)
(+ 0.041666666666666664 (* (* im im) 0.001388888888888889))))))
(if (<= im 0.5)
(/ (* (cos re) -0.5) (/ -0.5 (+ 1.0 (* (* im im) t_0))))
(if (<= im 8.5e+50)
(/ 0.5 (/ 1.0 (* 2.0 (cosh im))))
(* (cos re) (+ 1.0 (* im (* im t_0))))))))
double code(double re, double im) {
double t_0 = 0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)));
double tmp;
if (im <= 0.5) {
tmp = (cos(re) * -0.5) / (-0.5 / (1.0 + ((im * im) * t_0)));
} else if (im <= 8.5e+50) {
tmp = 0.5 / (1.0 / (2.0 * cosh(im)));
} else {
tmp = cos(re) * (1.0 + (im * (im * 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.5d0 + ((im * im) * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)))
if (im <= 0.5d0) then
tmp = (cos(re) * (-0.5d0)) / ((-0.5d0) / (1.0d0 + ((im * im) * t_0)))
else if (im <= 8.5d+50) then
tmp = 0.5d0 / (1.0d0 / (2.0d0 * cosh(im)))
else
tmp = cos(re) * (1.0d0 + (im * (im * t_0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)));
double tmp;
if (im <= 0.5) {
tmp = (Math.cos(re) * -0.5) / (-0.5 / (1.0 + ((im * im) * t_0)));
} else if (im <= 8.5e+50) {
tmp = 0.5 / (1.0 / (2.0 * Math.cosh(im)));
} else {
tmp = Math.cos(re) * (1.0 + (im * (im * t_0)));
}
return tmp;
}
def code(re, im): t_0 = 0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))) tmp = 0 if im <= 0.5: tmp = (math.cos(re) * -0.5) / (-0.5 / (1.0 + ((im * im) * t_0))) elif im <= 8.5e+50: tmp = 0.5 / (1.0 / (2.0 * math.cosh(im))) else: tmp = math.cos(re) * (1.0 + (im * (im * t_0))) return tmp
function code(re, im) t_0 = Float64(0.5 + Float64(Float64(im * im) * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)))) tmp = 0.0 if (im <= 0.5) tmp = Float64(Float64(cos(re) * -0.5) / Float64(-0.5 / Float64(1.0 + Float64(Float64(im * im) * t_0)))); elseif (im <= 8.5e+50) tmp = Float64(0.5 / Float64(1.0 / Float64(2.0 * cosh(im)))); else tmp = Float64(cos(re) * Float64(1.0 + Float64(im * Float64(im * t_0)))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))); tmp = 0.0; if (im <= 0.5) tmp = (cos(re) * -0.5) / (-0.5 / (1.0 + ((im * im) * t_0))); elseif (im <= 8.5e+50) tmp = 0.5 / (1.0 / (2.0 * cosh(im))); else tmp = cos(re) * (1.0 + (im * (im * t_0))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 + N[(N[(im * im), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.5], N[(N[(N[Cos[re], $MachinePrecision] * -0.5), $MachinePrecision] / N[(-0.5 / N[(1.0 + N[(N[(im * im), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.5e+50], N[(0.5 / N[(1.0 / N[(2.0 * N[Cosh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 + \left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\\
\mathbf{if}\;im \leq 0.5:\\
\;\;\;\;\frac{\cos re \cdot -0.5}{\frac{-0.5}{1 + \left(im \cdot im\right) \cdot t\_0}}\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+50}:\\
\;\;\;\;\frac{0.5}{\frac{1}{2 \cdot \cosh im}}\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(1 + im \cdot \left(im \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if im < 0.5Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
unpow2N/A
associate-*l*N/A
Simplified95.9%
frac-2negN/A
/-lowering-/.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
associate-/r*N/A
metadata-evalN/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
Applied egg-rr95.9%
if 0.5 < im < 8.49999999999999961e50Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified70.0%
if 8.49999999999999961e50 < im Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified98.5%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
Simplified98.5%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos re)
(+
1.0
(*
im
(*
im
(+
0.5
(*
(* im im)
(+
0.041666666666666664
(* (* im im) 0.001388888888888889))))))))))
(if (<= im 0.49)
t_0
(if (<= im 8.5e+50) (/ 0.5 (/ 1.0 (* 2.0 (cosh im)))) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + (im * (im * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))));
double tmp;
if (im <= 0.49) {
tmp = t_0;
} else if (im <= 8.5e+50) {
tmp = 0.5 / (1.0 / (2.0 * cosh(im)));
} 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) * (1.0d0 + (im * (im * (0.5d0 + ((im * im) * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)))))))
if (im <= 0.49d0) then
tmp = t_0
else if (im <= 8.5d+50) then
tmp = 0.5d0 / (1.0d0 / (2.0d0 * cosh(im)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + (im * (im * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))));
double tmp;
if (im <= 0.49) {
tmp = t_0;
} else if (im <= 8.5e+50) {
tmp = 0.5 / (1.0 / (2.0 * Math.cosh(im)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + (im * (im * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))) tmp = 0 if im <= 0.49: tmp = t_0 elif im <= 8.5e+50: tmp = 0.5 / (1.0 / (2.0 * math.cosh(im))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(Float64(im * im) * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)))))))) tmp = 0.0 if (im <= 0.49) tmp = t_0; elseif (im <= 8.5e+50) tmp = Float64(0.5 / Float64(1.0 / Float64(2.0 * cosh(im)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + (im * (im * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))); tmp = 0.0; if (im <= 0.49) tmp = t_0; elseif (im <= 8.5e+50) tmp = 0.5 / (1.0 / (2.0 * cosh(im))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * N[(0.5 + N[(N[(im * im), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.49], t$95$0, If[LessEqual[im, 8.5e+50], N[(0.5 / N[(1.0 / N[(2.0 * N[Cosh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{if}\;im \leq 0.49:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+50}:\\
\;\;\;\;\frac{0.5}{\frac{1}{2 \cdot \cosh im}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.48999999999999999 or 8.49999999999999961e50 < im Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified96.5%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
Simplified96.5%
if 0.48999999999999999 < im < 8.49999999999999961e50Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified70.0%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
(if (<= im 0.205)
t_0
(if (<= im 2.5e+77) (/ 0.5 (/ 1.0 (* 2.0 (cosh im)))) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= 0.205) {
tmp = t_0;
} else if (im <= 2.5e+77) {
tmp = 0.5 / (1.0 / (2.0 * cosh(im)));
} 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) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
if (im <= 0.205d0) then
tmp = t_0
else if (im <= 2.5d+77) then
tmp = 0.5d0 / (1.0d0 / (2.0d0 * cosh(im)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
double tmp;
if (im <= 0.205) {
tmp = t_0;
} else if (im <= 2.5e+77) {
tmp = 0.5 / (1.0 / (2.0 * Math.cosh(im)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) tmp = 0 if im <= 0.205: tmp = t_0 elif im <= 2.5e+77: tmp = 0.5 / (1.0 / (2.0 * math.cosh(im))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) tmp = 0.0 if (im <= 0.205) tmp = t_0; elseif (im <= 2.5e+77) tmp = Float64(0.5 / Float64(1.0 / Float64(2.0 * cosh(im)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); tmp = 0.0; if (im <= 0.205) tmp = t_0; elseif (im <= 2.5e+77) tmp = 0.5 / (1.0 / (2.0 * cosh(im))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.205], t$95$0, If[LessEqual[im, 2.5e+77], N[(0.5 / N[(1.0 / N[(2.0 * N[Cosh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{if}\;im \leq 0.205:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;\frac{0.5}{\frac{1}{2 \cdot \cosh im}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.204999999999999988 or 2.50000000000000002e77 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified95.2%
if 0.204999999999999988 < im < 2.50000000000000002e77Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified64.7%
Final simplification93.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (+ 1.0 (* 0.5 (* im im))))))
(if (<= im 0.039)
t_0
(if (<= im 1.35e+154) (/ 0.5 (/ 1.0 (* 2.0 (cosh im)))) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + (0.5 * (im * im)));
double tmp;
if (im <= 0.039) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = 0.5 / (1.0 / (2.0 * cosh(im)));
} 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) * (1.0d0 + (0.5d0 * (im * im)))
if (im <= 0.039d0) then
tmp = t_0
else if (im <= 1.35d+154) then
tmp = 0.5d0 / (1.0d0 / (2.0d0 * cosh(im)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + (0.5 * (im * im)));
double tmp;
if (im <= 0.039) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = 0.5 / (1.0 / (2.0 * Math.cosh(im)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + (0.5 * (im * im))) tmp = 0 if im <= 0.039: tmp = t_0 elif im <= 1.35e+154: tmp = 0.5 / (1.0 / (2.0 * math.cosh(im))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(0.5 * Float64(im * im)))) tmp = 0.0 if (im <= 0.039) tmp = t_0; elseif (im <= 1.35e+154) tmp = Float64(0.5 / Float64(1.0 / Float64(2.0 * cosh(im)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + (0.5 * (im * im))); tmp = 0.0; if (im <= 0.039) tmp = t_0; elseif (im <= 1.35e+154) tmp = 0.5 / (1.0 / (2.0 * cosh(im))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.039], t$95$0, If[LessEqual[im, 1.35e+154], N[(0.5 / N[(1.0 / N[(2.0 * N[Cosh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + 0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{if}\;im \leq 0.039:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{0.5}{\frac{1}{2 \cdot \cosh im}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.0389999999999999999 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6487.2%
Simplified87.2%
if 0.0389999999999999999 < im < 1.35000000000000003e154Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified76.3%
(FPCore (re im) :precision binary64 (if (<= im 1.18e-7) (cos re) (/ 0.5 (/ 1.0 (* 2.0 (cosh im))))))
double code(double re, double im) {
double tmp;
if (im <= 1.18e-7) {
tmp = cos(re);
} else {
tmp = 0.5 / (1.0 / (2.0 * cosh(im)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.18d-7) then
tmp = cos(re)
else
tmp = 0.5d0 / (1.0d0 / (2.0d0 * cosh(im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.18e-7) {
tmp = Math.cos(re);
} else {
tmp = 0.5 / (1.0 / (2.0 * Math.cosh(im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.18e-7: tmp = math.cos(re) else: tmp = 0.5 / (1.0 / (2.0 * math.cosh(im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.18e-7) tmp = cos(re); else tmp = Float64(0.5 / Float64(1.0 / Float64(2.0 * cosh(im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.18e-7) tmp = cos(re); else tmp = 0.5 / (1.0 / (2.0 * cosh(im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.18e-7], N[Cos[re], $MachinePrecision], N[(0.5 / N[(1.0 / N[(2.0 * N[Cosh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.18 \cdot 10^{-7}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{1}{2 \cdot \cosh im}}\\
\end{array}
\end{array}
if im < 1.18e-7Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6463.7%
Simplified63.7%
if 1.18e-7 < im Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified73.6%
(FPCore (re im)
:precision binary64
(if (<= im 1.18e-7)
(cos re)
(*
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))
(+ 1.0 (* re (* re (+ -0.5 (* 0.041666666666666664 (* re re)))))))))
double code(double re, double im) {
double tmp;
if (im <= 1.18e-7) {
tmp = cos(re);
} else {
tmp = (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) * (1.0 + (re * (re * (-0.5 + (0.041666666666666664 * (re * 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.18d-7) then
tmp = cos(re)
else
tmp = (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0)))) * (1.0d0 + (re * (re * ((-0.5d0) + (0.041666666666666664d0 * (re * re))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.18e-7) {
tmp = Math.cos(re);
} else {
tmp = (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) * (1.0 + (re * (re * (-0.5 + (0.041666666666666664 * (re * re))))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.18e-7: tmp = math.cos(re) else: tmp = (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) * (1.0 + (re * (re * (-0.5 + (0.041666666666666664 * (re * re)))))) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.18e-7) tmp = cos(re); else tmp = Float64(Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664)))) * Float64(1.0 + Float64(re * Float64(re * Float64(-0.5 + Float64(0.041666666666666664 * Float64(re * re))))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.18e-7) tmp = cos(re); else tmp = (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) * (1.0 + (re * (re * (-0.5 + (0.041666666666666664 * (re * re)))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.18e-7], N[Cos[re], $MachinePrecision], N[(N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(re * N[(-0.5 + N[(0.041666666666666664 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.18 \cdot 10^{-7}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right) \cdot \left(1 + re \cdot \left(re \cdot \left(-0.5 + 0.041666666666666664 \cdot \left(re \cdot re\right)\right)\right)\right)\\
\end{array}
\end{array}
if im < 1.18e-7Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6463.7%
Simplified63.7%
if 1.18e-7 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified77.4%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.7%
Simplified65.7%
Final simplification64.2%
(FPCore (re im)
:precision binary64
(if (<= re 1.25e+219)
(+
1.0
(*
im
(*
im
(+
0.5
(*
im
(* im (+ 0.041666666666666664 (* im (* im 0.001388888888888889)))))))))
(if (<= re 6.8e+284)
(+ 1.0 (* -0.5 (* re re)))
(*
(+ 1.0 (* 0.5 (* im im)))
(+ 1.0 (* re (* 0.041666666666666664 (* re (* re re)))))))))
double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (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 <= 1.25d+219) then
tmp = 1.0d0 + (im * (im * (0.5d0 + (im * (im * (0.041666666666666664d0 + (im * (im * 0.001388888888888889d0))))))))
else if (re <= 6.8d+284) then
tmp = 1.0d0 + ((-0.5d0) * (re * re))
else
tmp = (1.0d0 + (0.5d0 * (im * im))) * (1.0d0 + (re * (0.041666666666666664d0 * (re * (re * re)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (re * (re * re)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.25e+219: tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))))) elif re <= 6.8e+284: tmp = 1.0 + (-0.5 * (re * re)) else: tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (re * (re * re))))) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.25e+219) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(im * Float64(im * 0.001388888888888889))))))))); elseif (re <= 6.8e+284) tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); else tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(im * im))) * Float64(1.0 + Float64(re * Float64(0.041666666666666664 * Float64(re * Float64(re * re)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.25e+219) tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))))); elseif (re <= 6.8e+284) tmp = 1.0 + (-0.5 * (re * re)); else tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (re * (re * re))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.25e+219], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(im * N[(im * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.8e+284], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(0.041666666666666664 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.25 \cdot 10^{+219}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot 0.001388888888888889\right)\right)\right)\right)\right)\\
\mathbf{elif}\;re \leq 6.8 \cdot 10^{+284}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + re \cdot \left(0.041666666666666664 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\right)\\
\end{array}
\end{array}
if re < 1.25e219Initial program 100.0%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
clear-numN/A
flip3-+N/A
Applied egg-rr100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-*r*N/A
pow-sqrN/A
metadata-evalN/A
*-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
unpow2N/A
associate-*l*N/A
Simplified93.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6466.7%
Simplified66.7%
if 1.25e219 < re < 6.8000000000000006e284Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6423.9%
Simplified23.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.5%
Simplified50.5%
if 6.8000000000000006e284 < re Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.1%
Simplified36.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Final simplification65.4%
(FPCore (re im)
:precision binary64
(if (<= re 1.25e+219)
(+ 1.0 (* im (* im (+ 0.5 (* (* im im) 0.041666666666666664)))))
(if (<= re 6.8e+284)
(+ 1.0 (* -0.5 (* re re)))
(*
(+ 1.0 (* 0.5 (* im im)))
(+ 1.0 (* re (* 0.041666666666666664 (* re (* re re)))))))))
double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (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 <= 1.25d+219) then
tmp = 1.0d0 + (im * (im * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
else if (re <= 6.8d+284) then
tmp = 1.0d0 + ((-0.5d0) * (re * re))
else
tmp = (1.0d0 + (0.5d0 * (im * im))) * (1.0d0 + (re * (0.041666666666666664d0 * (re * (re * re)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (re * (re * re)))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.25e+219: tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664)))) elif re <= 6.8e+284: tmp = 1.0 + (-0.5 * (re * re)) else: tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (re * (re * re))))) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.25e+219) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); elseif (re <= 6.8e+284) tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); else tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(im * im))) * Float64(1.0 + Float64(re * Float64(0.041666666666666664 * Float64(re * Float64(re * re)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.25e+219) tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664)))); elseif (re <= 6.8e+284) tmp = 1.0 + (-0.5 * (re * re)); else tmp = (1.0 + (0.5 * (im * im))) * (1.0 + (re * (0.041666666666666664 * (re * (re * re))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.25e+219], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.8e+284], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(0.041666666666666664 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.25 \cdot 10^{+219}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{elif}\;re \leq 6.8 \cdot 10^{+284}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + 0.5 \cdot \left(im \cdot im\right)\right) \cdot \left(1 + re \cdot \left(0.041666666666666664 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\right)\\
\end{array}
\end{array}
if re < 1.25e219Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified90.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.0%
Simplified65.0%
if 1.25e219 < re < 6.8000000000000006e284Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6423.9%
Simplified23.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.5%
Simplified50.5%
if 6.8000000000000006e284 < re Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.1%
Simplified36.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Final simplification63.9%
(FPCore (re im)
:precision binary64
(if (<= re 1.25e+219)
(+ 1.0 (* im (* im (+ 0.5 (* (* im im) 0.041666666666666664)))))
(if (<= re 6.8e+284)
(+ 1.0 (* -0.5 (* re re)))
(+ 1.0 (* 0.041666666666666664 (* (* re re) (* re re)))))))
double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = 1.0 + (0.041666666666666664 * ((re * 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 <= 1.25d+219) then
tmp = 1.0d0 + (im * (im * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
else if (re <= 6.8d+284) then
tmp = 1.0d0 + ((-0.5d0) * (re * re))
else
tmp = 1.0d0 + (0.041666666666666664d0 * ((re * re) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.25e+219: tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664)))) elif re <= 6.8e+284: tmp = 1.0 + (-0.5 * (re * re)) else: tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.25e+219) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); elseif (re <= 6.8e+284) tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); else tmp = Float64(1.0 + Float64(0.041666666666666664 * Float64(Float64(re * re) * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.25e+219) tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664)))); elseif (re <= 6.8e+284) tmp = 1.0 + (-0.5 * (re * re)); else tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.25e+219], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.8e+284], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.041666666666666664 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.25 \cdot 10^{+219}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{elif}\;re \leq 6.8 \cdot 10^{+284}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.041666666666666664 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 1.25e219Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified90.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.0%
Simplified65.0%
if 1.25e219 < re < 6.8000000000000006e284Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6423.9%
Simplified23.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.5%
Simplified50.5%
if 6.8000000000000006e284 < re Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.1%
Simplified36.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Final simplification63.9%
(FPCore (re im)
:precision binary64
(if (<= re 1.25e+219)
(+ 1.0 (* im (* im (* (* im im) 0.041666666666666664))))
(if (<= re 6.8e+284)
(+ 1.0 (* -0.5 (* re re)))
(+ 1.0 (* 0.041666666666666664 (* (* re re) (* re re)))))))
double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * ((im * im) * 0.041666666666666664)));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = 1.0 + (0.041666666666666664 * ((re * 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 <= 1.25d+219) then
tmp = 1.0d0 + (im * (im * ((im * im) * 0.041666666666666664d0)))
else if (re <= 6.8d+284) then
tmp = 1.0d0 + ((-0.5d0) * (re * re))
else
tmp = 1.0d0 + (0.041666666666666664d0 * ((re * re) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (im * (im * ((im * im) * 0.041666666666666664)));
} else if (re <= 6.8e+284) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.25e+219: tmp = 1.0 + (im * (im * ((im * im) * 0.041666666666666664))) elif re <= 6.8e+284: tmp = 1.0 + (-0.5 * (re * re)) else: tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.25e+219) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(Float64(im * im) * 0.041666666666666664)))); elseif (re <= 6.8e+284) tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); else tmp = Float64(1.0 + Float64(0.041666666666666664 * Float64(Float64(re * re) * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.25e+219) tmp = 1.0 + (im * (im * ((im * im) * 0.041666666666666664))); elseif (re <= 6.8e+284) tmp = 1.0 + (-0.5 * (re * re)); else tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.25e+219], N[(1.0 + N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.8e+284], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.041666666666666664 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.25 \cdot 10^{+219}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\mathbf{elif}\;re \leq 6.8 \cdot 10^{+284}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.041666666666666664 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 1.25e219Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified90.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.0%
Simplified65.0%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6464.9%
Simplified64.9%
if 1.25e219 < re < 6.8000000000000006e284Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6423.9%
Simplified23.9%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.5%
Simplified50.5%
if 6.8000000000000006e284 < re Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6436.1%
Simplified36.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.6%
Simplified50.6%
Final simplification63.7%
(FPCore (re im)
:precision binary64
(if (<= im 1650.0)
(+ 1.0 (* 0.5 (* im im)))
(if (<= im 2.2e+77)
(+ 1.0 (* 0.041666666666666664 (* (* re re) (* re re))))
(* im (* im (* (* im im) 0.041666666666666664))))))
double code(double re, double im) {
double tmp;
if (im <= 1650.0) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 2.2e+77) {
tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re)));
} else {
tmp = im * (im * ((im * im) * 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 <= 1650.0d0) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else if (im <= 2.2d+77) then
tmp = 1.0d0 + (0.041666666666666664d0 * ((re * re) * (re * re)))
else
tmp = im * (im * ((im * im) * 0.041666666666666664d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1650.0) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 2.2e+77) {
tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re)));
} else {
tmp = im * (im * ((im * im) * 0.041666666666666664));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1650.0: tmp = 1.0 + (0.5 * (im * im)) elif im <= 2.2e+77: tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re))) else: tmp = im * (im * ((im * im) * 0.041666666666666664)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1650.0) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); elseif (im <= 2.2e+77) tmp = Float64(1.0 + Float64(0.041666666666666664 * Float64(Float64(re * re) * Float64(re * re)))); else tmp = Float64(im * Float64(im * Float64(Float64(im * im) * 0.041666666666666664))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1650.0) tmp = 1.0 + (0.5 * (im * im)); elseif (im <= 2.2e+77) tmp = 1.0 + (0.041666666666666664 * ((re * re) * (re * re))); else tmp = im * (im * ((im * im) * 0.041666666666666664)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1650.0], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.2e+77], N[(1.0 + N[(0.041666666666666664 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1650:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 2.2 \cdot 10^{+77}:\\
\;\;\;\;1 + 0.041666666666666664 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 1650Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6485.1%
Simplified85.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.8%
Simplified54.8%
if 1650 < im < 2.2e77Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f643.8%
Simplified3.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6430.7%
Simplified30.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6430.7%
Simplified30.7%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6425.5%
Simplified25.5%
if 2.2e77 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6476.9%
Simplified76.9%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6476.9%
Simplified76.9%
(FPCore (re im)
:precision binary64
(if (<= im 0.0185)
(+ 1.0 (* 0.5 (* im im)))
(if (<= im 3.8e+73)
(* (* im im) (+ 0.5 (* (* re re) -0.25)))
(* im (* im (* (* im im) 0.041666666666666664))))))
double code(double re, double im) {
double tmp;
if (im <= 0.0185) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 3.8e+73) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = im * (im * ((im * im) * 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 <= 0.0185d0) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else if (im <= 3.8d+73) then
tmp = (im * im) * (0.5d0 + ((re * re) * (-0.25d0)))
else
tmp = im * (im * ((im * im) * 0.041666666666666664d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.0185) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 3.8e+73) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = im * (im * ((im * im) * 0.041666666666666664));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.0185: tmp = 1.0 + (0.5 * (im * im)) elif im <= 3.8e+73: tmp = (im * im) * (0.5 + ((re * re) * -0.25)) else: tmp = im * (im * ((im * im) * 0.041666666666666664)) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.0185) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); elseif (im <= 3.8e+73) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(re * re) * -0.25))); else tmp = Float64(im * Float64(im * Float64(Float64(im * im) * 0.041666666666666664))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.0185) tmp = 1.0 + (0.5 * (im * im)); elseif (im <= 3.8e+73) tmp = (im * im) * (0.5 + ((re * re) * -0.25)); else tmp = im * (im * ((im * im) * 0.041666666666666664)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.0185], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8e+73], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.0185:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 3.8 \cdot 10^{+73}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 0.0184999999999999991Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6485.2%
Simplified85.2%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6455.1%
Simplified55.1%
if 0.0184999999999999991 < im < 3.80000000000000022e73Initial program 99.9%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f647.1%
Simplified7.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6420.7%
Simplified20.7%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6420.7%
Simplified20.7%
if 3.80000000000000022e73 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified98.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7%
Simplified75.7%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7%
Simplified75.7%
(FPCore (re im)
:precision binary64
(if (<= im 29000000.0)
(+ 1.0 (* 0.5 (* im im)))
(if (<= im 3.8e+73)
(+ 1.0 (* -0.5 (* re re)))
(* im (* im (* (* im im) 0.041666666666666664))))))
double code(double re, double im) {
double tmp;
if (im <= 29000000.0) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 3.8e+73) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = im * (im * ((im * im) * 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 <= 29000000.0d0) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else if (im <= 3.8d+73) then
tmp = 1.0d0 + ((-0.5d0) * (re * re))
else
tmp = im * (im * ((im * im) * 0.041666666666666664d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 29000000.0) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 3.8e+73) {
tmp = 1.0 + (-0.5 * (re * re));
} else {
tmp = im * (im * ((im * im) * 0.041666666666666664));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 29000000.0: tmp = 1.0 + (0.5 * (im * im)) elif im <= 3.8e+73: tmp = 1.0 + (-0.5 * (re * re)) else: tmp = im * (im * ((im * im) * 0.041666666666666664)) return tmp
function code(re, im) tmp = 0.0 if (im <= 29000000.0) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); elseif (im <= 3.8e+73) tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); else tmp = Float64(im * Float64(im * Float64(Float64(im * im) * 0.041666666666666664))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 29000000.0) tmp = 1.0 + (0.5 * (im * im)); elseif (im <= 3.8e+73) tmp = 1.0 + (-0.5 * (re * re)); else tmp = im * (im * ((im * im) * 0.041666666666666664)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 29000000.0], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8e+73], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 29000000:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 3.8 \cdot 10^{+73}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if im < 2.9e7Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.7%
Simplified84.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.5%
Simplified54.5%
if 2.9e7 < im < 3.80000000000000022e73Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f643.1%
Simplified3.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6416.0%
Simplified16.0%
if 3.80000000000000022e73 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified98.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7%
Simplified75.7%
Taylor expanded in im around inf
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7%
Simplified75.7%
Final simplification56.6%
(FPCore (re im) :precision binary64 (if (<= re 1.25e+219) (+ 1.0 (* 0.5 (* im im))) (+ 1.0 (* -0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = 1.0 + (-0.5 * (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 <= 1.25d+219) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else
tmp = 1.0d0 + ((-0.5d0) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.25e+219) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.25e+219: tmp = 1.0 + (0.5 * (im * im)) else: tmp = 1.0 + (-0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.25e+219) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); else tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.25e+219) tmp = 1.0 + (0.5 * (im * im)); else tmp = 1.0 + (-0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.25e+219], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.25 \cdot 10^{+219}:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 1.25e219Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6477.0%
Simplified77.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6452.7%
Simplified52.7%
if 1.25e219 < re Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6427.3%
Simplified27.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6440.5%
Simplified40.5%
Final simplification51.7%
(FPCore (re im) :precision binary64 (if (<= im 0.0185) 1.0 (* im (* 0.5 im))))
double code(double re, double im) {
double tmp;
if (im <= 0.0185) {
tmp = 1.0;
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.0185d0) then
tmp = 1.0d0
else
tmp = im * (0.5d0 * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.0185) {
tmp = 1.0;
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.0185: tmp = 1.0 else: tmp = im * (0.5 * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.0185) tmp = 1.0; else tmp = Float64(im * Float64(0.5 * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.0185) tmp = 1.0; else tmp = im * (0.5 * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.0185], 1.0, N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.0185:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot im\right)\\
\end{array}
\end{array}
if im < 0.0184999999999999991Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6463.8%
Simplified63.8%
Taylor expanded in re around 0
Simplified37.4%
if 0.0184999999999999991 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified76.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6458.0%
Simplified58.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6433.7%
Simplified33.7%
Taylor expanded in im around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6433.7%
Simplified33.7%
Final simplification36.4%
(FPCore (re im) :precision binary64 (+ 1.0 (* 0.5 (* im im))))
double code(double re, double im) {
return 1.0 + (0.5 * (im * im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + (0.5d0 * (im * im))
end function
public static double code(double re, double im) {
return 1.0 + (0.5 * (im * im));
}
def code(re, im): return 1.0 + (0.5 * (im * im))
function code(re, im) return Float64(1.0 + Float64(0.5 * Float64(im * im))) end
function tmp = code(re, im) tmp = 1.0 + (0.5 * (im * im)); end
code[re_, im_] := N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot \left(im \cdot im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.0%
Simplified75.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6449.2%
Simplified49.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
cos-lowering-cos.f6447.4%
Simplified47.4%
Taylor expanded in re around 0
Simplified27.8%
herbie shell --seed 2024144
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))