
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(-im) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.041666666666666664 (* (* im im) 0.001388888888888889))))
(if (<= im 0.45)
(* (cos re) (+ (* t_0 (* im (* im (* im im)))) (+ 1.0 (* (* im im) 0.5))))
(if (<= im 7e+51)
(* (cosh im) (+ 1.0 (* (* re re) -0.5)))
(* (cos re) (+ 1.0 (* im (* im (+ 0.5 (* im (* im t_0)))))))))))
double code(double re, double im) {
double t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889);
double tmp;
if (im <= 0.45) {
tmp = cos(re) * ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5)));
} else if (im <= 7e+51) {
tmp = cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * t_0))))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)
if (im <= 0.45d0) then
tmp = cos(re) * ((t_0 * (im * (im * (im * im)))) + (1.0d0 + ((im * im) * 0.5d0)))
else if (im <= 7d+51) then
tmp = cosh(im) * (1.0d0 + ((re * re) * (-0.5d0)))
else
tmp = cos(re) * (1.0d0 + (im * (im * (0.5d0 + (im * (im * t_0))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889);
double tmp;
if (im <= 0.45) {
tmp = Math.cos(re) * ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5)));
} else if (im <= 7e+51) {
tmp = Math.cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = Math.cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * t_0))))));
}
return tmp;
}
def code(re, im): t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889) tmp = 0 if im <= 0.45: tmp = math.cos(re) * ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) elif im <= 7e+51: tmp = math.cosh(im) * (1.0 + ((re * re) * -0.5)) else: tmp = math.cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * t_0)))))) return tmp
function code(re, im) t_0 = Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)) tmp = 0.0 if (im <= 0.45) tmp = Float64(cos(re) * Float64(Float64(t_0 * Float64(im * Float64(im * Float64(im * im)))) + Float64(1.0 + Float64(Float64(im * im) * 0.5)))); elseif (im <= 7e+51) tmp = Float64(cosh(im) * Float64(1.0 + Float64(Float64(re * re) * -0.5))); else tmp = Float64(cos(re) * Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * t_0))))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889); tmp = 0.0; if (im <= 0.45) tmp = cos(re) * ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))); elseif (im <= 7e+51) tmp = cosh(im) * (1.0 + ((re * re) * -0.5)); else tmp = cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * t_0)))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.45], N[(N[Cos[re], $MachinePrecision] * N[(N[(t$95$0 * N[(im * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7e+51], N[(N[Cosh[im], $MachinePrecision] * N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\\
\mathbf{if}\;im \leq 0.45:\\
\;\;\;\;\cos re \cdot \left(t\_0 \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + \left(im \cdot im\right) \cdot 0.5\right)\right)\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+51}:\\
\;\;\;\;\cosh im \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot t\_0\right)\right)\right)\right)\\
\end{array}
\end{array}
if im < 0.450000000000000011Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified94.2%
if 0.450000000000000011 < im < 7e51Initial 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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6492.3%
Simplified92.3%
if 7e51 < im 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 im around 0
Simplified100.0%
Final simplification95.2%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos re)
(+
1.0
(*
im
(*
im
(+
0.5
(*
im
(*
im
(+
0.041666666666666664
(* (* im im) 0.001388888888888889)))))))))))
(if (<= im 0.62)
t_0
(if (<= im 7e+51) (* (cosh im) (+ 1.0 (* (* re re) -0.5))) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))));
double tmp;
if (im <= 0.62) {
tmp = t_0;
} else if (im <= 7e+51) {
tmp = cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (1.0d0 + (im * (im * (0.5d0 + (im * (im * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0))))))))
if (im <= 0.62d0) then
tmp = t_0
else if (im <= 7d+51) then
tmp = cosh(im) * (1.0d0 + ((re * re) * (-0.5d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))));
double tmp;
if (im <= 0.62) {
tmp = t_0;
} else if (im <= 7e+51) {
tmp = Math.cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))))) tmp = 0 if im <= 0.62: tmp = t_0 elif im <= 7e+51: tmp = math.cosh(im) * (1.0 + ((re * re) * -0.5)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889))))))))) tmp = 0.0 if (im <= 0.62) tmp = t_0; elseif (im <= 7e+51) tmp = Float64(cosh(im) * Float64(1.0 + Float64(Float64(re * re) * -0.5))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))))); tmp = 0.0; if (im <= 0.62) tmp = t_0; elseif (im <= 7e+51) tmp = cosh(im) * (1.0 + ((re * re) * -0.5)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.62], t$95$0, If[LessEqual[im, 7e+51], N[(N[Cosh[im], $MachinePrecision] * N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\right)\\
\mathbf{if}\;im \leq 0.62:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+51}:\\
\;\;\;\;\cosh im \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.619999999999999996 or 7e51 < im 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 im around 0
Simplified95.4%
if 0.619999999999999996 < im < 7e51Initial 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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6492.3%
Simplified92.3%
Final simplification95.2%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(cos re)
(+ 1.0 (* (* im im) (+ 0.5 (* 0.041666666666666664 (* im im))))))))
(if (<= im 0.12)
t_0
(if (<= im 3.6e+76) (* (cosh im) (+ 1.0 (* (* re re) -0.5))) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im)))));
double tmp;
if (im <= 0.12) {
tmp = t_0;
} else if (im <= 3.6e+76) {
tmp = cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (1.0d0 + ((im * im) * (0.5d0 + (0.041666666666666664d0 * (im * im)))))
if (im <= 0.12d0) then
tmp = t_0
else if (im <= 3.6d+76) then
tmp = cosh(im) * (1.0d0 + ((re * re) * (-0.5d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im)))));
double tmp;
if (im <= 0.12) {
tmp = t_0;
} else if (im <= 3.6e+76) {
tmp = Math.cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) tmp = 0 if im <= 0.12: tmp = t_0 elif im <= 3.6e+76: tmp = math.cosh(im) * (1.0 + ((re * re) * -0.5)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im * im)))))) tmp = 0.0 if (im <= 0.12) tmp = t_0; elseif (im <= 3.6e+76) tmp = Float64(cosh(im) * Float64(1.0 + Float64(Float64(re * re) * -0.5))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))); tmp = 0.0; if (im <= 0.12) tmp = t_0; elseif (im <= 3.6e+76) tmp = cosh(im) * (1.0 + ((re * re) * -0.5)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.12], t$95$0, If[LessEqual[im, 3.6e+76], N[(N[Cosh[im], $MachinePrecision] * N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{if}\;im \leq 0.12:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 3.6 \cdot 10^{+76}:\\
\;\;\;\;\cosh im \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.12 or 3.6000000000000003e76 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified92.5%
if 0.12 < im < 3.6000000000000003e76Initial 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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6489.5%
Simplified89.5%
Final simplification92.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (+ 1.0 (* (* im im) 0.5)))))
(if (<= im 0.028)
t_0
(if (<= im 8e+127)
(cosh im)
(if (<= im 1.35e+154)
(*
(+ 1.0 (* (* im im) (+ 0.5 (* 0.041666666666666664 (* im im)))))
(+ 1.0 (* re (* re -0.5))))
t_0)))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + ((im * im) * 0.5));
double tmp;
if (im <= 0.028) {
tmp = t_0;
} else if (im <= 8e+127) {
tmp = cosh(im);
} else if (im <= 1.35e+154) {
tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (1.0d0 + ((im * im) * 0.5d0))
if (im <= 0.028d0) then
tmp = t_0
else if (im <= 8d+127) then
tmp = cosh(im)
else if (im <= 1.35d+154) then
tmp = (1.0d0 + ((im * im) * (0.5d0 + (0.041666666666666664d0 * (im * im))))) * (1.0d0 + (re * (re * (-0.5d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + ((im * im) * 0.5));
double tmp;
if (im <= 0.028) {
tmp = t_0;
} else if (im <= 8e+127) {
tmp = Math.cosh(im);
} else if (im <= 1.35e+154) {
tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + ((im * im) * 0.5)) tmp = 0 if im <= 0.028: tmp = t_0 elif im <= 8e+127: tmp = math.cosh(im) elif im <= 1.35e+154: tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(Float64(im * im) * 0.5))) tmp = 0.0 if (im <= 0.028) tmp = t_0; elseif (im <= 8e+127) tmp = cosh(im); elseif (im <= 1.35e+154) tmp = Float64(Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im * im))))) * Float64(1.0 + Float64(re * Float64(re * -0.5)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + ((im * im) * 0.5)); tmp = 0.0; if (im <= 0.028) tmp = t_0; elseif (im <= 8e+127) tmp = cosh(im); elseif (im <= 1.35e+154) tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.028], t$95$0, If[LessEqual[im, 8e+127], N[Cosh[im], $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + \left(im \cdot im\right) \cdot 0.5\right)\\
\mathbf{if}\;im \leq 0.028:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 8 \cdot 10^{+127}:\\
\;\;\;\;\cosh im\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + re \cdot \left(re \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.0280000000000000006 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.3%
Simplified82.3%
if 0.0280000000000000006 < im < 7.99999999999999964e127Initial 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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified80.0%
if 7.99999999999999964e127 < im < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64100.0%
Simplified100.0%
Final simplification82.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (+ 1.0 (* (* im im) 0.5)))))
(if (<= im 0.0155)
t_0
(if (<= im 1.35e+154) (* (cosh im) (+ 1.0 (* (* re re) -0.5))) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (1.0 + ((im * im) * 0.5));
double tmp;
if (im <= 0.0155) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * (1.0d0 + ((im * im) * 0.5d0))
if (im <= 0.0155d0) then
tmp = t_0
else if (im <= 1.35d+154) then
tmp = cosh(im) * (1.0d0 + ((re * re) * (-0.5d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (1.0 + ((im * im) * 0.5));
double tmp;
if (im <= 0.0155) {
tmp = t_0;
} else if (im <= 1.35e+154) {
tmp = Math.cosh(im) * (1.0 + ((re * re) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (1.0 + ((im * im) * 0.5)) tmp = 0 if im <= 0.0155: tmp = t_0 elif im <= 1.35e+154: tmp = math.cosh(im) * (1.0 + ((re * re) * -0.5)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(1.0 + Float64(Float64(im * im) * 0.5))) tmp = 0.0 if (im <= 0.0155) tmp = t_0; elseif (im <= 1.35e+154) tmp = Float64(cosh(im) * Float64(1.0 + Float64(Float64(re * re) * -0.5))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (1.0 + ((im * im) * 0.5)); tmp = 0.0; if (im <= 0.0155) tmp = t_0; elseif (im <= 1.35e+154) tmp = cosh(im) * (1.0 + ((re * re) * -0.5)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.0155], t$95$0, If[LessEqual[im, 1.35e+154], N[(N[Cosh[im], $MachinePrecision] * N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(1 + \left(im \cdot im\right) \cdot 0.5\right)\\
\mathbf{if}\;im \leq 0.0155:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\cosh im \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 0.0155 or 1.35000000000000003e154 < im Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.3%
Simplified82.3%
if 0.0155 < im < 1.35000000000000003e154Initial 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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6486.2%
Simplified86.2%
Final simplification82.8%
(FPCore (re im)
:precision binary64
(if (<= im 2e-5)
(cos re)
(if (<= im 2e+126)
(cosh im)
(*
(* (* im im) (* im im))
(+
0.041666666666666664
(*
(+
-0.5
(*
re
(* re (+ 0.041666666666666664 (* (* re re) -0.001388888888888889)))))
(* 0.041666666666666664 (* re re))))))))
double code(double re, double im) {
double tmp;
if (im <= 2e-5) {
tmp = cos(re);
} else if (im <= 2e+126) {
tmp = cosh(im);
} else {
tmp = ((im * im) * (im * im)) * (0.041666666666666664 + ((-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))) * (0.041666666666666664 * (re * re))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2d-5) then
tmp = cos(re)
else if (im <= 2d+126) then
tmp = cosh(im)
else
tmp = ((im * im) * (im * im)) * (0.041666666666666664d0 + (((-0.5d0) + (re * (re * (0.041666666666666664d0 + ((re * re) * (-0.001388888888888889d0)))))) * (0.041666666666666664d0 * (re * re))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2e-5) {
tmp = Math.cos(re);
} else if (im <= 2e+126) {
tmp = Math.cosh(im);
} else {
tmp = ((im * im) * (im * im)) * (0.041666666666666664 + ((-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))) * (0.041666666666666664 * (re * re))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2e-5: tmp = math.cos(re) elif im <= 2e+126: tmp = math.cosh(im) else: tmp = ((im * im) * (im * im)) * (0.041666666666666664 + ((-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))) * (0.041666666666666664 * (re * re)))) return tmp
function code(re, im) tmp = 0.0 if (im <= 2e-5) tmp = cos(re); elseif (im <= 2e+126) tmp = cosh(im); else tmp = Float64(Float64(Float64(im * im) * Float64(im * im)) * Float64(0.041666666666666664 + Float64(Float64(-0.5 + Float64(re * Float64(re * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.001388888888888889))))) * Float64(0.041666666666666664 * Float64(re * re))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2e-5) tmp = cos(re); elseif (im <= 2e+126) tmp = cosh(im); else tmp = ((im * im) * (im * im)) * (0.041666666666666664 + ((-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))) * (0.041666666666666664 * (re * re)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2e-5], N[Cos[re], $MachinePrecision], If[LessEqual[im, 2e+126], N[Cosh[im], $MachinePrecision], N[(N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(-0.5 + N[(re * N[(re * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.041666666666666664 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\cosh im\\
\mathbf{else}:\\
\;\;\;\;\left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right) \cdot \left(0.041666666666666664 + \left(-0.5 + re \cdot \left(re \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.001388888888888889\right)\right)\right) \cdot \left(0.041666666666666664 \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if im < 2.00000000000000016e-5Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6461.6%
Simplified61.6%
if 2.00000000000000016e-5 < im < 1.99999999999999985e126Initial 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%
*-lowering-*.f64N/A
*-lft-identityN/A
cosh-lowering-cosh.f64N/A
cos-lowering-cos.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified80.8%
if 1.99999999999999985e126 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/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-*.f6481.6%
Simplified81.6%
Taylor expanded in im around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
Simplified81.6%
Final simplification66.5%
(FPCore (re im)
:precision binary64
(if (<= im 2.2e-5)
(cos re)
(*
(+
(*
(+ 0.041666666666666664 (* (* im im) 0.001388888888888889))
(* im (* im (* im im))))
(+ 1.0 (* (* im im) 0.5)))
(+
1.0
(*
re
(*
re
(+
-0.5
(*
re
(*
re
(+ 0.041666666666666664 (* (* re re) -0.001388888888888889)))))))))))
double code(double re, double im) {
double tmp;
if (im <= 2.2e-5) {
tmp = cos(re);
} else {
tmp = (((0.041666666666666664 + ((im * im) * 0.001388888888888889)) * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (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 (im <= 2.2d-5) then
tmp = cos(re)
else
tmp = (((0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)) * (im * (im * (im * im)))) + (1.0d0 + ((im * im) * 0.5d0))) * (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 (im <= 2.2e-5) {
tmp = Math.cos(re);
} else {
tmp = (((0.041666666666666664 + ((im * im) * 0.001388888888888889)) * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.2e-5: tmp = math.cos(re) else: tmp = (((0.041666666666666664 + ((im * im) * 0.001388888888888889)) * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))))) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.2e-5) tmp = cos(re); else tmp = Float64(Float64(Float64(Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)) * Float64(im * Float64(im * Float64(im * im)))) + Float64(1.0 + Float64(Float64(im * im) * 0.5))) * Float64(1.0 + Float64(re * Float64(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 (im <= 2.2e-5) tmp = cos(re); else tmp = (((0.041666666666666664 + ((im * im) * 0.001388888888888889)) * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.2e-5], N[Cos[re], $MachinePrecision], N[(N[(N[(N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision] * N[(im * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(re * N[(-0.5 + N[(re * N[(re * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.2 \cdot 10^{-5}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;\left(\left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right) \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + \left(im \cdot im\right) \cdot 0.5\right)\right) \cdot \left(1 + re \cdot \left(re \cdot \left(-0.5 + re \cdot \left(re \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.001388888888888889\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if im < 2.1999999999999999e-5Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6461.6%
Simplified61.6%
if 2.1999999999999999e-5 < im Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified80.7%
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
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-*.f6466.6%
Simplified66.6%
Final simplification62.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.041666666666666664 (* (* im im) 0.001388888888888889))))
(if (<= re 1.5e+154)
(*
(+ (* t_0 (* im (* im (* im im)))) (+ 1.0 (* (* im im) 0.5)))
(+
1.0
(*
re
(*
re
(+
-0.5
(*
re
(*
re
(+ 0.041666666666666664 (* (* re re) -0.001388888888888889)))))))))
(+ 1.0 (* im (* im (+ 0.5 (* im (* im t_0)))))))))
double code(double re, double im) {
double t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889);
double tmp;
if (re <= 1.5e+154) {
tmp = ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))))));
} else {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * t_0)))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)
if (re <= 1.5d+154) then
tmp = ((t_0 * (im * (im * (im * im)))) + (1.0d0 + ((im * im) * 0.5d0))) * (1.0d0 + (re * (re * ((-0.5d0) + (re * (re * (0.041666666666666664d0 + ((re * re) * (-0.001388888888888889d0)))))))))
else
tmp = 1.0d0 + (im * (im * (0.5d0 + (im * (im * t_0)))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889);
double tmp;
if (re <= 1.5e+154) {
tmp = ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889))))))));
} else {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * t_0)))));
}
return tmp;
}
def code(re, im): t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889) tmp = 0 if re <= 1.5e+154: tmp = ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))))) else: tmp = 1.0 + (im * (im * (0.5 + (im * (im * t_0))))) return tmp
function code(re, im) t_0 = Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)) tmp = 0.0 if (re <= 1.5e+154) tmp = Float64(Float64(Float64(t_0 * Float64(im * Float64(im * Float64(im * im)))) + Float64(1.0 + Float64(Float64(im * im) * 0.5))) * Float64(1.0 + Float64(re * Float64(re * Float64(-0.5 + Float64(re * Float64(re * Float64(0.041666666666666664 + Float64(Float64(re * re) * -0.001388888888888889))))))))); else tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * t_0)))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.041666666666666664 + ((im * im) * 0.001388888888888889); tmp = 0.0; if (re <= 1.5e+154) tmp = ((t_0 * (im * (im * (im * im)))) + (1.0 + ((im * im) * 0.5))) * (1.0 + (re * (re * (-0.5 + (re * (re * (0.041666666666666664 + ((re * re) * -0.001388888888888889)))))))); else tmp = 1.0 + (im * (im * (0.5 + (im * (im * t_0))))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, 1.5e+154], N[(N[(N[(t$95$0 * N[(im * N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(re * N[(-0.5 + N[(re * N[(re * N[(0.041666666666666664 + N[(N[(re * re), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\\
\mathbf{if}\;re \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;\left(t\_0 \cdot \left(im \cdot \left(im \cdot \left(im \cdot im\right)\right)\right) + \left(1 + \left(im \cdot im\right) \cdot 0.5\right)\right) \cdot \left(1 + re \cdot \left(re \cdot \left(-0.5 + re \cdot \left(re \cdot \left(0.041666666666666664 + \left(re \cdot re\right) \cdot -0.001388888888888889\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot t\_0\right)\right)\right)\\
\end{array}
\end{array}
if re < 1.50000000000000013e154Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified90.9%
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
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-*.f6465.5%
Simplified65.5%
if 1.50000000000000013e154 < re Initial program 99.9%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified89.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
Simplified35.6%
Final simplification62.3%
(FPCore (re im)
:precision binary64
(let* ((t_0
(+
1.0
(*
im
(*
im
(+
0.5
(*
im
(*
im
(+
0.041666666666666664
(* (* im im) 0.001388888888888889))))))))))
(if (<= re 1.5e+154) (* t_0 (+ 1.0 (* re (* re -0.5)))) t_0)))
double code(double re, double im) {
double t_0 = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))));
double tmp;
if (re <= 1.5e+154) {
tmp = t_0 * (1.0 + (re * (re * -0.5)));
} 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 = 1.0d0 + (im * (im * (0.5d0 + (im * (im * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)))))))
if (re <= 1.5d+154) then
tmp = t_0 * (1.0d0 + (re * (re * (-0.5d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))));
double tmp;
if (re <= 1.5e+154) {
tmp = t_0 * (1.0 + (re * (re * -0.5)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))) tmp = 0 if re <= 1.5e+154: tmp = t_0 * (1.0 + (re * (re * -0.5))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)))))))) tmp = 0.0 if (re <= 1.5e+154) tmp = Float64(t_0 * Float64(1.0 + Float64(re * Float64(re * -0.5)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))); tmp = 0.0; if (re <= 1.5e+154) tmp = t_0 * (1.0 + (re * (re * -0.5))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, 1.5e+154], N[(t$95$0 * N[(1.0 + N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{if}\;re \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;t\_0 \cdot \left(1 + re \cdot \left(re \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if re < 1.50000000000000013e154Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified90.9%
Taylor expanded in re around 0
Simplified65.4%
if 1.50000000000000013e154 < re Initial program 99.9%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified89.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
Simplified35.6%
Final simplification62.3%
(FPCore (re im)
:precision binary64
(if (<= im 8e+128)
(+
1.0
(*
im
(*
im
(+
0.5
(*
im
(* im (+ 0.041666666666666664 (* (* im im) 0.001388888888888889))))))))
(*
(+ 1.0 (* (* im im) (+ 0.5 (* 0.041666666666666664 (* im im)))))
(+ 1.0 (* re (* re -0.5))))))
double code(double re, double im) {
double tmp;
if (im <= 8e+128) {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))));
} else {
tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (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 <= 8d+128) then
tmp = 1.0d0 + (im * (im * (0.5d0 + (im * (im * (0.041666666666666664d0 + ((im * im) * 0.001388888888888889d0)))))))
else
tmp = (1.0d0 + ((im * im) * (0.5d0 + (0.041666666666666664d0 * (im * im))))) * (1.0d0 + (re * (re * (-0.5d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 8e+128) {
tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889)))))));
} else {
tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 8e+128: tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))) else: tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5))) return tmp
function code(re, im) tmp = 0.0 if (im <= 8e+128) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(im * Float64(im * Float64(0.041666666666666664 + Float64(Float64(im * im) * 0.001388888888888889)))))))); else tmp = Float64(Float64(1.0 + Float64(Float64(im * im) * Float64(0.5 + Float64(0.041666666666666664 * Float64(im * im))))) * Float64(1.0 + Float64(re * Float64(re * -0.5)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 8e+128) tmp = 1.0 + (im * (im * (0.5 + (im * (im * (0.041666666666666664 + ((im * im) * 0.001388888888888889))))))); else tmp = (1.0 + ((im * im) * (0.5 + (0.041666666666666664 * (im * im))))) * (1.0 + (re * (re * -0.5))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 8e+128], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 8 \cdot 10^{+128}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(im \cdot im\right) \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right) \cdot \left(1 + re \cdot \left(re \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if im < 8.0000000000000006e128Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified89.2%
Taylor expanded in re around 0
+-lowering-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
Simplified55.7%
if 8.0000000000000006e128 < im Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified100.0%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6481.6%
Simplified81.6%
Final simplification59.6%
(FPCore (re im)
:precision binary64
(if (<= re 2.1e+25)
(+ 1.0 (* im (* im (+ 0.5 (* 0.041666666666666664 (* im im))))))
(if (<= re 1.5e+154)
(* (* im im) (+ 0.5 (* (* re re) -0.25)))
(+ 1.0 (* (* re re) (+ -0.5 (* re (* re 0.041666666666666664))))))))
double code(double re, double im) {
double tmp;
if (re <= 2.1e+25) {
tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im)))));
} else if (re <= 1.5e+154) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 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 <= 2.1d+25) then
tmp = 1.0d0 + (im * (im * (0.5d0 + (0.041666666666666664d0 * (im * im)))))
else if (re <= 1.5d+154) then
tmp = (im * im) * (0.5d0 + ((re * re) * (-0.25d0)))
else
tmp = 1.0d0 + ((re * re) * ((-0.5d0) + (re * (re * 0.041666666666666664d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.1e+25) {
tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im)))));
} else if (re <= 1.5e+154) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664))));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.1e+25: tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im))))) elif re <= 1.5e+154: tmp = (im * im) * (0.5 + ((re * re) * -0.25)) else: tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664)))) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.1e+25) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(0.041666666666666664 * Float64(im * im)))))); elseif (re <= 1.5e+154) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(re * re) * -0.25))); else tmp = Float64(1.0 + Float64(Float64(re * re) * Float64(-0.5 + Float64(re * Float64(re * 0.041666666666666664))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.1e+25) tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im))))); elseif (re <= 1.5e+154) tmp = (im * im) * (0.5 + ((re * re) * -0.25)); else tmp = 1.0 + ((re * re) * (-0.5 + (re * (re * 0.041666666666666664)))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.1e+25], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.5e+154], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(re * re), $MachinePrecision] * N[(-0.5 + N[(re * N[(re * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.1 \cdot 10^{+25}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(re \cdot re\right) \cdot \left(-0.5 + re \cdot \left(re \cdot 0.041666666666666664\right)\right)\\
\end{array}
\end{array}
if re < 2.0999999999999999e25Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified84.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-*.f6462.6%
Simplified62.6%
if 2.0999999999999999e25 < re < 1.50000000000000013e154Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.2%
Simplified80.2%
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
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-*.f6430.3%
Simplified30.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.9%
Simplified26.9%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
metadata-eval27.3%
Simplified27.3%
if 1.50000000000000013e154 < re Initial program 99.9%
Taylor expanded in im around 0
cos-lowering-cos.f6452.7%
Simplified52.7%
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
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.4%
Simplified34.4%
Final simplification56.3%
(FPCore (re im)
:precision binary64
(if (<= re 2.1e+25)
(+ 1.0 (* im (* im (+ 0.5 (* 0.041666666666666664 (* im im))))))
(if (<= re 1.5e+154)
(* (* im im) (+ 0.5 (* (* re re) -0.25)))
(* 0.041666666666666664 (* (* re re) (* re re))))))
double code(double re, double im) {
double tmp;
if (re <= 2.1e+25) {
tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im)))));
} else if (re <= 1.5e+154) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = 0.041666666666666664 * ((re * re) * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.1d+25) then
tmp = 1.0d0 + (im * (im * (0.5d0 + (0.041666666666666664d0 * (im * im)))))
else if (re <= 1.5d+154) then
tmp = (im * im) * (0.5d0 + ((re * re) * (-0.25d0)))
else
tmp = 0.041666666666666664d0 * ((re * re) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.1e+25) {
tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im)))));
} else if (re <= 1.5e+154) {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
} else {
tmp = 0.041666666666666664 * ((re * re) * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.1e+25: tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im))))) elif re <= 1.5e+154: tmp = (im * im) * (0.5 + ((re * re) * -0.25)) else: tmp = 0.041666666666666664 * ((re * re) * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.1e+25) tmp = Float64(1.0 + Float64(im * Float64(im * Float64(0.5 + Float64(0.041666666666666664 * Float64(im * im)))))); elseif (re <= 1.5e+154) tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(re * re) * -0.25))); else tmp = Float64(0.041666666666666664 * Float64(Float64(re * re) * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.1e+25) tmp = 1.0 + (im * (im * (0.5 + (0.041666666666666664 * (im * im))))); elseif (re <= 1.5e+154) tmp = (im * im) * (0.5 + ((re * re) * -0.25)); else tmp = 0.041666666666666664 * ((re * re) * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.1e+25], N[(1.0 + N[(im * N[(im * N[(0.5 + N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.5e+154], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.1 \cdot 10^{+25}:\\
\;\;\;\;1 + im \cdot \left(im \cdot \left(0.5 + 0.041666666666666664 \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 2.0999999999999999e25Initial program 100.0%
Taylor expanded in im around 0
distribute-lft-inN/A
associate-+r+N/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt1-inN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-+r+N/A
+-commutativeN/A
Simplified84.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-*.f6462.6%
Simplified62.6%
if 2.0999999999999999e25 < re < 1.50000000000000013e154Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.2%
Simplified80.2%
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
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-*.f6430.3%
Simplified30.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.9%
Simplified26.9%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
metadata-eval27.3%
Simplified27.3%
if 1.50000000000000013e154 < re Initial program 99.9%
Taylor expanded in im around 0
cos-lowering-cos.f6452.7%
Simplified52.7%
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
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.4%
Simplified34.4%
Taylor expanded in re around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6434.4%
Simplified34.4%
Final simplification56.3%
(FPCore (re im)
:precision binary64
(if (<= re 2.1e+25)
(+ 1.0 (* (* im im) 0.5))
(if (<= re 1.5e+154)
(* re (* re (+ -0.5 (* (* im im) -0.25))))
(* 0.041666666666666664 (* (* re re) (* re re))))))
double code(double re, double im) {
double tmp;
if (re <= 2.1e+25) {
tmp = 1.0 + ((im * im) * 0.5);
} else if (re <= 1.5e+154) {
tmp = re * (re * (-0.5 + ((im * im) * -0.25)));
} else {
tmp = 0.041666666666666664 * ((re * re) * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.1d+25) then
tmp = 1.0d0 + ((im * im) * 0.5d0)
else if (re <= 1.5d+154) then
tmp = re * (re * ((-0.5d0) + ((im * im) * (-0.25d0))))
else
tmp = 0.041666666666666664d0 * ((re * re) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.1e+25) {
tmp = 1.0 + ((im * im) * 0.5);
} else if (re <= 1.5e+154) {
tmp = re * (re * (-0.5 + ((im * im) * -0.25)));
} else {
tmp = 0.041666666666666664 * ((re * re) * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.1e+25: tmp = 1.0 + ((im * im) * 0.5) elif re <= 1.5e+154: tmp = re * (re * (-0.5 + ((im * im) * -0.25))) else: tmp = 0.041666666666666664 * ((re * re) * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.1e+25) tmp = Float64(1.0 + Float64(Float64(im * im) * 0.5)); elseif (re <= 1.5e+154) tmp = Float64(re * Float64(re * Float64(-0.5 + Float64(Float64(im * im) * -0.25)))); else tmp = Float64(0.041666666666666664 * Float64(Float64(re * re) * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.1e+25) tmp = 1.0 + ((im * im) * 0.5); elseif (re <= 1.5e+154) tmp = re * (re * (-0.5 + ((im * im) * -0.25))); else tmp = 0.041666666666666664 * ((re * re) * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.1e+25], N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.5e+154], N[(re * N[(re * N[(-0.5 + N[(N[(im * im), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.1 \cdot 10^{+25}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot 0.5\\
\mathbf{elif}\;re \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;re \cdot \left(re \cdot \left(-0.5 + \left(im \cdot im\right) \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 2.0999999999999999e25Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6473.4%
Simplified73.4%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6454.0%
Simplified54.0%
if 2.0999999999999999e25 < re < 1.50000000000000013e154Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6480.2%
Simplified80.2%
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
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-*.f6430.3%
Simplified30.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.9%
Simplified26.9%
Taylor expanded in re around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
metadata-eval26.9%
Simplified26.9%
if 1.50000000000000013e154 < re Initial program 99.9%
Taylor expanded in im around 0
cos-lowering-cos.f6452.7%
Simplified52.7%
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
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.4%
Simplified34.4%
Taylor expanded in re around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6434.4%
Simplified34.4%
Final simplification49.4%
(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(im * Float64(im * Float64(0.5 + Float64(im * Float64(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[(im * N[(im * N[(0.5 + N[(im * N[(im * N[(0.041666666666666664 + N[(N[(im * im), $MachinePrecision] * 0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + im \cdot \left(im \cdot \left(0.5 + im \cdot \left(im \cdot \left(0.041666666666666664 + \left(im \cdot im\right) \cdot 0.001388888888888889\right)\right)\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-+l+N/A
Simplified90.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
metadata-evalN/A
pow-sqrN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
pow-sqrN/A
associate-*r*N/A
*-commutativeN/A
Simplified60.0%
(FPCore (re im) :precision binary64 (if (<= im 280000000.0) (+ 1.0 (* (* im im) 0.5)) (* (* im im) (+ 0.5 (* (* re re) -0.25)))))
double code(double re, double im) {
double tmp;
if (im <= 280000000.0) {
tmp = 1.0 + ((im * im) * 0.5);
} else {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 280000000.0d0) then
tmp = 1.0d0 + ((im * im) * 0.5d0)
else
tmp = (im * im) * (0.5d0 + ((re * re) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 280000000.0) {
tmp = 1.0 + ((im * im) * 0.5);
} else {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 280000000.0: tmp = 1.0 + ((im * im) * 0.5) else: tmp = (im * im) * (0.5 + ((re * re) * -0.25)) return tmp
function code(re, im) tmp = 0.0 if (im <= 280000000.0) tmp = Float64(1.0 + Float64(Float64(im * im) * 0.5)); else tmp = Float64(Float64(im * im) * Float64(0.5 + Float64(Float64(re * re) * -0.25))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 280000000.0) tmp = 1.0 + ((im * im) * 0.5); else tmp = (im * im) * (0.5 + ((re * re) * -0.25)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 280000000.0], N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 280000000:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if im < 2.8e8Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6477.7%
Simplified77.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6445.7%
Simplified45.7%
if 2.8e8 < im Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6459.7%
Simplified59.7%
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
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-*.f6452.4%
Simplified52.4%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.9%
Simplified50.9%
Taylor expanded in im around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
metadata-eval50.9%
Simplified50.9%
Final simplification46.9%
(FPCore (re im) :precision binary64 (if (<= re 2.7e+135) (+ 1.0 (* (* im im) 0.5)) (* 0.041666666666666664 (* (* re re) (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 2.7e+135) {
tmp = 1.0 + ((im * im) * 0.5);
} else {
tmp = 0.041666666666666664 * ((re * re) * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 2.7d+135) then
tmp = 1.0d0 + ((im * im) * 0.5d0)
else
tmp = 0.041666666666666664d0 * ((re * re) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 2.7e+135) {
tmp = 1.0 + ((im * im) * 0.5);
} else {
tmp = 0.041666666666666664 * ((re * re) * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 2.7e+135: tmp = 1.0 + ((im * im) * 0.5) else: tmp = 0.041666666666666664 * ((re * re) * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 2.7e+135) tmp = Float64(1.0 + Float64(Float64(im * im) * 0.5)); else tmp = Float64(0.041666666666666664 * Float64(Float64(re * re) * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 2.7e+135) tmp = 1.0 + ((im * im) * 0.5); else tmp = 0.041666666666666664 * ((re * re) * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 2.7e+135], N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[(re * re), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2.7 \cdot 10^{+135}:\\
\;\;\;\;1 + \left(im \cdot im\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 2.69999999999999985e135Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6474.2%
Simplified74.2%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.8%
Simplified50.8%
if 2.69999999999999985e135 < re Initial program 99.9%
Taylor expanded in im around 0
cos-lowering-cos.f6454.2%
Simplified54.2%
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
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6434.4%
Simplified34.4%
Taylor expanded in re around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-sqrN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6434.4%
Simplified34.4%
Final simplification48.9%
(FPCore (re im) :precision binary64 (if (<= im 1.45) 1.0 (* (* im im) 0.5)))
double code(double re, double im) {
double tmp;
if (im <= 1.45) {
tmp = 1.0;
} else {
tmp = (im * im) * 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 <= 1.45d0) then
tmp = 1.0d0
else
tmp = (im * im) * 0.5d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.45) {
tmp = 1.0;
} else {
tmp = (im * im) * 0.5;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.45: tmp = 1.0 else: tmp = (im * im) * 0.5 return tmp
function code(re, im) tmp = 0.0 if (im <= 1.45) tmp = 1.0; else tmp = Float64(Float64(im * im) * 0.5); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.45) tmp = 1.0; else tmp = (im * im) * 0.5; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.45], 1.0, N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.45:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot 0.5\\
\end{array}
\end{array}
if im < 1.44999999999999996Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6461.5%
Simplified61.5%
Taylor expanded in re around 0
Simplified33.4%
if 1.44999999999999996 < im Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6456.1%
Simplified56.1%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6447.8%
Simplified47.8%
Taylor expanded in im around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6447.8%
Simplified47.8%
Final simplification37.0%
(FPCore (re im) :precision binary64 (+ 1.0 (* (* im im) 0.5)))
double code(double re, double im) {
return 1.0 + ((im * im) * 0.5);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 + ((im * im) * 0.5d0)
end function
public static double code(double re, double im) {
return 1.0 + ((im * im) * 0.5);
}
def code(re, im): return 1.0 + ((im * im) * 0.5)
function code(re, im) return Float64(1.0 + Float64(Float64(im * im) * 0.5)) end
function tmp = code(re, im) tmp = 1.0 + ((im * im) * 0.5); end
code[re_, im_] := N[(1.0 + N[(N[(im * im), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \left(im \cdot im\right) \cdot 0.5
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
associate-*r*N/A
distribute-rgt1-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6473.5%
Simplified73.5%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.9%
Simplified46.9%
Final simplification46.9%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
cos-lowering-cos.f6447.1%
Simplified47.1%
Taylor expanded in re around 0
Simplified25.9%
herbie shell --seed 2024140
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))