
(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 (* (* 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}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= im 2000000000000.0)
(*
(* 0.5 (cos re))
(+ (+ 2.0 (* im im)) (* 0.08333333333333333 (pow im 4.0))))
(if (<= im 1.15e+77)
(* 0.5 (+ (exp (- im)) (exp im)))
(* 0.041666666666666664 (* (cos re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 2000000000000.0) {
tmp = (0.5 * cos(re)) * ((2.0 + (im * im)) + (0.08333333333333333 * pow(im, 4.0)));
} else if (im <= 1.15e+77) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2000000000000.0d0) then
tmp = (0.5d0 * cos(re)) * ((2.0d0 + (im * im)) + (0.08333333333333333d0 * (im ** 4.0d0)))
else if (im <= 1.15d+77) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2000000000000.0) {
tmp = (0.5 * Math.cos(re)) * ((2.0 + (im * im)) + (0.08333333333333333 * Math.pow(im, 4.0)));
} else if (im <= 1.15e+77) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2000000000000.0: tmp = (0.5 * math.cos(re)) * ((2.0 + (im * im)) + (0.08333333333333333 * math.pow(im, 4.0))) elif im <= 1.15e+77: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2000000000000.0) tmp = Float64(Float64(0.5 * cos(re)) * Float64(Float64(2.0 + Float64(im * im)) + Float64(0.08333333333333333 * (im ^ 4.0)))); elseif (im <= 1.15e+77) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2000000000000.0) tmp = (0.5 * cos(re)) * ((2.0 + (im * im)) + (0.08333333333333333 * (im ^ 4.0))); elseif (im <= 1.15e+77) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2000000000000.0], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision] + N[(0.08333333333333333 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2000000000000:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(\left(2 + im \cdot im\right) + 0.08333333333333333 \cdot {im}^{4}\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 2e12Initial program 100.0%
Taylor expanded in im around 0 90.8%
Simplified90.8%
if 2e12 < im < 1.14999999999999997e77Initial program 100.0%
Taylor expanded in re around 0 77.8%
if 1.14999999999999997e77 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification91.5%
(FPCore (re im)
:precision binary64
(if (<= im 1.55e+14)
(* (* 0.5 (cos re)) (+ 2.0 (* im im)))
(if (<= im 5.3e+73)
(* (* im im) (* 0.020833333333333332 (pow re 4.0)))
(* 0.041666666666666664 (* (cos re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 1.55e+14) {
tmp = (0.5 * cos(re)) * (2.0 + (im * im));
} else if (im <= 5.3e+73) {
tmp = (im * im) * (0.020833333333333332 * pow(re, 4.0));
} else {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.55d+14) then
tmp = (0.5d0 * cos(re)) * (2.0d0 + (im * im))
else if (im <= 5.3d+73) then
tmp = (im * im) * (0.020833333333333332d0 * (re ** 4.0d0))
else
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.55e+14) {
tmp = (0.5 * Math.cos(re)) * (2.0 + (im * im));
} else if (im <= 5.3e+73) {
tmp = (im * im) * (0.020833333333333332 * Math.pow(re, 4.0));
} else {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.55e+14: tmp = (0.5 * math.cos(re)) * (2.0 + (im * im)) elif im <= 5.3e+73: tmp = (im * im) * (0.020833333333333332 * math.pow(re, 4.0)) else: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.55e+14) tmp = Float64(Float64(0.5 * cos(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 5.3e+73) tmp = Float64(Float64(im * im) * Float64(0.020833333333333332 * (re ^ 4.0))); else tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.55e+14) tmp = (0.5 * cos(re)) * (2.0 + (im * im)); elseif (im <= 5.3e+73) tmp = (im * im) * (0.020833333333333332 * (re ^ 4.0)); else tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.55e+14], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.3e+73], N[(N[(im * im), $MachinePrecision] * N[(0.020833333333333332 * N[Power[re, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.55 \cdot 10^{+14}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 5.3 \cdot 10^{+73}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.020833333333333332 \cdot {re}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 1.55e14Initial program 100.0%
Taylor expanded in im around 0 80.8%
Simplified80.8%
if 1.55e14 < im < 5.29999999999999996e73Initial program 100.0%
Taylor expanded in im around 0 3.9%
Simplified3.9%
Taylor expanded in im around inf 3.9%
*-commutative3.9%
unpow23.9%
associate-*l*3.9%
associate-*r*3.9%
*-commutative3.9%
Simplified3.9%
Taylor expanded in re around 0 1.5%
*-commutative1.5%
+-commutative1.5%
associate-*r*1.5%
associate-*r*1.5%
distribute-rgt-out7.4%
distribute-lft-out7.4%
unpow27.4%
+-commutative7.4%
*-commutative7.4%
unpow27.4%
associate-*r*7.4%
*-commutative7.4%
*-commutative7.4%
Simplified7.4%
Taylor expanded in re around inf 42.1%
*-commutative42.1%
unpow242.1%
*-commutative42.1%
associate-*l*42.1%
*-commutative42.1%
Simplified42.1%
if 5.29999999999999996e73 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification81.5%
(FPCore (re im)
:precision binary64
(if (<= im 2000000000000.0)
(* (* 0.5 (cos re)) (+ 2.0 (* im im)))
(if (<= im 1.15e+77)
(* 0.5 (+ (exp (- im)) (exp im)))
(* 0.041666666666666664 (* (cos re) (pow im 4.0))))))
double code(double re, double im) {
double tmp;
if (im <= 2000000000000.0) {
tmp = (0.5 * cos(re)) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.041666666666666664 * (cos(re) * pow(im, 4.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2000000000000.0d0) then
tmp = (0.5d0 * cos(re)) * (2.0d0 + (im * im))
else if (im <= 1.15d+77) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.041666666666666664d0 * (cos(re) * (im ** 4.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2000000000000.0) {
tmp = (0.5 * Math.cos(re)) * (2.0 + (im * im));
} else if (im <= 1.15e+77) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.041666666666666664 * (Math.cos(re) * Math.pow(im, 4.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2000000000000.0: tmp = (0.5 * math.cos(re)) * (2.0 + (im * im)) elif im <= 1.15e+77: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.041666666666666664 * (math.cos(re) * math.pow(im, 4.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 2000000000000.0) tmp = Float64(Float64(0.5 * cos(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 1.15e+77) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.041666666666666664 * Float64(cos(re) * (im ^ 4.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2000000000000.0) tmp = (0.5 * cos(re)) * (2.0 + (im * im)); elseif (im <= 1.15e+77) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.041666666666666664 * (cos(re) * (im ^ 4.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2000000000000.0], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.15e+77], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.041666666666666664 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2000000000000:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+77}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.041666666666666664 \cdot \left(\cos re \cdot {im}^{4}\right)\\
\end{array}
\end{array}
if im < 2e12Initial program 100.0%
Taylor expanded in im around 0 81.2%
Simplified81.2%
if 2e12 < im < 1.14999999999999997e77Initial program 100.0%
Taylor expanded in re around 0 77.8%
if 1.14999999999999997e77 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification84.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* 0.5 (cos re)) (+ 2.0 (* im im)))))
(if (<= im 1.6e+14)
t_0
(if (<= im 7.4e+73)
(* (* im im) (* 0.020833333333333332 (pow re 4.0)))
(if (<= im 1.28e+154) (* (pow im 4.0) 0.041666666666666664) t_0)))))
double code(double re, double im) {
double t_0 = (0.5 * cos(re)) * (2.0 + (im * im));
double tmp;
if (im <= 1.6e+14) {
tmp = t_0;
} else if (im <= 7.4e+73) {
tmp = (im * im) * (0.020833333333333332 * pow(re, 4.0));
} else if (im <= 1.28e+154) {
tmp = pow(im, 4.0) * 0.041666666666666664;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (0.5d0 * cos(re)) * (2.0d0 + (im * im))
if (im <= 1.6d+14) then
tmp = t_0
else if (im <= 7.4d+73) then
tmp = (im * im) * (0.020833333333333332d0 * (re ** 4.0d0))
else if (im <= 1.28d+154) then
tmp = (im ** 4.0d0) * 0.041666666666666664d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (0.5 * Math.cos(re)) * (2.0 + (im * im));
double tmp;
if (im <= 1.6e+14) {
tmp = t_0;
} else if (im <= 7.4e+73) {
tmp = (im * im) * (0.020833333333333332 * Math.pow(re, 4.0));
} else if (im <= 1.28e+154) {
tmp = Math.pow(im, 4.0) * 0.041666666666666664;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (0.5 * math.cos(re)) * (2.0 + (im * im)) tmp = 0 if im <= 1.6e+14: tmp = t_0 elif im <= 7.4e+73: tmp = (im * im) * (0.020833333333333332 * math.pow(re, 4.0)) elif im <= 1.28e+154: tmp = math.pow(im, 4.0) * 0.041666666666666664 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * cos(re)) * Float64(2.0 + Float64(im * im))) tmp = 0.0 if (im <= 1.6e+14) tmp = t_0; elseif (im <= 7.4e+73) tmp = Float64(Float64(im * im) * Float64(0.020833333333333332 * (re ^ 4.0))); elseif (im <= 1.28e+154) tmp = Float64((im ^ 4.0) * 0.041666666666666664); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * cos(re)) * (2.0 + (im * im)); tmp = 0.0; if (im <= 1.6e+14) tmp = t_0; elseif (im <= 7.4e+73) tmp = (im * im) * (0.020833333333333332 * (re ^ 4.0)); elseif (im <= 1.28e+154) tmp = (im ^ 4.0) * 0.041666666666666664; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 1.6e+14], t$95$0, If[LessEqual[im, 7.4e+73], N[(N[(im * im), $MachinePrecision] * N[(0.020833333333333332 * N[Power[re, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(N[Power[im, 4.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq 1.6 \cdot 10^{+14}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 7.4 \cdot 10^{+73}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.020833333333333332 \cdot {re}^{4}\right)\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;{im}^{4} \cdot 0.041666666666666664\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < 1.6e14 or 1.2800000000000001e154 < im Initial program 100.0%
Taylor expanded in im around 0 82.4%
Simplified82.4%
if 1.6e14 < im < 7.39999999999999947e73Initial program 100.0%
Taylor expanded in im around 0 3.9%
Simplified3.9%
Taylor expanded in im around inf 3.9%
*-commutative3.9%
unpow23.9%
associate-*l*3.9%
associate-*r*3.9%
*-commutative3.9%
Simplified3.9%
Taylor expanded in re around 0 1.5%
*-commutative1.5%
+-commutative1.5%
associate-*r*1.5%
associate-*r*1.5%
distribute-rgt-out7.4%
distribute-lft-out7.4%
unpow27.4%
+-commutative7.4%
*-commutative7.4%
unpow27.4%
associate-*r*7.4%
*-commutative7.4%
*-commutative7.4%
Simplified7.4%
Taylor expanded in re around inf 42.1%
*-commutative42.1%
unpow242.1%
*-commutative42.1%
associate-*l*42.1%
*-commutative42.1%
Simplified42.1%
if 7.39999999999999947e73 < im < 1.2800000000000001e154Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 55.0%
Final simplification77.6%
(FPCore (re im)
:precision binary64
(if (<= im 370.0)
(* (* 0.5 (cos re)) (+ 2.0 (* im im)))
(if (<= im 3e+154)
(*
(pow im 4.0)
(+ 0.041666666666666664 (* re (* re -0.020833333333333332))))
(* (* 0.5 im) (* (cos re) im)))))
double code(double re, double im) {
double tmp;
if (im <= 370.0) {
tmp = (0.5 * cos(re)) * (2.0 + (im * im));
} else if (im <= 3e+154) {
tmp = pow(im, 4.0) * (0.041666666666666664 + (re * (re * -0.020833333333333332)));
} else {
tmp = (0.5 * im) * (cos(re) * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 370.0d0) then
tmp = (0.5d0 * cos(re)) * (2.0d0 + (im * im))
else if (im <= 3d+154) then
tmp = (im ** 4.0d0) * (0.041666666666666664d0 + (re * (re * (-0.020833333333333332d0))))
else
tmp = (0.5d0 * im) * (cos(re) * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 370.0) {
tmp = (0.5 * Math.cos(re)) * (2.0 + (im * im));
} else if (im <= 3e+154) {
tmp = Math.pow(im, 4.0) * (0.041666666666666664 + (re * (re * -0.020833333333333332)));
} else {
tmp = (0.5 * im) * (Math.cos(re) * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 370.0: tmp = (0.5 * math.cos(re)) * (2.0 + (im * im)) elif im <= 3e+154: tmp = math.pow(im, 4.0) * (0.041666666666666664 + (re * (re * -0.020833333333333332))) else: tmp = (0.5 * im) * (math.cos(re) * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 370.0) tmp = Float64(Float64(0.5 * cos(re)) * Float64(2.0 + Float64(im * im))); elseif (im <= 3e+154) tmp = Float64((im ^ 4.0) * Float64(0.041666666666666664 + Float64(re * Float64(re * -0.020833333333333332)))); else tmp = Float64(Float64(0.5 * im) * Float64(cos(re) * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 370.0) tmp = (0.5 * cos(re)) * (2.0 + (im * im)); elseif (im <= 3e+154) tmp = (im ^ 4.0) * (0.041666666666666664 + (re * (re * -0.020833333333333332))); else tmp = (0.5 * im) * (cos(re) * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 370.0], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(2.0 + N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3e+154], N[(N[Power[im, 4.0], $MachinePrecision] * N[(0.041666666666666664 + N[(re * N[(re * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * im), $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 370:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{elif}\;im \leq 3 \cdot 10^{+154}:\\
\;\;\;\;{im}^{4} \cdot \left(0.041666666666666664 + re \cdot \left(re \cdot -0.020833333333333332\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot im\right) \cdot \left(\cos re \cdot im\right)\\
\end{array}
\end{array}
if im < 370Initial program 100.0%
Taylor expanded in im around 0 81.6%
Simplified81.6%
if 370 < im < 3.00000000000000026e154Initial program 100.0%
Taylor expanded in im around 0 54.9%
Simplified54.9%
Taylor expanded in im around inf 54.9%
Taylor expanded in re around 0 8.4%
associate-*r*8.4%
distribute-rgt-out50.9%
+-commutative50.9%
unpow250.9%
associate-*r*50.9%
*-commutative50.9%
*-commutative50.9%
Simplified50.9%
if 3.00000000000000026e154 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification78.4%
(FPCore (re im)
:precision binary64
(if (<= im 4.9e+14)
(cos re)
(if (<= im 4.9e+73)
(* -2.0 (+ 0.5 (* (* re re) -0.25)))
(if (<= im 1.28e+154)
(* (pow im 4.0) 0.041666666666666664)
(* (* 0.5 im) (* (cos re) im))))))
double code(double re, double im) {
double tmp;
if (im <= 4.9e+14) {
tmp = cos(re);
} else if (im <= 4.9e+73) {
tmp = -2.0 * (0.5 + ((re * re) * -0.25));
} else if (im <= 1.28e+154) {
tmp = pow(im, 4.0) * 0.041666666666666664;
} else {
tmp = (0.5 * im) * (cos(re) * 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.9d+14) then
tmp = cos(re)
else if (im <= 4.9d+73) then
tmp = (-2.0d0) * (0.5d0 + ((re * re) * (-0.25d0)))
else if (im <= 1.28d+154) then
tmp = (im ** 4.0d0) * 0.041666666666666664d0
else
tmp = (0.5d0 * im) * (cos(re) * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.9e+14) {
tmp = Math.cos(re);
} else if (im <= 4.9e+73) {
tmp = -2.0 * (0.5 + ((re * re) * -0.25));
} else if (im <= 1.28e+154) {
tmp = Math.pow(im, 4.0) * 0.041666666666666664;
} else {
tmp = (0.5 * im) * (Math.cos(re) * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.9e+14: tmp = math.cos(re) elif im <= 4.9e+73: tmp = -2.0 * (0.5 + ((re * re) * -0.25)) elif im <= 1.28e+154: tmp = math.pow(im, 4.0) * 0.041666666666666664 else: tmp = (0.5 * im) * (math.cos(re) * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.9e+14) tmp = cos(re); elseif (im <= 4.9e+73) tmp = Float64(-2.0 * Float64(0.5 + Float64(Float64(re * re) * -0.25))); elseif (im <= 1.28e+154) tmp = Float64((im ^ 4.0) * 0.041666666666666664); else tmp = Float64(Float64(0.5 * im) * Float64(cos(re) * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.9e+14) tmp = cos(re); elseif (im <= 4.9e+73) tmp = -2.0 * (0.5 + ((re * re) * -0.25)); elseif (im <= 1.28e+154) tmp = (im ^ 4.0) * 0.041666666666666664; else tmp = (0.5 * im) * (cos(re) * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.9e+14], N[Cos[re], $MachinePrecision], If[LessEqual[im, 4.9e+73], N[(-2.0 * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(N[Power[im, 4.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision], N[(N[(0.5 * im), $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.9 \cdot 10^{+14}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 4.9 \cdot 10^{+73}:\\
\;\;\;\;-2 \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;{im}^{4} \cdot 0.041666666666666664\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot im\right) \cdot \left(\cos re \cdot im\right)\\
\end{array}
\end{array}
if im < 4.9e14Initial program 100.0%
Taylor expanded in im around 0 68.8%
if 4.9e14 < im < 4.8999999999999999e73Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 0.0%
associate-*r*0.0%
distribute-rgt-out52.9%
*-commutative52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr36.4%
if 4.8999999999999999e73 < im < 1.2800000000000001e154Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 55.0%
if 1.2800000000000001e154 < im Initial program 100.0%
Taylor expanded in im around 0 96.4%
Simplified96.4%
Taylor expanded in im around inf 96.4%
*-commutative96.4%
unpow296.4%
associate-*l*96.4%
associate-*r*96.4%
*-commutative96.4%
Simplified96.4%
Final simplification68.1%
(FPCore (re im)
:precision binary64
(if (<= im 1.95e+14)
(cos re)
(if (<= im 7.4e+73)
(* (* im im) (* 0.020833333333333332 (pow re 4.0)))
(if (<= im 1.28e+154)
(* (pow im 4.0) 0.041666666666666664)
(* (* 0.5 im) (* (cos re) im))))))
double code(double re, double im) {
double tmp;
if (im <= 1.95e+14) {
tmp = cos(re);
} else if (im <= 7.4e+73) {
tmp = (im * im) * (0.020833333333333332 * pow(re, 4.0));
} else if (im <= 1.28e+154) {
tmp = pow(im, 4.0) * 0.041666666666666664;
} else {
tmp = (0.5 * im) * (cos(re) * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.95d+14) then
tmp = cos(re)
else if (im <= 7.4d+73) then
tmp = (im * im) * (0.020833333333333332d0 * (re ** 4.0d0))
else if (im <= 1.28d+154) then
tmp = (im ** 4.0d0) * 0.041666666666666664d0
else
tmp = (0.5d0 * im) * (cos(re) * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.95e+14) {
tmp = Math.cos(re);
} else if (im <= 7.4e+73) {
tmp = (im * im) * (0.020833333333333332 * Math.pow(re, 4.0));
} else if (im <= 1.28e+154) {
tmp = Math.pow(im, 4.0) * 0.041666666666666664;
} else {
tmp = (0.5 * im) * (Math.cos(re) * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.95e+14: tmp = math.cos(re) elif im <= 7.4e+73: tmp = (im * im) * (0.020833333333333332 * math.pow(re, 4.0)) elif im <= 1.28e+154: tmp = math.pow(im, 4.0) * 0.041666666666666664 else: tmp = (0.5 * im) * (math.cos(re) * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.95e+14) tmp = cos(re); elseif (im <= 7.4e+73) tmp = Float64(Float64(im * im) * Float64(0.020833333333333332 * (re ^ 4.0))); elseif (im <= 1.28e+154) tmp = Float64((im ^ 4.0) * 0.041666666666666664); else tmp = Float64(Float64(0.5 * im) * Float64(cos(re) * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.95e+14) tmp = cos(re); elseif (im <= 7.4e+73) tmp = (im * im) * (0.020833333333333332 * (re ^ 4.0)); elseif (im <= 1.28e+154) tmp = (im ^ 4.0) * 0.041666666666666664; else tmp = (0.5 * im) * (cos(re) * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.95e+14], N[Cos[re], $MachinePrecision], If[LessEqual[im, 7.4e+73], N[(N[(im * im), $MachinePrecision] * N[(0.020833333333333332 * N[Power[re, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.28e+154], N[(N[Power[im, 4.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision], N[(N[(0.5 * im), $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.95 \cdot 10^{+14}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 7.4 \cdot 10^{+73}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \left(0.020833333333333332 \cdot {re}^{4}\right)\\
\mathbf{elif}\;im \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;{im}^{4} \cdot 0.041666666666666664\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot im\right) \cdot \left(\cos re \cdot im\right)\\
\end{array}
\end{array}
if im < 1.95e14Initial program 100.0%
Taylor expanded in im around 0 68.8%
if 1.95e14 < im < 7.39999999999999947e73Initial program 100.0%
Taylor expanded in im around 0 3.9%
Simplified3.9%
Taylor expanded in im around inf 3.9%
*-commutative3.9%
unpow23.9%
associate-*l*3.9%
associate-*r*3.9%
*-commutative3.9%
Simplified3.9%
Taylor expanded in re around 0 1.5%
*-commutative1.5%
+-commutative1.5%
associate-*r*1.5%
associate-*r*1.5%
distribute-rgt-out7.4%
distribute-lft-out7.4%
unpow27.4%
+-commutative7.4%
*-commutative7.4%
unpow27.4%
associate-*r*7.4%
*-commutative7.4%
*-commutative7.4%
Simplified7.4%
Taylor expanded in re around inf 42.1%
*-commutative42.1%
unpow242.1%
*-commutative42.1%
associate-*l*42.1%
*-commutative42.1%
Simplified42.1%
if 7.39999999999999947e73 < im < 1.2800000000000001e154Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 55.0%
if 1.2800000000000001e154 < im Initial program 100.0%
Taylor expanded in im around 0 96.4%
Simplified96.4%
Taylor expanded in im around inf 96.4%
*-commutative96.4%
unpow296.4%
associate-*l*96.4%
associate-*r*96.4%
*-commutative96.4%
Simplified96.4%
Final simplification68.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.5 (* (* re re) -0.25))))
(if (<= im 3.3e+14)
(cos re)
(if (<= im 7.4e+73)
(* -2.0 t_0)
(if (<= im 5e+153)
(* (pow im 4.0) 0.041666666666666664)
(if (<= im 1e+178) (* (* im im) t_0) (* im (* 0.5 im))))))))
double code(double re, double im) {
double t_0 = 0.5 + ((re * re) * -0.25);
double tmp;
if (im <= 3.3e+14) {
tmp = cos(re);
} else if (im <= 7.4e+73) {
tmp = -2.0 * t_0;
} else if (im <= 5e+153) {
tmp = pow(im, 4.0) * 0.041666666666666664;
} else if (im <= 1e+178) {
tmp = (im * im) * t_0;
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 + ((re * re) * (-0.25d0))
if (im <= 3.3d+14) then
tmp = cos(re)
else if (im <= 7.4d+73) then
tmp = (-2.0d0) * t_0
else if (im <= 5d+153) then
tmp = (im ** 4.0d0) * 0.041666666666666664d0
else if (im <= 1d+178) then
tmp = (im * im) * t_0
else
tmp = im * (0.5d0 * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 + ((re * re) * -0.25);
double tmp;
if (im <= 3.3e+14) {
tmp = Math.cos(re);
} else if (im <= 7.4e+73) {
tmp = -2.0 * t_0;
} else if (im <= 5e+153) {
tmp = Math.pow(im, 4.0) * 0.041666666666666664;
} else if (im <= 1e+178) {
tmp = (im * im) * t_0;
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
def code(re, im): t_0 = 0.5 + ((re * re) * -0.25) tmp = 0 if im <= 3.3e+14: tmp = math.cos(re) elif im <= 7.4e+73: tmp = -2.0 * t_0 elif im <= 5e+153: tmp = math.pow(im, 4.0) * 0.041666666666666664 elif im <= 1e+178: tmp = (im * im) * t_0 else: tmp = im * (0.5 * im) return tmp
function code(re, im) t_0 = Float64(0.5 + Float64(Float64(re * re) * -0.25)) tmp = 0.0 if (im <= 3.3e+14) tmp = cos(re); elseif (im <= 7.4e+73) tmp = Float64(-2.0 * t_0); elseif (im <= 5e+153) tmp = Float64((im ^ 4.0) * 0.041666666666666664); elseif (im <= 1e+178) tmp = Float64(Float64(im * im) * t_0); else tmp = Float64(im * Float64(0.5 * im)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 + ((re * re) * -0.25); tmp = 0.0; if (im <= 3.3e+14) tmp = cos(re); elseif (im <= 7.4e+73) tmp = -2.0 * t_0; elseif (im <= 5e+153) tmp = (im ^ 4.0) * 0.041666666666666664; elseif (im <= 1e+178) tmp = (im * im) * t_0; else tmp = im * (0.5 * im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 3.3e+14], N[Cos[re], $MachinePrecision], If[LessEqual[im, 7.4e+73], N[(-2.0 * t$95$0), $MachinePrecision], If[LessEqual[im, 5e+153], N[(N[Power[im, 4.0], $MachinePrecision] * 0.041666666666666664), $MachinePrecision], If[LessEqual[im, 1e+178], N[(N[(im * im), $MachinePrecision] * t$95$0), $MachinePrecision], N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 + \left(re \cdot re\right) \cdot -0.25\\
\mathbf{if}\;im \leq 3.3 \cdot 10^{+14}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 7.4 \cdot 10^{+73}:\\
\;\;\;\;-2 \cdot t_0\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+153}:\\
\;\;\;\;{im}^{4} \cdot 0.041666666666666664\\
\mathbf{elif}\;im \leq 10^{+178}:\\
\;\;\;\;\left(im \cdot im\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot im\right)\\
\end{array}
\end{array}
if im < 3.3e14Initial program 100.0%
Taylor expanded in im around 0 68.8%
if 3.3e14 < im < 7.39999999999999947e73Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 0.0%
associate-*r*0.0%
distribute-rgt-out52.9%
*-commutative52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr36.4%
if 7.39999999999999947e73 < im < 5.00000000000000018e153Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 57.9%
if 5.00000000000000018e153 < im < 1.0000000000000001e178Initial program 100.0%
Taylor expanded in im around 0 58.3%
Simplified58.3%
Taylor expanded in im around inf 58.3%
*-commutative58.3%
unpow258.3%
associate-*l*58.3%
associate-*r*58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in re around 0 50.0%
associate-*r*50.0%
distribute-rgt-out75.0%
unpow275.0%
*-commutative75.0%
unpow275.0%
Simplified75.0%
if 1.0000000000000001e178 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
Final simplification66.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (* 0.5 im)))
(t_1 (* re (* (* im im) (* re -0.25))))
(t_2 (+ 0.5 (* (* re re) -0.25))))
(if (<= im 2.7e+14)
(cos re)
(if (<= im 5.3e+85)
(* -2.0 t_2)
(if (<= im 2e+143)
(/ (- (* t_0 t_0) (* t_1 t_1)) (- t_0 t_1))
(* (* im im) t_2))))))
double code(double re, double im) {
double t_0 = im * (0.5 * im);
double t_1 = re * ((im * im) * (re * -0.25));
double t_2 = 0.5 + ((re * re) * -0.25);
double tmp;
if (im <= 2.7e+14) {
tmp = cos(re);
} else if (im <= 5.3e+85) {
tmp = -2.0 * t_2;
} else if (im <= 2e+143) {
tmp = ((t_0 * t_0) - (t_1 * t_1)) / (t_0 - t_1);
} else {
tmp = (im * im) * t_2;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = im * (0.5d0 * im)
t_1 = re * ((im * im) * (re * (-0.25d0)))
t_2 = 0.5d0 + ((re * re) * (-0.25d0))
if (im <= 2.7d+14) then
tmp = cos(re)
else if (im <= 5.3d+85) then
tmp = (-2.0d0) * t_2
else if (im <= 2d+143) then
tmp = ((t_0 * t_0) - (t_1 * t_1)) / (t_0 - t_1)
else
tmp = (im * im) * t_2
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (0.5 * im);
double t_1 = re * ((im * im) * (re * -0.25));
double t_2 = 0.5 + ((re * re) * -0.25);
double tmp;
if (im <= 2.7e+14) {
tmp = Math.cos(re);
} else if (im <= 5.3e+85) {
tmp = -2.0 * t_2;
} else if (im <= 2e+143) {
tmp = ((t_0 * t_0) - (t_1 * t_1)) / (t_0 - t_1);
} else {
tmp = (im * im) * t_2;
}
return tmp;
}
def code(re, im): t_0 = im * (0.5 * im) t_1 = re * ((im * im) * (re * -0.25)) t_2 = 0.5 + ((re * re) * -0.25) tmp = 0 if im <= 2.7e+14: tmp = math.cos(re) elif im <= 5.3e+85: tmp = -2.0 * t_2 elif im <= 2e+143: tmp = ((t_0 * t_0) - (t_1 * t_1)) / (t_0 - t_1) else: tmp = (im * im) * t_2 return tmp
function code(re, im) t_0 = Float64(im * Float64(0.5 * im)) t_1 = Float64(re * Float64(Float64(im * im) * Float64(re * -0.25))) t_2 = Float64(0.5 + Float64(Float64(re * re) * -0.25)) tmp = 0.0 if (im <= 2.7e+14) tmp = cos(re); elseif (im <= 5.3e+85) tmp = Float64(-2.0 * t_2); elseif (im <= 2e+143) tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(t_1 * t_1)) / Float64(t_0 - t_1)); else tmp = Float64(Float64(im * im) * t_2); end return tmp end
function tmp_2 = code(re, im) t_0 = im * (0.5 * im); t_1 = re * ((im * im) * (re * -0.25)); t_2 = 0.5 + ((re * re) * -0.25); tmp = 0.0; if (im <= 2.7e+14) tmp = cos(re); elseif (im <= 5.3e+85) tmp = -2.0 * t_2; elseif (im <= 2e+143) tmp = ((t_0 * t_0) - (t_1 * t_1)) / (t_0 - t_1); else tmp = (im * im) * t_2; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(N[(im * im), $MachinePrecision] * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 2.7e+14], N[Cos[re], $MachinePrecision], If[LessEqual[im, 5.3e+85], N[(-2.0 * t$95$2), $MachinePrecision], If[LessEqual[im, 2e+143], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 \cdot im\right)\\
t_1 := re \cdot \left(\left(im \cdot im\right) \cdot \left(re \cdot -0.25\right)\right)\\
t_2 := 0.5 + \left(re \cdot re\right) \cdot -0.25\\
\mathbf{if}\;im \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 5.3 \cdot 10^{+85}:\\
\;\;\;\;-2 \cdot t_2\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+143}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - t_1 \cdot t_1}{t_0 - t_1}\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot t_2\\
\end{array}
\end{array}
if im < 2.7e14Initial program 100.0%
Taylor expanded in im around 0 68.8%
if 2.7e14 < im < 5.2999999999999999e85Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 0.0%
associate-*r*0.0%
distribute-rgt-out55.6%
*-commutative55.6%
unpow255.6%
Simplified55.6%
Applied egg-rr34.4%
if 5.2999999999999999e85 < im < 2e143Initial program 100.0%
Taylor expanded in im around 0 6.6%
Simplified6.6%
Taylor expanded in im around inf 6.6%
*-commutative6.6%
unpow26.6%
associate-*l*6.6%
associate-*r*6.6%
*-commutative6.6%
Simplified6.6%
Taylor expanded in re around 0 32.8%
associate-*r*32.8%
distribute-rgt-out32.8%
unpow232.8%
*-commutative32.8%
unpow232.8%
Simplified32.8%
distribute-lft-in32.8%
flip-+42.9%
associate-*l*42.9%
associate-*l*42.9%
associate-*r*42.9%
*-commutative42.9%
associate-*l*42.9%
associate-*r*42.9%
*-commutative42.9%
associate-*l*42.9%
associate-*l*42.9%
associate-*r*42.9%
*-commutative42.9%
associate-*l*42.9%
Applied egg-rr42.9%
if 2e143 < im Initial program 100.0%
Taylor expanded in im around 0 81.2%
Simplified81.2%
Taylor expanded in im around inf 81.2%
*-commutative81.2%
unpow281.2%
associate-*l*81.2%
associate-*r*81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in re around 0 14.7%
associate-*r*14.7%
distribute-rgt-out68.3%
unpow268.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Final simplification64.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.5 (* (* re re) -0.25)))
(t_1 (* im (* 0.5 im)))
(t_2 (* re (* (* im im) (* re -0.25)))))
(if (<= im 1.95e+14)
(+ 1.0 (* 0.5 (* im im)))
(if (<= im 2.2e+88)
(* -2.0 t_0)
(if (<= im 1.15e+142)
(/ (- (* t_1 t_1) (* t_2 t_2)) (- t_1 t_2))
(* (* im im) t_0))))))
double code(double re, double im) {
double t_0 = 0.5 + ((re * re) * -0.25);
double t_1 = im * (0.5 * im);
double t_2 = re * ((im * im) * (re * -0.25));
double tmp;
if (im <= 1.95e+14) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 2.2e+88) {
tmp = -2.0 * t_0;
} else if (im <= 1.15e+142) {
tmp = ((t_1 * t_1) - (t_2 * t_2)) / (t_1 - t_2);
} else {
tmp = (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.5d0 + ((re * re) * (-0.25d0))
t_1 = im * (0.5d0 * im)
t_2 = re * ((im * im) * (re * (-0.25d0)))
if (im <= 1.95d+14) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else if (im <= 2.2d+88) then
tmp = (-2.0d0) * t_0
else if (im <= 1.15d+142) then
tmp = ((t_1 * t_1) - (t_2 * t_2)) / (t_1 - t_2)
else
tmp = (im * im) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 + ((re * re) * -0.25);
double t_1 = im * (0.5 * im);
double t_2 = re * ((im * im) * (re * -0.25));
double tmp;
if (im <= 1.95e+14) {
tmp = 1.0 + (0.5 * (im * im));
} else if (im <= 2.2e+88) {
tmp = -2.0 * t_0;
} else if (im <= 1.15e+142) {
tmp = ((t_1 * t_1) - (t_2 * t_2)) / (t_1 - t_2);
} else {
tmp = (im * im) * t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 + ((re * re) * -0.25) t_1 = im * (0.5 * im) t_2 = re * ((im * im) * (re * -0.25)) tmp = 0 if im <= 1.95e+14: tmp = 1.0 + (0.5 * (im * im)) elif im <= 2.2e+88: tmp = -2.0 * t_0 elif im <= 1.15e+142: tmp = ((t_1 * t_1) - (t_2 * t_2)) / (t_1 - t_2) else: tmp = (im * im) * t_0 return tmp
function code(re, im) t_0 = Float64(0.5 + Float64(Float64(re * re) * -0.25)) t_1 = Float64(im * Float64(0.5 * im)) t_2 = Float64(re * Float64(Float64(im * im) * Float64(re * -0.25))) tmp = 0.0 if (im <= 1.95e+14) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); elseif (im <= 2.2e+88) tmp = Float64(-2.0 * t_0); elseif (im <= 1.15e+142) tmp = Float64(Float64(Float64(t_1 * t_1) - Float64(t_2 * t_2)) / Float64(t_1 - t_2)); else tmp = Float64(Float64(im * im) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 + ((re * re) * -0.25); t_1 = im * (0.5 * im); t_2 = re * ((im * im) * (re * -0.25)); tmp = 0.0; if (im <= 1.95e+14) tmp = 1.0 + (0.5 * (im * im)); elseif (im <= 2.2e+88) tmp = -2.0 * t_0; elseif (im <= 1.15e+142) tmp = ((t_1 * t_1) - (t_2 * t_2)) / (t_1 - t_2); else tmp = (im * im) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(N[(im * im), $MachinePrecision] * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 1.95e+14], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.2e+88], N[(-2.0 * t$95$0), $MachinePrecision], If[LessEqual[im, 1.15e+142], N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(im * im), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 + \left(re \cdot re\right) \cdot -0.25\\
t_1 := im \cdot \left(0.5 \cdot im\right)\\
t_2 := re \cdot \left(\left(im \cdot im\right) \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{if}\;im \leq 1.95 \cdot 10^{+14}:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;im \leq 2.2 \cdot 10^{+88}:\\
\;\;\;\;-2 \cdot t_0\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+142}:\\
\;\;\;\;\frac{t_1 \cdot t_1 - t_2 \cdot t_2}{t_1 - t_2}\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot im\right) \cdot t_0\\
\end{array}
\end{array}
if im < 1.95e14Initial program 100.0%
Taylor expanded in im around 0 80.8%
Simplified80.8%
Taylor expanded in re around 0 47.5%
distribute-lft-in47.5%
metadata-eval47.5%
unpow247.5%
Simplified47.5%
if 1.95e14 < im < 2.20000000000000009e88Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0 0.0%
associate-*r*0.0%
distribute-rgt-out55.6%
*-commutative55.6%
unpow255.6%
Simplified55.6%
Applied egg-rr34.4%
if 2.20000000000000009e88 < im < 1.15000000000000001e142Initial program 100.0%
Taylor expanded in im around 0 6.6%
Simplified6.6%
Taylor expanded in im around inf 6.6%
*-commutative6.6%
unpow26.6%
associate-*l*6.6%
associate-*r*6.6%
*-commutative6.6%
Simplified6.6%
Taylor expanded in re around 0 32.8%
associate-*r*32.8%
distribute-rgt-out32.8%
unpow232.8%
*-commutative32.8%
unpow232.8%
Simplified32.8%
distribute-lft-in32.8%
flip-+42.9%
associate-*l*42.9%
associate-*l*42.9%
associate-*r*42.9%
*-commutative42.9%
associate-*l*42.9%
associate-*r*42.9%
*-commutative42.9%
associate-*l*42.9%
associate-*l*42.9%
associate-*r*42.9%
*-commutative42.9%
associate-*l*42.9%
Applied egg-rr42.9%
if 1.15000000000000001e142 < im Initial program 100.0%
Taylor expanded in im around 0 81.2%
Simplified81.2%
Taylor expanded in im around inf 81.2%
*-commutative81.2%
unpow281.2%
associate-*l*81.2%
associate-*r*81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in re around 0 14.7%
associate-*r*14.7%
distribute-rgt-out68.3%
unpow268.3%
*-commutative68.3%
unpow268.3%
Simplified68.3%
Final simplification48.6%
(FPCore (re im)
:precision binary64
(if (<= re 1.16e+14)
(+ 1.0 (* 0.5 (* im im)))
(if (<= re 2.1e+230)
(* -0.25 (* (* re im) (* re im)))
(* -2.0 (+ 0.5 (* (* re re) -0.25))))))
double code(double re, double im) {
double tmp;
if (re <= 1.16e+14) {
tmp = 1.0 + (0.5 * (im * im));
} else if (re <= 2.1e+230) {
tmp = -0.25 * ((re * im) * (re * im));
} else {
tmp = -2.0 * (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 (re <= 1.16d+14) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else if (re <= 2.1d+230) then
tmp = (-0.25d0) * ((re * im) * (re * im))
else
tmp = (-2.0d0) * (0.5d0 + ((re * re) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.16e+14) {
tmp = 1.0 + (0.5 * (im * im));
} else if (re <= 2.1e+230) {
tmp = -0.25 * ((re * im) * (re * im));
} else {
tmp = -2.0 * (0.5 + ((re * re) * -0.25));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.16e+14: tmp = 1.0 + (0.5 * (im * im)) elif re <= 2.1e+230: tmp = -0.25 * ((re * im) * (re * im)) else: tmp = -2.0 * (0.5 + ((re * re) * -0.25)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.16e+14) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); elseif (re <= 2.1e+230) tmp = Float64(-0.25 * Float64(Float64(re * im) * Float64(re * im))); else tmp = Float64(-2.0 * Float64(0.5 + Float64(Float64(re * re) * -0.25))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.16e+14) tmp = 1.0 + (0.5 * (im * im)); elseif (re <= 2.1e+230) tmp = -0.25 * ((re * im) * (re * im)); else tmp = -2.0 * (0.5 + ((re * re) * -0.25)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.16e+14], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 2.1e+230], N[(-0.25 * N[(N[(re * im), $MachinePrecision] * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.16 \cdot 10^{+14}:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{elif}\;re \leq 2.1 \cdot 10^{+230}:\\
\;\;\;\;-0.25 \cdot \left(\left(re \cdot im\right) \cdot \left(re \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if re < 1.16e14Initial program 100.0%
Taylor expanded in im around 0 71.7%
Simplified71.7%
Taylor expanded in re around 0 54.4%
distribute-lft-in54.4%
metadata-eval54.4%
unpow254.4%
Simplified54.4%
if 1.16e14 < re < 2.09999999999999993e230Initial program 100.0%
Taylor expanded in im around 0 69.9%
Simplified69.9%
Taylor expanded in im around inf 20.9%
*-commutative20.9%
unpow220.9%
associate-*l*20.9%
associate-*r*20.9%
*-commutative20.9%
Simplified20.9%
Taylor expanded in re around 0 16.6%
associate-*r*16.6%
distribute-rgt-out27.9%
unpow227.9%
*-commutative27.9%
unpow227.9%
Simplified27.9%
Taylor expanded in re around inf 27.9%
unpow227.9%
unpow227.9%
unswap-sqr28.6%
Simplified28.6%
if 2.09999999999999993e230 < re Initial program 100.0%
Applied egg-rr99.3%
Taylor expanded in re around 0 0.9%
associate-*r*0.9%
distribute-rgt-out15.2%
*-commutative15.2%
unpow215.2%
Simplified15.2%
Applied egg-rr29.8%
Final simplification47.7%
(FPCore (re im) :precision binary64 (if (<= im 4.6e-8) 1.0 (* (* im im) (+ 0.5 (* (* re re) -0.25)))))
double code(double re, double im) {
double tmp;
if (im <= 4.6e-8) {
tmp = 1.0;
} 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 <= 4.6d-8) then
tmp = 1.0d0
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 <= 4.6e-8) {
tmp = 1.0;
} else {
tmp = (im * im) * (0.5 + ((re * re) * -0.25));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.6e-8: tmp = 1.0 else: tmp = (im * im) * (0.5 + ((re * re) * -0.25)) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.6e-8) tmp = 1.0; 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 <= 4.6e-8) tmp = 1.0; else tmp = (im * im) * (0.5 + ((re * re) * -0.25)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.6e-8], 1.0, 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 4.6 \cdot 10^{-8}:\\
\;\;\;\;1\\
\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 < 4.6000000000000002e-8Initial program 100.0%
Taylor expanded in im around 0 69.2%
Taylor expanded in re around 0 40.4%
if 4.6000000000000002e-8 < im Initial program 100.0%
Taylor expanded in im around 0 41.3%
Simplified41.3%
Taylor expanded in im around inf 38.5%
*-commutative38.5%
unpow238.5%
associate-*l*38.5%
associate-*r*38.5%
*-commutative38.5%
Simplified38.5%
Taylor expanded in re around 0 19.0%
associate-*r*19.0%
distribute-rgt-out42.4%
unpow242.4%
*-commutative42.4%
unpow242.4%
Simplified42.4%
Final simplification40.9%
(FPCore (re im) :precision binary64 (if (<= im 4.6e-8) 1.0 (if (<= im 5.4e+163) (+ 1.0 (* (* re re) -0.5)) (* im (* 0.5 im)))))
double code(double re, double im) {
double tmp;
if (im <= 4.6e-8) {
tmp = 1.0;
} else if (im <= 5.4e+163) {
tmp = 1.0 + ((re * re) * -0.5);
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 4.6d-8) then
tmp = 1.0d0
else if (im <= 5.4d+163) then
tmp = 1.0d0 + ((re * re) * (-0.5d0))
else
tmp = im * (0.5d0 * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.6e-8) {
tmp = 1.0;
} else if (im <= 5.4e+163) {
tmp = 1.0 + ((re * re) * -0.5);
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.6e-8: tmp = 1.0 elif im <= 5.4e+163: tmp = 1.0 + ((re * re) * -0.5) else: tmp = im * (0.5 * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.6e-8) tmp = 1.0; elseif (im <= 5.4e+163) tmp = Float64(1.0 + Float64(Float64(re * re) * -0.5)); else tmp = Float64(im * Float64(0.5 * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.6e-8) tmp = 1.0; elseif (im <= 5.4e+163) tmp = 1.0 + ((re * re) * -0.5); else tmp = im * (0.5 * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.6e-8], 1.0, If[LessEqual[im, 5.4e+163], N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.6 \cdot 10^{-8}:\\
\;\;\;\;1\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+163}:\\
\;\;\;\;1 + \left(re \cdot re\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot im\right)\\
\end{array}
\end{array}
if im < 4.6000000000000002e-8Initial program 100.0%
Taylor expanded in im around 0 69.2%
Taylor expanded in re around 0 40.4%
if 4.6000000000000002e-8 < im < 5.39999999999999998e163Initial program 100.0%
Applied egg-rr100.0%
Applied egg-rr7.4%
Taylor expanded in re around 0 14.5%
unpow214.5%
Simplified14.5%
if 5.39999999999999998e163 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 77.3%
Final simplification39.3%
(FPCore (re im) :precision binary64 (if (<= re 1.05e+153) (+ 1.0 (* 0.5 (* im im))) (* -2.0 (+ 0.5 (* (* re re) -0.25)))))
double code(double re, double im) {
double tmp;
if (re <= 1.05e+153) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = -2.0 * (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 (re <= 1.05d+153) then
tmp = 1.0d0 + (0.5d0 * (im * im))
else
tmp = (-2.0d0) * (0.5d0 + ((re * re) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.05e+153) {
tmp = 1.0 + (0.5 * (im * im));
} else {
tmp = -2.0 * (0.5 + ((re * re) * -0.25));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.05e+153: tmp = 1.0 + (0.5 * (im * im)) else: tmp = -2.0 * (0.5 + ((re * re) * -0.25)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.05e+153) tmp = Float64(1.0 + Float64(0.5 * Float64(im * im))); else tmp = Float64(-2.0 * Float64(0.5 + Float64(Float64(re * re) * -0.25))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.05e+153) tmp = 1.0 + (0.5 * (im * im)); else tmp = -2.0 * (0.5 + ((re * re) * -0.25)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.05e+153], N[(1.0 + N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.05 \cdot 10^{+153}:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if re < 1.05000000000000008e153Initial program 100.0%
Taylor expanded in im around 0 72.7%
Simplified72.7%
Taylor expanded in re around 0 48.6%
distribute-lft-in48.6%
metadata-eval48.6%
unpow248.6%
Simplified48.6%
if 1.05000000000000008e153 < re Initial program 100.0%
Applied egg-rr99.5%
Taylor expanded in re around 0 1.0%
associate-*r*1.0%
distribute-rgt-out25.3%
*-commutative25.3%
unpow225.3%
Simplified25.3%
Applied egg-rr25.2%
Final simplification45.6%
(FPCore (re im) :precision binary64 (if (<= im 4.6e-8) 1.0 (* im (* 0.5 im))))
double code(double re, double im) {
double tmp;
if (im <= 4.6e-8) {
tmp = 1.0;
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 4.6d-8) then
tmp = 1.0d0
else
tmp = im * (0.5d0 * im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 4.6e-8) {
tmp = 1.0;
} else {
tmp = im * (0.5 * im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 4.6e-8: tmp = 1.0 else: tmp = im * (0.5 * im) return tmp
function code(re, im) tmp = 0.0 if (im <= 4.6e-8) tmp = 1.0; else tmp = Float64(im * Float64(0.5 * im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 4.6e-8) tmp = 1.0; else tmp = im * (0.5 * im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 4.6e-8], 1.0, N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 4.6 \cdot 10^{-8}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot im\right)\\
\end{array}
\end{array}
if im < 4.6000000000000002e-8Initial program 100.0%
Taylor expanded in im around 0 69.2%
Taylor expanded in re around 0 40.4%
if 4.6000000000000002e-8 < im Initial program 100.0%
Taylor expanded in im around 0 41.3%
Simplified41.3%
Taylor expanded in im around inf 38.5%
*-commutative38.5%
unpow238.5%
associate-*l*38.5%
associate-*r*38.5%
*-commutative38.5%
Simplified38.5%
Taylor expanded in re around 0 28.8%
Final simplification37.5%
(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 53.4%
Taylor expanded in re around 0 30.9%
Final simplification30.9%
herbie shell --seed 2023243
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))