
(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
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
(FPCore (re im)
:precision binary64
(if (<= (cos re) 0.983)
(*
(* (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.983) {
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.983d0) 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.983) {
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.983: 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.983) tmp = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(Float64(im * im) * Float64(1.0 + Float64(Float64(im * 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.983) 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.983], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(N[(im * im), $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.08333333333333333 + N[(N[(im * im), $MachinePrecision] * 0.002777777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cosh[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.983:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(2 + \left(im \cdot im\right) \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.08333333333333333 + \left(im \cdot im\right) \cdot 0.002777777777777778\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im\\
\end{array}
\end{array}
if (cos.f64 re) < 0.982999999999999985Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.3%
Simplified96.3%
if 0.982999999999999985 < (cos.f64 re) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified99.9%
*-rgt-identityN/A
cosh-lowering-cosh.f6499.9%
Applied egg-rr99.9%
Final simplification98.1%
(FPCore (re im)
:precision binary64
(if (<= (cos re) 0.983)
(*
(cos re)
(+ 1.0 (* (* im im) (+ 0.5 (* im (* im 0.041666666666666664))))))
(cosh im)))
double code(double re, double im) {
double tmp;
if (cos(re) <= 0.983) {
tmp = cos(re) * (1.0 + ((im * im) * (0.5 + (im * (im * 0.041666666666666664)))));
} 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.983d0) then
tmp = cos(re) * (1.0d0 + ((im * im) * (0.5d0 + (im * (im * 0.041666666666666664d0)))))
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.983) {
tmp = Math.cos(re) * (1.0 + ((im * im) * (0.5 + (im * (im * 0.041666666666666664)))));
} else {
tmp = Math.cosh(im);
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= 0.983: tmp = math.cos(re) * (1.0 + ((im * im) * (0.5 + (im * (im * 0.041666666666666664))))) else: tmp = math.cosh(im) return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= 0.983) tmp = Float64(cos(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(im * Float64(im * 0.041666666666666664)))))); else tmp = cosh(im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= 0.983) tmp = cos(re) * (1.0 + ((im * im) * (0.5 + (im * (im * 0.041666666666666664))))); else tmp = cosh(im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.983], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(im * N[(im * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cosh[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.983:\\
\;\;\;\;\cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + im \cdot \left(im \cdot 0.041666666666666664\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh im\\
\end{array}
\end{array}
if (cos.f64 re) < 0.982999999999999985Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
Simplified93.4%
if 0.982999999999999985 < (cos.f64 re) Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified99.9%
*-rgt-identityN/A
cosh-lowering-cosh.f6499.9%
Applied egg-rr99.9%
(FPCore (re im) :precision binary64 (let* ((t_0 (* (* (cos re) 0.5) (+ 2.0 (* im im))))) (if (<= im 0.00013) t_0 (if (<= im 1.5e+153) (cosh im) t_0))))
double code(double re, double im) {
double t_0 = (cos(re) * 0.5) * (2.0 + (im * im));
double tmp;
if (im <= 0.00013) {
tmp = t_0;
} else if (im <= 1.5e+153) {
tmp = 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) * 0.5d0) * (2.0d0 + (im * im))
if (im <= 0.00013d0) then
tmp = t_0
else if (im <= 1.5d+153) then
tmp = 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) * 0.5) * (2.0 + (im * im));
double tmp;
if (im <= 0.00013) {
tmp = t_0;
} else if (im <= 1.5e+153) {
tmp = Math.cosh(im);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.cos(re) * 0.5) * (2.0 + (im * im)) tmp = 0 if im <= 0.00013: tmp = t_0 elif im <= 1.5e+153: tmp = math.cosh(im) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(cos(re) * 0.5) * Float64(2.0 + Float64(im * im))) tmp = 0.0 if (im <= 0.00013) tmp = t_0; elseif (im <= 1.5e+153) tmp = cosh(im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (cos(re) * 0.5) * (2.0 + (im * im)); tmp = 0.0; if (im <= 0.00013) tmp = t_0; elseif (im <= 1.5e+153) tmp = cosh(im); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.00013], t$95$0, If[LessEqual[im, 1.5e+153], N[Cosh[im], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\cos re \cdot 0.5\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq 0.00013:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+153}:\\
\;\;\;\;\cosh im\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 1.29999999999999989e-4 or 1.50000000000000009e153 < im Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6485.7%
Simplified85.7%
if 1.29999999999999989e-4 < im < 1.50000000000000009e153Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified70.2%
*-rgt-identityN/A
cosh-lowering-cosh.f6470.2%
Applied egg-rr70.2%
Final simplification83.7%
(FPCore (re im) :precision binary64 (if (<= im 0.000115) (cos re) (cosh im)))
double code(double re, double im) {
double tmp;
if (im <= 0.000115) {
tmp = cos(re);
} 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 (im <= 0.000115d0) then
tmp = cos(re)
else
tmp = cosh(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.000115) {
tmp = Math.cos(re);
} else {
tmp = Math.cosh(im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.000115: tmp = math.cos(re) else: tmp = math.cosh(im) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.000115) tmp = cos(re); else tmp = cosh(im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.000115) tmp = cos(re); else tmp = cosh(im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.000115], N[Cos[re], $MachinePrecision], N[Cosh[im], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.000115:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;\cosh im\\
\end{array}
\end{array}
if im < 1.15e-4Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6465.2%
Simplified65.2%
if 1.15e-4 < im Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified77.5%
*-rgt-identityN/A
cosh-lowering-cosh.f6477.5%
Applied egg-rr77.5%
(FPCore (re im)
:precision binary64
(if (<= im 7e-5)
(cos re)
(*
(+ 0.5 (* re (* re (+ -0.25 (* (* re re) 0.020833333333333332)))))
(+ 2.0 (* im (* im (+ 1.0 (* (* im im) 0.08333333333333333))))))))
double code(double re, double im) {
double tmp;
if (im <= 7e-5) {
tmp = cos(re);
} else {
tmp = (0.5 + (re * (re * (-0.25 + ((re * re) * 0.020833333333333332))))) * (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 7d-5) then
tmp = cos(re)
else
tmp = (0.5d0 + (re * (re * ((-0.25d0) + ((re * re) * 0.020833333333333332d0))))) * (2.0d0 + (im * (im * (1.0d0 + ((im * im) * 0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 7e-5) {
tmp = Math.cos(re);
} else {
tmp = (0.5 + (re * (re * (-0.25 + ((re * re) * 0.020833333333333332))))) * (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333)))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 7e-5: tmp = math.cos(re) else: tmp = (0.5 + (re * (re * (-0.25 + ((re * re) * 0.020833333333333332))))) * (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))) return tmp
function code(re, im) tmp = 0.0 if (im <= 7e-5) tmp = cos(re); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * Float64(-0.25 + Float64(Float64(re * re) * 0.020833333333333332))))) * Float64(2.0 + Float64(im * Float64(im * Float64(1.0 + Float64(Float64(im * im) * 0.08333333333333333)))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 7e-5) tmp = cos(re); else tmp = (0.5 + (re * (re * (-0.25 + ((re * re) * 0.020833333333333332))))) * (2.0 + (im * (im * (1.0 + ((im * im) * 0.08333333333333333))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 7e-5], N[Cos[re], $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * N[(-0.25 + N[(N[(re * re), $MachinePrecision] * 0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * N[(im * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot \left(-0.25 + \left(re \cdot re\right) \cdot 0.020833333333333332\right)\right)\right) \cdot \left(2 + im \cdot \left(im \cdot \left(1 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if im < 6.9999999999999994e-5Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6465.2%
Simplified65.2%
if 6.9999999999999994e-5 < 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-*.f6482.8%
Simplified82.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-*.f6465.9%
Simplified65.9%
(FPCore (re im)
:precision binary64
(+
1.0
(*
(* im im)
(+
0.5
(*
(* im im)
(+ 0.041666666666666664 (* (* im im) 0.001388888888888889)))))))
double code(double re, double im) {
return 1.0 + ((im * im) * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + ((im * im) * (0.5d0 + ((im * im) * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)))))
end function
public static double code(double re, double im) {
return 1.0 + ((im * im) * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))));
}
def code(re, im): return 1.0 + ((im * im) * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))
function code(re, im) return Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(im * im) * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)))))) end
function tmp = code(re, im) tmp = 1.0 + ((im * im) * (0.5 + ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))); end
code[re_, im_] := N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)
\end{array}
Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified64.6%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6459.4%
Simplified59.4%
(FPCore (re im) :precision binary64 (+ 1.0 (* (* im im) (* (* im im) (+ 0.041666666666666664 (* (* im im) 0.001388888888888889))))))
double code(double re, double im) {
return 1.0 + ((im * im) * ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + ((im * im) * ((im * im) * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0))))
end function
public static double code(double re, double im) {
return 1.0 + ((im * im) * ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))));
}
def code(re, im): return 1.0 + ((im * im) * ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))
function code(re, im) return Float64(1.0 + Float64(Float64(im * im) * Float64(Float64(im * im) * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889))))) end
function tmp = code(re, im) tmp = 1.0 + ((im * im) * ((im * im) * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))); end
code[re_, im_] := N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(im \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)
\end{array}
Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified64.6%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6459.4%
Simplified59.4%
Taylor expanded in im around inf
metadata-evalN/A
pow-plusN/A
metadata-evalN/A
pow-plusN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6459.0%
Simplified59.0%
(FPCore (re im) :precision binary64 (if (<= im 2.0) (+ 1.0 (* 0.5 (* im im))) (* (* im im) (+ 0.5 (* (* im im) 0.041666666666666664)))))
double code(double re, double im) {
double tmp;
if (im <= 2.0) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = (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 (im <= 2.0d0) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else
tmp = (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 (im <= 2.0) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = (im * im) * (0.5 + ((im * im) * 0.041666666666666664));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.0: tmp = 1.0 + (0.5 * (im * im)) else: tmp = (im * im) * (0.5 + ((im * im) * 0.041666666666666664)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.0) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); else tmp = 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 (im <= 2.0) tmp = 1.0 + (0.5 * (im * im)); else tmp = (im * im) * (0.5 + ((im * im) * 0.041666666666666664)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.0], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\\
\end{array}
\end{array}
if im < 2Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6483.7%
Simplified83.7%
Taylor expanded in re around 0
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.8%
Simplified46.8%
if 2 < im Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/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-*.f6465.8%
Simplified65.8%
Taylor expanded in im around inf
metadata-evalN/A
pow-plusN/A
unpow3N/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.8%
Simplified65.8%
(FPCore (re im) :precision binary64 (if (<= im 4.2e+32) 1.0 (if (<= im 1.66e+131) (* (* re re) -0.5) (* 0.5 (* im im)))))
double code(double re, double im) {
double tmp;
if (im <= 4.2e+32) {
tmp = 1.0;
} else if (im <= 1.66e+131) {
tmp = (re * re) * -0.5;
} else {
tmp = 0.5 * (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 <= 4.2d+32) then
tmp = 1.0d0
else if (im <= 1.66d+131) then
tmp = (re * re) * (-0.5d0)
else
tmp = 0.5d0 * (im * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.2e+32) {
tmp = 1.0;
} else if (im <= 1.66e+131) {
tmp = (re * re) * -0.5;
} else {
tmp = 0.5 * (im * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.2e+32: tmp = 1.0 elif im <= 1.66e+131: tmp = (re * re) * -0.5 else: tmp = 0.5 * (im * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.2e+32) tmp = 1.0; elseif (im <= 1.66e+131) tmp = Float64(Float64(re * re) * -0.5); else tmp = Float64(0.5 * Float64(im * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.2e+32) tmp = 1.0; elseif (im <= 1.66e+131) tmp = (re * re) * -0.5; else tmp = 0.5 * (im * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.2e+32], 1.0, If[LessEqual[im, 1.66e+131], N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision], N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.2 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{elif}\;im \leq 1.66 \cdot 10^{+131}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot im\right)\\
\end{array}
\end{array}
if im < 4.2000000000000001e32Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6463.0%
Simplified63.0%
Taylor expanded in re around 0
Simplified34.6%
if 4.2000000000000001e32 < im < 1.65999999999999992e131Initial 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-*.f6427.4%
Simplified27.4%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.6%
Simplified26.6%
if 1.65999999999999992e131 < im Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/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-*.f6487.2%
Simplified87.2%
Taylor expanded in im around inf
metadata-evalN/A
pow-plusN/A
unpow3N/A
unpow2N/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
+-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6487.2%
Simplified87.2%
Taylor expanded in im around 0
Simplified73.4%
Final simplification39.9%
(FPCore (re im) :precision binary64 (+ 1.0 (* (* im im) (* 0.001388888888888889 (* im (* im (* im im)))))))
double code(double re, double im) {
return 1.0 + ((im * im) * (0.001388888888888889 * (im * (im * (im * im)))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + ((im * im) * (0.001388888888888889d0 * (im * (im * (im * im)))))
end function
public static double code(double re, double im) {
return 1.0 + ((im * im) * (0.001388888888888889 * (im * (im * (im * im)))));
}
def code(re, im): return 1.0 + ((im * im) * (0.001388888888888889 * (im * (im * (im * im)))))
function code(re, im) return Float64(1.0 + Float64(Float64(im * im) * Float64(0.001388888888888889 * Float64(im * Float64(im * Float64(im * im)))))) end
function tmp = code(re, im) tmp = 1.0 + ((im * im) * (0.001388888888888889 * (im * (im * (im * im))))); end
code[re_, im_] := N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.001388888888888889 * N[(im * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(im \cdot im\right) \cdot \left(0.001388888888888889 \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\right)
\end{array}
Initial program 100.0%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
div-invN/A
+-commutativeN/A
cosh-defN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified64.6%
Taylor expanded in im around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6459.4%
Simplified59.4%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
cube-unmultN/A
unpow2N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6459.0%
Simplified59.0%
(FPCore (re im) :precision binary64 (if (<= im 3.5) (+ 1.0 (* 0.5 (* im im))) (* 0.041666666666666664 (* im (* im (* im im))))))
double code(double re, double im) {
double tmp;
if (im <= 3.5) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = 0.041666666666666664 * (im * (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 <= 3.5d0) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else
tmp = 0.041666666666666664d0 * (im * (im * (im * im)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.5) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = 0.041666666666666664 * (im * (im * (im * im)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.5: tmp = 1.0 + (0.5 * (im * im)) else: tmp = 0.041666666666666664 * (im * (im * (im * im))) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.5) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); else tmp = Float64(0.041666666666666664 * Float64(im * Float64(im * Float64(im * im)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.5) tmp = 1.0 + (0.5 * (im * im)); else tmp = 0.041666666666666664 * (im * (im * (im * im))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.5], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(im * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.5:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right)\\
\end{array}
\end{array}
if im < 3.5Initial program 100.0%
Taylor expanded in im around 0
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6483.7%
Simplified83.7%
Taylor expanded in re around 0
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.8%
Simplified46.8%
if 3.5 < im Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/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-*.f6465.8%
Simplified65.8%
Taylor expanded in im around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.8%
Simplified65.8%
(FPCore (re im) :precision binary64 (+ 1.0 (* im (* im (+ 0.5 (* (* im im) 0.041666666666666664))))))
double code(double re, double im) {
return 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + (im * (im * (0.5d0 + ((im * im) * 0.041666666666666664d0))))
end function
public static double code(double re, double im) {
return 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))));
}
def code(re, im): return 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664))))
function code(re, im) return Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(Float64(im * im) * 0.041666666666666664))))) end
function tmp = code(re, im) tmp = 1.0 + (im * (im * (0.5 + ((im * im) * 0.041666666666666664)))); end
code[re_, im_] := N[(1.0 + N[(im * N[(im * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + im \cdot \left(im \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
Simplified91.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-*.f6458.2%
Simplified58.2%
(FPCore (re im) :precision binary64 (+ 1.0 (* im (* im (* (* im im) 0.041666666666666664)))))
double code(double re, double im) {
return 1.0 + (im * (im * ((im * im) * 0.041666666666666664)));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + (im * (im * ((im * im) * 0.041666666666666664d0)))
end function
public static double code(double re, double im) {
return 1.0 + (im * (im * ((im * im) * 0.041666666666666664)));
}
def code(re, im): return 1.0 + (im * (im * ((im * im) * 0.041666666666666664)))
function code(re, im) return Float64(1.0 + Float64(im * Float64(im * Float64(Float64(im * im) * 0.041666666666666664)))) end
function tmp = code(re, im) tmp = 1.0 + (im * (im * ((im * im) * 0.041666666666666664))); end
code[re_, im_] := N[(1.0 + N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + im \cdot \left(im \cdot \left(\left(im \cdot im\right) \cdot 0.041666666666666664\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
*-rgt-identityN/A
associate-*r*N/A
distribute-rgt-outN/A
associate-*r*N/A
distribute-lft-outN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-inN/A
Simplified91.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-*.f6458.2%
Simplified58.2%
Taylor expanded in im around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6457.9%
Simplified57.9%
(FPCore (re im) :precision binary64 (if (<= im 4.8e+32) 1.0 (* (* re re) -0.5)))
double code(double re, double im) {
double tmp;
if (im <= 4.8e+32) {
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 <= 4.8d+32) 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 <= 4.8e+32) {
tmp = 1.0;
} else {
tmp = (re * re) * -0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.8e+32: tmp = 1.0 else: tmp = (re * re) * -0.5 return tmp
function code(re, im) tmp = 0.0 if (im <= 4.8e+32) 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 <= 4.8e+32) tmp = 1.0; else tmp = (re * re) * -0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.8e+32], 1.0, N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.8 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -0.5\\
\end{array}
\end{array}
if im < 4.79999999999999983e32Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6463.0%
Simplified63.0%
Taylor expanded in re around 0
Simplified34.6%
if 4.79999999999999983e32 < 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-*.f6414.0%
Simplified14.0%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6413.2%
Simplified13.2%
Final simplification29.7%
(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
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f6475.4%
Simplified75.4%
Taylor expanded in re around 0
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.2%
Simplified46.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.f6449.2%
Simplified49.2%
Taylor expanded in re around 0
Simplified27.2%
herbie shell --seed 2024164
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))