
(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 17 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 (* (cosh im) (cos re)))
double code(double re, double im) {
return cosh(im) * cos(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cosh(im) * cos(re)
end function
public static double code(double re, double im) {
return Math.cosh(im) * Math.cos(re);
}
def code(re, im): return math.cosh(im) * math.cos(re)
function code(re, im) return Float64(cosh(im) * cos(re)) end
function tmp = code(re, im) tmp = cosh(im) * cos(re); end
code[re_, im_] := N[(N[Cosh[im], $MachinePrecision] * N[Cos[re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh im \cdot \cos re
\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
(if (<= (cos re) 0.99998)
(*
(* (cos re) 0.5)
(+
2.0
(*
(* im im)
(+
1.0
(*
im
(* im (+ 0.08333333333333333 (* (* im im) 0.002777777777777778))))))))
(cosh im)))
double code(double re, double im) {
double tmp;
if (cos(re) <= 0.99998) {
tmp = (cos(re) * 0.5) * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + ((im * im) * 0.002777777777777778)))))));
} else {
tmp = cosh(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.99998d0) then
tmp = (cos(re) * 0.5d0) * (2.0d0 + ((im * im) * (1.0d0 + (im * (im * (0.08333333333333333d0 + ((im * im) * 0.002777777777777778d0)))))))
else
tmp = cosh(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.cos(re) <= 0.99998) {
tmp = (Math.cos(re) * 0.5) * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + ((im * im) * 0.002777777777777778)))))));
} else {
tmp = Math.cosh(im);
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= 0.99998: tmp = (math.cos(re) * 0.5) * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + ((im * im) * 0.002777777777777778))))))) else: tmp = math.cosh(im) return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= 0.99998) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(Float64(im * im) * Float64(1.0 + Float64(im * Float64(im * Float64(0.08333333333333333 + Float64(Float64(im * im) * 0.002777777777777778)))))))); else tmp = cosh(im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= 0.99998) tmp = (cos(re) * 0.5) * (2.0 + ((im * im) * (1.0 + (im * (im * (0.08333333333333333 + ((im * im) * 0.002777777777777778))))))); else tmp = cosh(im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.99998], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(N[(im * im), $MachinePrecision] * N[(1.0 + N[(im * N[(im * N[(0.08333333333333333 + N[(N[(im * im), $MachinePrecision] * 0.002777777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cosh[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.99998:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + im \cdot \left(im \cdot \left(0.08333333333333333 + \left(im \cdot im\right) \cdot 0.002777777777777778\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im\\
\end{array}
\end{array}
if (cos.f64 re) < 0.99997999999999998Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6492.7%
Simplified92.7%
if 0.99997999999999998 < (cos.f64 re) 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%
Taylor expanded in re around 0
Simplified100.0%
*-rgt-identityN/A
*-lft-identityN/A
cosh-lowering-cosh.f64100.0%
Applied egg-rr100.0%
Final simplification96.7%
(FPCore (re im)
:precision binary64
(if (<= im 9.5e-13)
(cos re)
(if (<= im 2e+79)
(cosh im)
(if (<= im 2.1e+146)
(*
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333)))))
(+ 0.5 (* -0.25 (* re re))))
(* (* (cos re) 0.5) (+ 2.0 (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 9.5e-13) {
tmp = cos(re);
} else if (im <= 2e+79) {
tmp = cosh(im);
} else if (im <= 2.1e+146) {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = (cos(re) * 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 <= 9.5d-13) then
tmp = cos(re)
else if (im <= 2d+79) then
tmp = cosh(im)
else if (im <= 2.1d+146) then
tmp = (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0))))) * (0.5d0 + ((-0.25d0) * (re * re)))
else
tmp = (cos(re) * 0.5d0) * (2.0d0 + (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.5e-13) {
tmp = Math.cos(re);
} else if (im <= 2e+79) {
tmp = Math.cosh(im);
} else if (im <= 2.1e+146) {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = (Math.cos(re) * 0.5) * (2.0 + (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.5e-13: tmp = math.cos(re) elif im <= 2e+79: tmp = math.cosh(im) elif im <= 2.1e+146: tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))) else: tmp = (math.cos(re) * 0.5) * (2.0 + (im * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.5e-13) tmp = cos(re); elseif (im <= 2e+79) tmp = cosh(im); elseif (im <= 2.1e+146) tmp = Float64(Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333))))) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); else tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.5e-13) tmp = cos(re); elseif (im <= 2e+79) tmp = cosh(im); elseif (im <= 2.1e+146) tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))); else tmp = (cos(re) * 0.5) * (2.0 + (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.5e-13], N[Cos[re], $MachinePrecision], If[LessEqual[im, 2e+79], N[Cosh[im], $MachinePrecision], If[LessEqual[im, 2.1e+146], N[(N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+79}:\\
\;\;\;\;\cosh im\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+146}:\\
\;\;\;\;\left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if im < 9.49999999999999991e-13Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6469.8%
Simplified69.8%
if 9.49999999999999991e-13 < im < 1.99999999999999993e79Initial 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%
Taylor expanded in re around 0
Simplified78.9%
*-rgt-identityN/A
*-lft-identityN/A
cosh-lowering-cosh.f6478.9%
Applied egg-rr78.9%
if 1.99999999999999993e79 < im < 2.1000000000000001e146Initial program 100.0%
Taylor expanded in im 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-*.f64100.0%
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified77.8%
if 2.1000000000000001e146 < im Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6497.1%
Simplified97.1%
Final simplification74.0%
(FPCore (re im)
:precision binary64
(if (<= re 1e-49)
(cosh im)
(*
(cos re)
(+ 1.0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))))
double code(double re, double im) {
double tmp;
if (re <= 1e-49) {
tmp = cosh(im);
} else {
tmp = cos(re) * (1.0 + ((im * im) * (0.5 + ((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 (re <= 1d-49) then
tmp = cosh(im)
else
tmp = cos(re) * (1.0d0 + ((im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1e-49) {
tmp = Math.cosh(im);
} else {
tmp = Math.cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1e-49: tmp = math.cosh(im) else: tmp = math.cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (re <= 1e-49) tmp = cosh(im); else tmp = Float64(cos(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1e-49) tmp = cosh(im); else tmp = cos(re) * (1.0 + ((im * im) * (0.5 + ((im * im) * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1e-49], N[Cosh[im], $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 10^{-49}:\\
\;\;\;\;\cosh im\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if re < 9.99999999999999936e-50Initial 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%
Taylor expanded in re around 0
Simplified74.1%
*-rgt-identityN/A
*-lft-identityN/A
cosh-lowering-cosh.f6474.1%
Applied egg-rr74.1%
if 9.99999999999999936e-50 < re Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified93.0%
(FPCore (re im)
:precision binary64
(if (<= im 9.5e-13)
(cos re)
(if (<= im 3e+79)
(cosh im)
(*
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333)))))
(+ 0.5 (* -0.25 (* re re)))))))
double code(double re, double im) {
double tmp;
if (im <= 9.5e-13) {
tmp = cos(re);
} else if (im <= 3e+79) {
tmp = cosh(im);
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (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 <= 9.5d-13) then
tmp = cos(re)
else if (im <= 3d+79) then
tmp = cosh(im)
else
tmp = (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0))))) * (0.5d0 + ((-0.25d0) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.5e-13) {
tmp = Math.cos(re);
} else if (im <= 3e+79) {
tmp = Math.cosh(im);
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.5e-13: tmp = math.cos(re) elif im <= 3e+79: tmp = math.cosh(im) else: tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.5e-13) tmp = cos(re); elseif (im <= 3e+79) tmp = cosh(im); else tmp = Float64(Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333))))) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.5e-13) tmp = cos(re); elseif (im <= 3e+79) tmp = cosh(im); else tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.5e-13], N[Cos[re], $MachinePrecision], If[LessEqual[im, 3e+79], N[Cosh[im], $MachinePrecision], N[(N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 3 \cdot 10^{+79}:\\
\;\;\;\;\cosh im\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 9.49999999999999991e-13Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6469.8%
Simplified69.8%
if 9.49999999999999991e-13 < im < 2.99999999999999974e79Initial 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%
Taylor expanded in re around 0
Simplified78.9%
*-rgt-identityN/A
*-lft-identityN/A
cosh-lowering-cosh.f6478.9%
Applied egg-rr78.9%
if 2.99999999999999974e79 < im Initial program 100.0%
Taylor expanded in im 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-*.f64100.0%
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified74.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* im im))) (t_1 (* im (* (* im im) 0.041666666666666664))))
(if (<= im 27000.0)
(cos re)
(if (<= im 7e+32)
(+
1.0
(*
(* re re)
(+
-0.5
(*
re
(*
re
(+ 0.041666666666666664 (* (* re re) -0.001388888888888889)))))))
(if (<= im 6.8e+51)
(+
1.0
(*
im
(/
(+ (* 0.125 t_0) (* t_0 (* t_0 (* t_0 7.233796296296296e-5))))
(+ (* (* im im) 0.25) (* t_1 (- t_1 (* im 0.5)))))))
(if (<= im 2e+82)
(+
1.0
(*
(* im im)
(+
0.5
(*
im
(*
im
(+
0.041666666666666664
(* im (* im 0.001388888888888889))))))))
(*
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333)))))
(+ 0.5 (* -0.25 (* re re))))))))))
double code(double re, double im) {
double t_0 = im * (im * im);
double t_1 = im * ((im * im) * 0.041666666666666664);
double tmp;
if (im <= 27000.0) {
tmp = cos(re);
} else if (im <= 7e+32) {
tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))));
} else if (im <= 6.8e+51) {
tmp = 1.0 + (im * (((0.125 * t_0) + (t_0 * (t_0 * (t_0 * 7.233796296296296e-5)))) / (((im * im) * 0.25) + (t_1 * (t_1 - (im * 0.5))))));
} else if (im <= 2e+82) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (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) :: t_1
real(8) :: tmp
t_0 = im * (im * im)
t_1 = im * ((im * im) * 0.041666666666666664d0)
if (im <= 27000.0d0) then
tmp = cos(re)
else if (im <= 7d+32) then
tmp = 1.0d0 + ((re * re) * ((-0.5d0) + (re * (re * (0.041666666666666664d0 + ((re * re) * (-0.001388888888888889d0)))))))
else if (im <= 6.8d+51) then
tmp = 1.0d0 + (im * (((0.125d0 * t_0) + (t_0 * (t_0 * (t_0 * 7.233796296296296d-5)))) / (((im * im) * 0.25d0) + (t_1 * (t_1 - (im * 0.5d0))))))
else if (im <= 2d+82) then
tmp = 1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.041666666666666664d0 + (im * (im * 0.001388888888888889d0)))))))
else
tmp = (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0))))) * (0.5d0 + ((-0.25d0) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (im * im);
double t_1 = im * ((im * im) * 0.041666666666666664);
double tmp;
if (im <= 27000.0) {
tmp = Math.cos(re);
} else if (im <= 7e+32) {
tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))));
} else if (im <= 6.8e+51) {
tmp = 1.0 + (im * (((0.125 * t_0) + (t_0 * (t_0 * (t_0 * 7.233796296296296e-5)))) / (((im * im) * 0.25) + (t_1 * (t_1 - (im * 0.5))))));
} else if (im <= 2e+82) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
}
return tmp;
}
def code(re, im): t_0 = im * (im * im) t_1 = im * ((im * im) * 0.041666666666666664) tmp = 0 if im <= 27000.0: tmp = math.cos(re) elif im <= 7e+32: tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))) elif im <= 6.8e+51: tmp = 1.0 + (im * (((0.125 * t_0) + (t_0 * (t_0 * (t_0 * 7.233796296296296e-5)))) / (((im * im) * 0.25) + (t_1 * (t_1 - (im * 0.5)))))) elif im <= 2e+82: tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))) else: tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))) return tmp
function code(re, im) t_0 = Float64(im * Float64(im * im)) t_1 = Float64(im * Float64(Float64(im * im) * 0.041666666666666664)) tmp = 0.0 if (im <= 27000.0) tmp = cos(re); elseif (im <= 7e+32) tmp = Float64(1.0 + Float64(Float64(re * re) * Float64(-0.5 + Float64(re * Float64(re * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.001388888888888889))))))); elseif (im <= 6.8e+51) tmp = Float64(1.0 + Float64(im * Float64(Float64(Float64(0.125 * t_0) + Float64(t_0 * Float64(t_0 * Float64(t_0 * 7.233796296296296e-5)))) / Float64(Float64(Float64(im * im) * 0.25) + Float64(t_1 * Float64(t_1 - Float64(im * 0.5))))))); elseif (im <= 2e+82) tmp = Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(im * Float64(im * 0.001388888888888889)))))))); else tmp = Float64(Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333))))) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (im * im); t_1 = im * ((im * im) * 0.041666666666666664); tmp = 0.0; if (im <= 27000.0) tmp = cos(re); elseif (im <= 7e+32) tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))); elseif (im <= 6.8e+51) tmp = 1.0 + (im * (((0.125 * t_0) + (t_0 * (t_0 * (t_0 * 7.233796296296296e-5)))) / (((im * im) * 0.25) + (t_1 * (t_1 - (im * 0.5)))))); elseif (im <= 2e+82) tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))); else tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 27000.0], N[Cos[re], $MachinePrecision], If[LessEqual[im, 7e+32], N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.5 + N[(re * N[(re * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.8e+51], N[(1.0 + N[(im * N[(N[(N[(0.125 * t$95$0), $MachinePrecision] + N[(t$95$0 * N[(t$95$0 * N[(t$95$0 * 7.233796296296296e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(im * im), $MachinePrecision] * 0.25), $MachinePrecision] + N[(t$95$1 * N[(t$95$1 - N[(im * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2e+82], N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(im * N[(im * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot im\right)\\
t_1 := im \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\mathbf{if}\;im \leq 27000:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+32}:\\
\;\;\;\;1 + \left(re \cdot re\right) \cdot \left(-0.5 + re \cdot \left(re \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.001388888888888889\right)\right)\right)\\
\mathbf{elif}\;im \leq 6.8 \cdot 10^{+51}:\\
\;\;\;\;1 + im \cdot \frac{0.125 \cdot t\_0 + t\_0 \cdot \left(t\_0 \cdot \left(t\_0 \cdot 7.233796296296296 \cdot 10^{-5}\right)\right)}{\left(im \cdot im\right) \cdot 0.25 + t\_1 \cdot \left(t\_1 - im \cdot 0.5\right)}\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+82}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 27000Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6469.5%
Simplified69.5%
if 27000 < im < 7.0000000000000002e32Initial 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
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-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-*.f6451.6%
Simplified51.6%
if 7.0000000000000002e32 < im < 6.79999999999999969e51Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified5.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-*.f645.3%
Simplified5.3%
distribute-rgt-inN/A
flip3-+N/A
/-lowering-/.f64N/A
Applied egg-rr100.0%
if 6.79999999999999969e51 < im < 1.9999999999999999e82Initial 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%
Taylor expanded in re around 0
Simplified100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
if 1.9999999999999999e82 < im Initial program 100.0%
Taylor expanded in im 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-*.f64100.0%
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified74.4%
Final simplification70.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664))))
(t_1 (* im (* im im))))
(if (<= im 7.5e+38)
(/ (+ 1.0 (* t_0 (* t_0 t_0))) (+ 1.0 (* t_0 (+ t_0 -1.0))))
(if (<= im 5e+77)
(+
1.0
(/
(* (* im im) (+ 0.125 (* t_1 (* t_1 7.233796296296296e-5))))
(+
0.25
(*
(* im im)
(- (* (* im im) 0.001736111111111111) 0.020833333333333332)))))
(*
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333)))))
(+ 0.5 (* -0.25 (* re re))))))))
double code(double re, double im) {
double t_0 = (im * im) * (0.5 + ((im * im) * 0.041666666666666664));
double t_1 = im * (im * im);
double tmp;
if (im <= 7.5e+38) {
tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0)));
} else if (im <= 5e+77) {
tmp = 1.0 + (((im * im) * (0.125 + (t_1 * (t_1 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (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) :: t_1
real(8) :: tmp
t_0 = (im * im) * (0.5d0 + ((im * im) * 0.041666666666666664d0))
t_1 = im * (im * im)
if (im <= 7.5d+38) then
tmp = (1.0d0 + (t_0 * (t_0 * t_0))) / (1.0d0 + (t_0 * (t_0 + (-1.0d0))))
else if (im <= 5d+77) then
tmp = 1.0d0 + (((im * im) * (0.125d0 + (t_1 * (t_1 * 7.233796296296296d-5)))) / (0.25d0 + ((im * im) * (((im * im) * 0.001736111111111111d0) - 0.020833333333333332d0))))
else
tmp = (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0))))) * (0.5d0 + ((-0.25d0) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (0.5 + ((im * im) * 0.041666666666666664));
double t_1 = im * (im * im);
double tmp;
if (im <= 7.5e+38) {
tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0)));
} else if (im <= 5e+77) {
tmp = 1.0 + (((im * im) * (0.125 + (t_1 * (t_1 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (0.5 + ((im * im) * 0.041666666666666664)) t_1 = im * (im * im) tmp = 0 if im <= 7.5e+38: tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0))) elif im <= 5e+77: tmp = 1.0 + (((im * im) * (0.125 + (t_1 * (t_1 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332)))) else: tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))) return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))) t_1 = Float64(im * Float64(im * im)) tmp = 0.0 if (im <= 7.5e+38) tmp = Float64(Float64(1.0 + Float64(t_0 * Float64(t_0 * t_0))) / Float64(1.0 + Float64(t_0 * Float64(t_0 + -1.0)))); elseif (im <= 5e+77) tmp = Float64(1.0 + Float64(Float64(Float64(im * im) * Float64(0.125 + Float64(t_1 * Float64(t_1 * 7.233796296296296e-5)))) / Float64(0.25 + Float64(Float64(im * im) * Float64(Float64(Float64(im * im) * 0.001736111111111111) - 0.020833333333333332))))); else tmp = Float64(Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333))))) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (0.5 + ((im * im) * 0.041666666666666664)); t_1 = im * (im * im); tmp = 0.0; if (im <= 7.5e+38) tmp = (1.0 + (t_0 * (t_0 * t_0))) / (1.0 + (t_0 * (t_0 + -1.0))); elseif (im <= 5e+77) tmp = 1.0 + (((im * im) * (0.125 + (t_1 * (t_1 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332)))); else tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 7.5e+38], N[(N[(1.0 + N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t$95$0 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5e+77], N[(1.0 + N[(N[(N[(im * im), $MachinePrecision] * N[(0.125 + N[(t$95$1 * N[(t$95$1 * 7.233796296296296e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.25 + N[(N[(im * im), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * 0.001736111111111111), $MachinePrecision] - 0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
t_1 := im \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 7.5 \cdot 10^{+38}:\\
\;\;\;\;\frac{1 + t\_0 \cdot \left(t\_0 \cdot t\_0\right)}{1 + t\_0 \cdot \left(t\_0 + -1\right)}\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+77}:\\
\;\;\;\;1 + \frac{\left(im \cdot im\right) \cdot \left(0.125 + t\_1 \cdot \left(t\_1 \cdot 7.233796296296296 \cdot 10^{-5}\right)\right)}{0.25 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.001736111111111111 - 0.020833333333333332\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 7.4999999999999999e38Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified88.9%
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-*.f6456.3%
Simplified56.3%
Applied egg-rr41.1%
if 7.4999999999999999e38 < im < 5.00000000000000004e77Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified6.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
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f646.5%
Simplified6.5%
associate-*r*N/A
flip3-+N/A
associate-*r/N/A
/-lowering-/.f64N/A
Applied egg-rr100.0%
if 5.00000000000000004e77 < im Initial program 100.0%
Taylor expanded in im 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-*.f64100.0%
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified75.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* im im))))
(if (<= im 2e+77)
(+
1.0
(/
(* (* im im) (+ 0.125 (* t_0 (* t_0 7.233796296296296e-5))))
(+
0.25
(*
(* im im)
(- (* (* im im) 0.001736111111111111) 0.020833333333333332)))))
(*
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333)))))
(+ 0.5 (* -0.25 (* re re)))))))
double code(double re, double im) {
double t_0 = im * (im * im);
double tmp;
if (im <= 2e+77) {
tmp = 1.0 + (((im * im) * (0.125 + (t_0 * (t_0 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (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 = im * (im * im)
if (im <= 2d+77) then
tmp = 1.0d0 + (((im * im) * (0.125d0 + (t_0 * (t_0 * 7.233796296296296d-5)))) / (0.25d0 + ((im * im) * (((im * im) * 0.001736111111111111d0) - 0.020833333333333332d0))))
else
tmp = (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0))))) * (0.5d0 + ((-0.25d0) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (im * im);
double tmp;
if (im <= 2e+77) {
tmp = 1.0 + (((im * im) * (0.125 + (t_0 * (t_0 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
}
return tmp;
}
def code(re, im): t_0 = im * (im * im) tmp = 0 if im <= 2e+77: tmp = 1.0 + (((im * im) * (0.125 + (t_0 * (t_0 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332)))) else: tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))) return tmp
function code(re, im) t_0 = Float64(im * Float64(im * im)) tmp = 0.0 if (im <= 2e+77) tmp = Float64(1.0 + Float64(Float64(Float64(im * im) * Float64(0.125 + Float64(t_0 * Float64(t_0 * 7.233796296296296e-5)))) / Float64(0.25 + Float64(Float64(im * im) * Float64(Float64(Float64(im * im) * 0.001736111111111111) - 0.020833333333333332))))); else tmp = Float64(Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333))))) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (im * im); tmp = 0.0; if (im <= 2e+77) tmp = 1.0 + (((im * im) * (0.125 + (t_0 * (t_0 * 7.233796296296296e-5)))) / (0.25 + ((im * im) * (((im * im) * 0.001736111111111111) - 0.020833333333333332)))); else tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2e+77], N[(1.0 + N[(N[(N[(im * im), $MachinePrecision] * N[(0.125 + N[(t$95$0 * N[(t$95$0 * 7.233796296296296e-5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.25 + N[(N[(im * im), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * 0.001736111111111111), $MachinePrecision] - 0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 2 \cdot 10^{+77}:\\
\;\;\;\;1 + \frac{\left(im \cdot im\right) \cdot \left(0.125 + t\_0 \cdot \left(t\_0 \cdot 7.233796296296296 \cdot 10^{-5}\right)\right)}{0.25 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot 0.001736111111111111 - 0.020833333333333332\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 1.99999999999999997e77Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified85.9%
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-*.f6454.4%
Simplified54.4%
associate-*r*N/A
flip3-+N/A
associate-*r/N/A
/-lowering-/.f64N/A
Applied egg-rr43.8%
if 1.99999999999999997e77 < im Initial program 100.0%
Taylor expanded in im 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-*.f64100.0%
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified75.0%
(FPCore (re im)
:precision binary64
(if (<= im 1e+81)
(+
1.0
(*
(* im im)
(+
0.5
(*
im
(* im (+ 0.041666666666666664 (* im (* im 0.001388888888888889))))))))
(*
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333)))))
(+ 0.5 (* -0.25 (* re re))))))
double code(double re, double im) {
double tmp;
if (im <= 1e+81) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (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 <= 1d+81) then
tmp = 1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.041666666666666664d0 + (im * (im * 0.001388888888888889d0)))))))
else
tmp = (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0))))) * (0.5d0 + ((-0.25d0) * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1e+81) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1e+81: tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))) else: tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (im <= 1e+81) tmp = Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(im * Float64(im * 0.001388888888888889)))))))); else tmp = Float64(Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333))))) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1e+81) tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))); else tmp = (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) * (0.5 + (-0.25 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1e+81], N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(im * N[(im * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 10^{+81}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 9.99999999999999921e80Initial 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%
Taylor expanded in re around 0
Simplified66.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6457.5%
Simplified57.5%
if 9.99999999999999921e80 < im Initial program 100.0%
Taylor expanded in im 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-*.f64100.0%
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified74.4%
(FPCore (re im)
:precision binary64
(if (<= re 5e+48)
(+
1.0
(*
(* im im)
(+
0.5
(*
im
(* im (+ 0.041666666666666664 (* im (* im 0.001388888888888889))))))))
(+
1.0
(*
(* re re)
(+
-0.5
(*
re
(*
re
(+ 0.041666666666666664 (* (* re re) -0.001388888888888889)))))))))
double code(double re, double im) {
double tmp;
if (re <= 5e+48) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 5d+48) then
tmp = 1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.041666666666666664d0 + (im * (im * 0.001388888888888889d0)))))))
else
tmp = 1.0d0 + ((re * re) * ((-0.5d0) + (re * (re * (0.041666666666666664d0 + ((re * re) * (-0.001388888888888889d0)))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5e+48) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5e+48: tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))) else: tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))) return tmp
function code(re, im) tmp = 0.0 if (re <= 5e+48) tmp = Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(im * Float64(im * 0.001388888888888889)))))))); else tmp = Float64(1.0 + Float64(Float64(re * re) * Float64(-0.5 + Float64(re * Float64(re * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.001388888888888889))))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5e+48) tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))); else tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5e+48], N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(im * N[(im * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.5 + N[(re * N[(re * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5 \cdot 10^{+48}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(re \cdot re\right) \cdot \left(-0.5 + re \cdot \left(re \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.001388888888888889\right)\right)\right)\\
\end{array}
\end{array}
if re < 4.99999999999999973e48Initial 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%
Taylor expanded in re around 0
Simplified74.1%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.7%
Simplified65.7%
if 4.99999999999999973e48 < re Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6454.8%
Simplified54.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-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-*.f6429.9%
Simplified29.9%
(FPCore (re im)
:precision binary64
(if (<= re 7e+84)
(+
1.0
(*
(* im im)
(+
0.5
(*
im
(* im (+ 0.041666666666666664 (* im (* im 0.001388888888888889))))))))
(* (+ 0.5 (* -0.25 (* re re))) (+ 2.0 (* im im)))))
double code(double re, double im) {
double tmp;
if (re <= 7e+84) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 7d+84) then
tmp = 1.0d0 + ((im * im) * (0.5d0 + (im * (im * (0.041666666666666664d0 + (im * (im * 0.001388888888888889d0)))))))
else
tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (2.0d0 + (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 7e+84) {
tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889)))))));
} else {
tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 7e+84: tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))) else: tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= 7e+84) tmp = Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(im * Float64(im * 0.001388888888888889)))))))); else tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(2.0 + Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 7e+84) tmp = 1.0 + ((im * im) * (0.5 + (im * (im * (0.041666666666666664 + (im * (im * 0.001388888888888889))))))); else tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 7e+84], N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(im * N[(im * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 7 \cdot 10^{+84}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + im \cdot \left(im \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if re < 6.9999999999999998e84Initial 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%
Taylor expanded in re around 0
Simplified73.6%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6465.3%
Simplified65.3%
if 6.9999999999999998e84 < re Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6429.7%
Simplified29.7%
Final simplification59.5%
(FPCore (re im)
:precision binary64
(if (<= im 36000.0)
(+ 1.0 (* 0.5 (* im im)))
(if (<= im 8.5e+32)
(+ 1.0 (* (* re re) -0.5))
(* im (* 0.041666666666666664 (* im (* im im)))))))
double code(double re, double im) {
double tmp;
if (im <= 36000.0) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 8.5e+32) {
tmp = 1.0 + ((re * re) * -0.5);
} else {
tmp = im * (0.041666666666666664 * (im * (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 <= 36000.0d0) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else if (im <= 8.5d+32) then
tmp = 1.0d0 + ((re * re) * (-0.5d0))
else
tmp = im * (0.041666666666666664d0 * (im * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 36000.0) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 8.5e+32) {
tmp = 1.0 + ((re * re) * -0.5);
} else {
tmp = im * (0.041666666666666664 * (im * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 36000.0: tmp = 1.0 + (0.5 * (im * im)) elif im <= 8.5e+32: tmp = 1.0 + ((re * re) * -0.5) else: tmp = im * (0.041666666666666664 * (im * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 36000.0) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); elseif (im <= 8.5e+32) tmp = Float64(1.0 + Float64(Float64(re * re) * -0.5)); else tmp = Float64(im * Float64(0.041666666666666664 * Float64(im * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 36000.0) tmp = 1.0 + (0.5 * (im * im)); elseif (im <= 8.5e+32) tmp = 1.0 + ((re * re) * -0.5); else tmp = im * (0.041666666666666664 * (im * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 36000.0], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.5e+32], N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(im * N[(0.041666666666666664 * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 36000:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+32}:\\
\;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.041666666666666664 \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\\
\end{array}
\end{array}
if im < 36000Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6484.7%
Simplified84.7%
Taylor expanded in re around 0
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.1%
Simplified54.1%
if 36000 < im < 8.4999999999999998e32Initial 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-*.f6444.9%
Simplified44.9%
if 8.4999999999999998e32 < im Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified82.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-*.f6452.2%
Simplified52.2%
Taylor expanded in im around inf
metadata-evalN/A
pow-plusN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6452.2%
Simplified52.2%
(FPCore (re im) :precision binary64 (if (<= re 7e+84) (+ 1.0 (* im (* im (+ 0.5 (* im (* im 0.041666666666666664)))))) (* (+ 0.5 (* -0.25 (* re re))) (+ 2.0 (* im im)))))
double code(double re, double im) {
double tmp;
if (re <= 7e+84) {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * 0.041666666666666664)))));
} else {
tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 7d+84) then
tmp = 1.0d0 + (im * (im * (0.5d0 + (im * (im * 0.041666666666666664d0)))))
else
tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (2.0d0 + (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 7e+84) {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * 0.041666666666666664)))));
} else {
tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 7e+84: tmp = 1.0 + (im * (im * (0.5 + (im * (im * 0.041666666666666664))))) else: tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im)) return tmp
function code(re, im) tmp = 0.0 if (re <= 7e+84) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * 0.041666666666666664)))))); else tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(2.0 + Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 7e+84) tmp = 1.0 + (im * (im * (0.5 + (im * (im * 0.041666666666666664))))); else tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 7e+84], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 7 \cdot 10^{+84}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if re < 6.9999999999999998e84Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-inN/A
Simplified87.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
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6462.9%
Simplified62.9%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6462.9%
Applied egg-rr62.9%
if 6.9999999999999998e84 < re Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6479.7%
Simplified79.7%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6429.7%
Simplified29.7%
Final simplification57.5%
(FPCore (re im) :precision binary64 (if (<= im 9e-22) 1.0 (* (+ 0.5 (* -0.25 (* re re))) (+ 2.0 (* im im)))))
double code(double re, double im) {
double tmp;
if (im <= 9e-22) {
tmp = 1.0;
} else {
tmp = (0.5 + (-0.25 * (re * re))) * (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 <= 9d-22) then
tmp = 1.0d0
else
tmp = (0.5d0 + ((-0.25d0) * (re * re))) * (2.0d0 + (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9e-22) {
tmp = 1.0;
} else {
tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9e-22: tmp = 1.0 else: tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 9e-22) tmp = 1.0; else tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(2.0 + Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9e-22) tmp = 1.0; else tmp = (0.5 + (-0.25 * (re * re))) * (2.0 + (im * im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9e-22], 1.0, N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(2 + im \cdot im\right)\\
\end{array}
\end{array}
if im < 8.99999999999999973e-22Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6469.8%
Simplified69.8%
Taylor expanded in re around 0
Simplified41.1%
if 8.99999999999999973e-22 < im Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6452.5%
Simplified52.5%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6452.9%
Simplified52.9%
Final simplification43.7%
(FPCore (re im) :precision binary64 (if (<= re 2.65e+154) (+ 1.0 (* 0.5 (* im im))) (* (* re re) -0.5)))
double code(double re, double im) {
double tmp;
if (re <= 2.65e+154) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = (re * re) * -0.5;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.65d+154) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else
tmp = (re * re) * (-0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.65e+154) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = (re * re) * -0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.65e+154: tmp = 1.0 + (0.5 * (im * im)) else: tmp = (re * re) * -0.5 return tmp
function code(re, im) tmp = 0.0 if (re <= 2.65e+154) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); else tmp = Float64(Float64(re * re) * -0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.65e+154) tmp = 1.0 + (0.5 * (im * im)); else tmp = (re * re) * -0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.65e+154], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.65 \cdot 10^{+154}:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -0.5\\
\end{array}
\end{array}
if re < 2.65000000000000012e154Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6478.0%
Simplified78.0%
Taylor expanded in re around 0
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.9%
Simplified53.9%
if 2.65000000000000012e154 < re Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6451.6%
Simplified51.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6432.0%
Simplified32.0%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6432.0%
Simplified32.0%
Final simplification51.7%
(FPCore (re im) :precision binary64 (if (<= im 36000.0) 1.0 (* (* re re) -0.5)))
double code(double re, double im) {
double tmp;
if (im <= 36000.0) {
tmp = 1.0;
} else {
tmp = (re * re) * -0.5;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 36000.0d0) then
tmp = 1.0d0
else
tmp = (re * re) * (-0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 36000.0) {
tmp = 1.0;
} else {
tmp = (re * re) * -0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 36000.0: tmp = 1.0 else: tmp = (re * re) * -0.5 return tmp
function code(re, im) tmp = 0.0 if (im <= 36000.0) tmp = 1.0; else tmp = Float64(Float64(re * re) * -0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 36000.0) tmp = 1.0; else tmp = (re * re) * -0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 36000.0], 1.0, N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 36000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -0.5\\
\end{array}
\end{array}
if im < 36000Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6469.2%
Simplified69.2%
Taylor expanded in re around 0
Simplified40.7%
if 36000 < im Initial 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-*.f6422.0%
Simplified22.0%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6421.2%
Simplified21.2%
Final simplification36.4%
(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.f6454.7%
Simplified54.7%
Taylor expanded in re around 0
Simplified32.3%
herbie shell --seed 2024186
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))