
(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 16 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%
(FPCore (re im)
:precision binary64
(if (<= im 1.02e-8)
(cos re)
(if (<= im 1e+103)
(* 0.5 (+ (exp (- im)) (exp im)))
(*
0.5
(*
(cos re)
(- (+ 2.0 (* im (+ 1.0 (* im (* im 0.16666666666666666))))) im))))))
double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = cos(re);
} else if (im <= 1e+103) {
tmp = 0.5 * (exp(-im) + exp(im));
} else {
tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - 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.02d-8) then
tmp = cos(re)
else if (im <= 1d+103) then
tmp = 0.5d0 * (exp(-im) + exp(im))
else
tmp = 0.5d0 * (cos(re) * ((2.0d0 + (im * (1.0d0 + (im * (im * 0.16666666666666666d0))))) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = Math.cos(re);
} else if (im <= 1e+103) {
tmp = 0.5 * (Math.exp(-im) + Math.exp(im));
} else {
tmp = 0.5 * (Math.cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.02e-8: tmp = math.cos(re) elif im <= 1e+103: tmp = 0.5 * (math.exp(-im) + math.exp(im)) else: tmp = 0.5 * (math.cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1e+103) tmp = Float64(0.5 * Float64(exp(Float64(-im)) + exp(im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(im * Float64(im * 0.16666666666666666))))) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1e+103) tmp = 0.5 * (exp(-im) + exp(im)); else tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.02e-8], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1e+103], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(2.0 + N[(im * N[(1.0 + N[(im * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.02 \cdot 10^{-8}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 10^{+103}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(2 + im \cdot \left(1 + im \cdot \left(im \cdot 0.16666666666666666\right)\right)\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 1.02000000000000003e-8Initial program 100.0%
Taylor expanded in im around 0 72.1%
Taylor expanded in re around inf 72.1%
if 1.02000000000000003e-8 < im < 1e103Initial program 100.0%
Taylor expanded in re around 0 81.8%
if 1e103 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (+ (exp im) (- 1.0 im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(im) + (1.0 - im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(im) + (1.0d0 - im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(im) + (1.0 - im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp(im) + (1.0 - im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(im) + Float64(1.0 - im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp(im) + (1.0 - im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[im], $MachinePrecision] + N[(1.0 - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{im} + \left(1 - im\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0 79.7%
neg-mul-179.7%
unsub-neg79.7%
Simplified79.7%
Final simplification79.7%
(FPCore (re im)
:precision binary64
(if (<= im 1.02e-8)
(cos re)
(if (<= im 1e+103)
(*
0.5
(+
(exp im)
(+ 1.0 (* im (+ (* im (+ 0.5 (* im -0.16666666666666666))) -1.0)))))
(*
0.5
(*
(cos re)
(- (+ 2.0 (* im (+ 1.0 (* im (* im 0.16666666666666666))))) im))))))
double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = cos(re);
} else if (im <= 1e+103) {
tmp = 0.5 * (exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))));
} else {
tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - 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.02d-8) then
tmp = cos(re)
else if (im <= 1d+103) then
tmp = 0.5d0 * (exp(im) + (1.0d0 + (im * ((im * (0.5d0 + (im * (-0.16666666666666666d0)))) + (-1.0d0)))))
else
tmp = 0.5d0 * (cos(re) * ((2.0d0 + (im * (1.0d0 + (im * (im * 0.16666666666666666d0))))) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = Math.cos(re);
} else if (im <= 1e+103) {
tmp = 0.5 * (Math.exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0))));
} else {
tmp = 0.5 * (Math.cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.02e-8: tmp = math.cos(re) elif im <= 1e+103: tmp = 0.5 * (math.exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))) else: tmp = 0.5 * (math.cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1e+103) tmp = Float64(0.5 * Float64(exp(im) + Float64(1.0 + Float64(im * Float64(Float64(im * Float64(0.5 + Float64(im * -0.16666666666666666))) + -1.0))))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(im * Float64(im * 0.16666666666666666))))) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1e+103) tmp = 0.5 * (exp(im) + (1.0 + (im * ((im * (0.5 + (im * -0.16666666666666666))) + -1.0)))); else tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.02e-8], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1e+103], N[(0.5 * N[(N[Exp[im], $MachinePrecision] + N[(1.0 + N[(im * N[(N[(im * N[(0.5 + N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(2.0 + N[(im * N[(1.0 + N[(im * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.02 \cdot 10^{-8}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 10^{+103}:\\
\;\;\;\;0.5 \cdot \left(e^{im} + \left(1 + im \cdot \left(im \cdot \left(0.5 + im \cdot -0.16666666666666666\right) + -1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(2 + im \cdot \left(1 + im \cdot \left(im \cdot 0.16666666666666666\right)\right)\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 1.02000000000000003e-8Initial program 100.0%
Taylor expanded in im around 0 72.1%
Taylor expanded in re around inf 72.1%
if 1.02000000000000003e-8 < im < 1e103Initial program 100.0%
Taylor expanded in re around 0 81.8%
Taylor expanded in im around 0 81.1%
if 1e103 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification77.8%
(FPCore (re im)
:precision binary64
(if (<= im 1.02e-8)
(cos re)
(if (<= im 1e+103)
(+ 0.5 (* 0.5 (- (exp im) im)))
(*
0.5
(*
(cos re)
(- (+ 2.0 (* im (+ 1.0 (* im (* im 0.16666666666666666))))) im))))))
double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = cos(re);
} else if (im <= 1e+103) {
tmp = 0.5 + (0.5 * (exp(im) - im));
} else {
tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - 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.02d-8) then
tmp = cos(re)
else if (im <= 1d+103) then
tmp = 0.5d0 + (0.5d0 * (exp(im) - im))
else
tmp = 0.5d0 * (cos(re) * ((2.0d0 + (im * (1.0d0 + (im * (im * 0.16666666666666666d0))))) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = Math.cos(re);
} else if (im <= 1e+103) {
tmp = 0.5 + (0.5 * (Math.exp(im) - im));
} else {
tmp = 0.5 * (Math.cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.02e-8: tmp = math.cos(re) elif im <= 1e+103: tmp = 0.5 + (0.5 * (math.exp(im) - im)) else: tmp = 0.5 * (math.cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1e+103) tmp = Float64(0.5 + Float64(0.5 * Float64(exp(im) - im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(im * Float64(im * 0.16666666666666666))))) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1e+103) tmp = 0.5 + (0.5 * (exp(im) - im)); else tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.02e-8], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1e+103], N[(0.5 + N[(0.5 * N[(N[Exp[im], $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(2.0 + N[(im * N[(1.0 + N[(im * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.02 \cdot 10^{-8}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 10^{+103}:\\
\;\;\;\;0.5 + 0.5 \cdot \left(e^{im} - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(2 + im \cdot \left(1 + im \cdot \left(im \cdot 0.16666666666666666\right)\right)\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 1.02000000000000003e-8Initial program 100.0%
Taylor expanded in im around 0 72.1%
Taylor expanded in re around inf 72.1%
if 1.02000000000000003e-8 < im < 1e103Initial program 100.0%
Taylor expanded in im around 0 97.7%
neg-mul-197.7%
unsub-neg97.7%
Simplified97.7%
Taylor expanded in re around 0 79.6%
associate--l+79.6%
distribute-rgt-in79.6%
metadata-eval79.6%
Simplified79.6%
if 1e103 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification77.6%
(FPCore (re im)
:precision binary64
(if (<= im 1.02e-8)
(cos re)
(if (<= im 1.9e+154)
(+ 0.5 (* 0.5 (- (exp im) im)))
(* 0.5 (* (cos re) (- (+ 2.0 (* im (+ 1.0 (* 0.5 im)))) im))))))
double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = cos(re);
} else if (im <= 1.9e+154) {
tmp = 0.5 + (0.5 * (exp(im) - im));
} else {
tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.02d-8) then
tmp = cos(re)
else if (im <= 1.9d+154) then
tmp = 0.5d0 + (0.5d0 * (exp(im) - im))
else
tmp = 0.5d0 * (cos(re) * ((2.0d0 + (im * (1.0d0 + (0.5d0 * im)))) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = Math.cos(re);
} else if (im <= 1.9e+154) {
tmp = 0.5 + (0.5 * (Math.exp(im) - im));
} else {
tmp = 0.5 * (Math.cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.02e-8: tmp = math.cos(re) elif im <= 1.9e+154: tmp = 0.5 + (0.5 * (math.exp(im) - im)) else: tmp = 0.5 * (math.cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1.9e+154) tmp = Float64(0.5 + Float64(0.5 * Float64(exp(im) - im))); else tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.02e-8) tmp = cos(re); elseif (im <= 1.9e+154) tmp = 0.5 + (0.5 * (exp(im) - im)); else tmp = 0.5 * (cos(re) * ((2.0 + (im * (1.0 + (0.5 * im)))) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.02e-8], N[Cos[re], $MachinePrecision], If[LessEqual[im, 1.9e+154], N[(0.5 + N[(0.5 * N[(N[Exp[im], $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(2.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.02 \cdot 10^{-8}:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;0.5 + 0.5 \cdot \left(e^{im} - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(\left(2 + im \cdot \left(1 + 0.5 \cdot im\right)\right) - im\right)\right)\\
\end{array}
\end{array}
if im < 1.02000000000000003e-8Initial program 100.0%
Taylor expanded in im around 0 72.1%
Taylor expanded in re around inf 72.1%
if 1.02000000000000003e-8 < im < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in im around 0 98.4%
neg-mul-198.4%
unsub-neg98.4%
Simplified98.4%
Taylor expanded in re around 0 79.0%
associate--l+79.0%
distribute-rgt-in79.0%
metadata-eval79.0%
Simplified79.0%
if 1.8999999999999999e154 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
Taylor expanded in im around 0 100.0%
Final simplification76.8%
(FPCore (re im) :precision binary64 (if (<= im 1.02e-8) (cos re) (+ 0.5 (* 0.5 (- (exp im) im)))))
double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = cos(re);
} else {
tmp = 0.5 + (0.5 * (exp(im) - im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 1.02d-8) then
tmp = cos(re)
else
tmp = 0.5d0 + (0.5d0 * (exp(im) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 1.02e-8) {
tmp = Math.cos(re);
} else {
tmp = 0.5 + (0.5 * (Math.exp(im) - im));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 1.02e-8: tmp = math.cos(re) else: tmp = 0.5 + (0.5 * (math.exp(im) - im)) return tmp
function code(re, im) tmp = 0.0 if (im <= 1.02e-8) tmp = cos(re); else tmp = Float64(0.5 + Float64(0.5 * Float64(exp(im) - im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 1.02e-8) tmp = cos(re); else tmp = 0.5 + (0.5 * (exp(im) - im)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 1.02e-8], N[Cos[re], $MachinePrecision], N[(0.5 + N[(0.5 * N[(N[Exp[im], $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 1.02 \cdot 10^{-8}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;0.5 + 0.5 \cdot \left(e^{im} - im\right)\\
\end{array}
\end{array}
if im < 1.02000000000000003e-8Initial program 100.0%
Taylor expanded in im around 0 72.1%
Taylor expanded in re around inf 72.1%
if 1.02000000000000003e-8 < im Initial program 100.0%
Taylor expanded in im around 0 99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in re around 0 76.9%
associate--l+76.9%
distribute-rgt-in76.9%
metadata-eval76.9%
Simplified76.9%
Final simplification73.3%
(FPCore (re im)
:precision binary64
(if (<= im 6.8e+28)
(cos re)
(*
0.5
(+
(- 1.0 im)
(+ 1.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))))
double code(double re, double im) {
double tmp;
if (im <= 6.8e+28) {
tmp = cos(re);
} else {
tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 6.8d+28) then
tmp = cos(re)
else
tmp = 0.5d0 * ((1.0d0 - im) + (1.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 6.8e+28) {
tmp = Math.cos(re);
} else {
tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 6.8e+28: tmp = math.cos(re) else: tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))))) return tmp
function code(re, im) tmp = 0.0 if (im <= 6.8e+28) tmp = cos(re); else tmp = Float64(0.5 * Float64(Float64(1.0 - im) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 6.8e+28) tmp = cos(re); else tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 6.8e+28], N[Cos[re], $MachinePrecision], N[(0.5 * N[(N[(1.0 - im), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 6.8 \cdot 10^{+28}:\\
\;\;\;\;\cos re\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(1 - im\right) + \left(1 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\right)\\
\end{array}
\end{array}
if im < 6.8e28Initial program 100.0%
Taylor expanded in im around 0 69.8%
Taylor expanded in re around inf 69.8%
if 6.8e28 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in re around 0 57.8%
(FPCore (re im)
:precision binary64
(if (<= re 5.8e+166)
(*
0.5
(+
(- 1.0 im)
(+ 1.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666))))))))
(+ 1.0 (* -0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))));
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 5.8d+166) then
tmp = 0.5d0 * ((1.0d0 - im) + (1.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))))
else
tmp = 1.0d0 + ((-0.5d0) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))));
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.8e+166: tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))))) else: tmp = 1.0 + (-0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 5.8e+166) tmp = Float64(0.5 * Float64(Float64(1.0 - im) + Float64(1.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))))); else tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5.8e+166) tmp = 0.5 * ((1.0 - im) + (1.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666))))))); else tmp = 1.0 + (-0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.8e+166], N[(0.5 * N[(N[(1.0 - im), $MachinePrecision] + N[(1.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5.8 \cdot 10^{+166}:\\
\;\;\;\;0.5 \cdot \left(\left(1 - im\right) + \left(1 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 5.8000000000000003e166Initial program 100.0%
Taylor expanded in im around 0 79.2%
neg-mul-179.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in im around 0 70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in re around 0 46.6%
if 5.8000000000000003e166 < re Initial program 100.0%
Taylor expanded in im around 0 59.9%
Taylor expanded in re around 0 25.4%
unpow225.4%
Applied egg-rr25.4%
(FPCore (re im)
:precision binary64
(if (<= re 5.8e+166)
(*
0.5
(- (+ 2.0 (* im (+ 1.0 (* im (+ 0.5 (* im 0.16666666666666666)))))) im))
(+ 1.0 (* -0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) - im);
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 5.8d+166) then
tmp = 0.5d0 * ((2.0d0 + (im * (1.0d0 + (im * (0.5d0 + (im * 0.16666666666666666d0)))))) - im)
else
tmp = 1.0d0 + ((-0.5d0) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) - im);
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.8e+166: tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) - im) else: tmp = 1.0 + (-0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 5.8e+166) tmp = Float64(0.5 * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(im * Float64(0.5 + Float64(im * 0.16666666666666666)))))) - im)); else tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5.8e+166) tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (0.5 + (im * 0.16666666666666666)))))) - im); else tmp = 1.0 + (-0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.8e+166], N[(0.5 * N[(N[(2.0 + N[(im * N[(1.0 + N[(im * N[(0.5 + N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5.8 \cdot 10^{+166}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + im \cdot \left(1 + im \cdot \left(0.5 + im \cdot 0.16666666666666666\right)\right)\right) - im\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 5.8000000000000003e166Initial program 100.0%
Taylor expanded in im around 0 79.2%
neg-mul-179.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in im around 0 70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in re around 0 46.6%
if 5.8000000000000003e166 < re Initial program 100.0%
Taylor expanded in im around 0 59.9%
Taylor expanded in re around 0 25.4%
unpow225.4%
Applied egg-rr25.4%
Final simplification44.2%
(FPCore (re im) :precision binary64 (if (<= re 5.8e+166) (* 0.5 (- (+ 2.0 (* im (+ 1.0 (* im (* im 0.16666666666666666))))) im)) (+ 1.0 (* -0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im);
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 5.8d+166) then
tmp = 0.5d0 * ((2.0d0 + (im * (1.0d0 + (im * (im * 0.16666666666666666d0))))) - im)
else
tmp = 1.0d0 + ((-0.5d0) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im);
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.8e+166: tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im) else: tmp = 1.0 + (-0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 5.8e+166) tmp = Float64(0.5 * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(im * Float64(im * 0.16666666666666666))))) - im)); else tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5.8e+166) tmp = 0.5 * ((2.0 + (im * (1.0 + (im * (im * 0.16666666666666666))))) - im); else tmp = 1.0 + (-0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.8e+166], N[(0.5 * N[(N[(2.0 + N[(im * N[(1.0 + N[(im * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5.8 \cdot 10^{+166}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + im \cdot \left(1 + im \cdot \left(im \cdot 0.16666666666666666\right)\right)\right) - im\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 5.8000000000000003e166Initial program 100.0%
Taylor expanded in im around 0 79.2%
neg-mul-179.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in im around 0 70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in re around 0 46.6%
Taylor expanded in im around inf 46.6%
*-commutative70.9%
Simplified46.6%
if 5.8000000000000003e166 < re Initial program 100.0%
Taylor expanded in im around 0 59.9%
Taylor expanded in re around 0 25.4%
unpow225.4%
Applied egg-rr25.4%
(FPCore (re im) :precision binary64 (if (<= re 5.8e+166) (* 0.5 (- (+ 2.0 (* im (+ 1.0 (* 0.5 im)))) im)) (+ 1.0 (* -0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im);
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 5.8d+166) then
tmp = 0.5d0 * ((2.0d0 + (im * (1.0d0 + (0.5d0 * im)))) - im)
else
tmp = 1.0d0 + ((-0.5d0) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5.8e+166) {
tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im);
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.8e+166: tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im) else: tmp = 1.0 + (-0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 5.8e+166) tmp = Float64(0.5 * Float64(Float64(2.0 + Float64(im * Float64(1.0 + Float64(0.5 * im)))) - im)); else tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5.8e+166) tmp = 0.5 * ((2.0 + (im * (1.0 + (0.5 * im)))) - im); else tmp = 1.0 + (-0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.8e+166], N[(0.5 * N[(N[(2.0 + N[(im * N[(1.0 + N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5.8 \cdot 10^{+166}:\\
\;\;\;\;0.5 \cdot \left(\left(2 + im \cdot \left(1 + 0.5 \cdot im\right)\right) - im\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if re < 5.8000000000000003e166Initial program 100.0%
Taylor expanded in im around 0 79.2%
neg-mul-179.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in im around 0 70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in re around 0 46.6%
Taylor expanded in im around 0 46.9%
if 5.8000000000000003e166 < re Initial program 100.0%
Taylor expanded in im around 0 59.9%
Taylor expanded in re around 0 25.4%
unpow225.4%
Applied egg-rr25.4%
Final simplification44.4%
(FPCore (re im) :precision binary64 (if (<= im 16000.0) 1.0 (+ 1.0 (* -0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (im <= 16000.0) {
tmp = 1.0;
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 16000.0d0) then
tmp = 1.0d0
else
tmp = 1.0d0 + ((-0.5d0) * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 16000.0) {
tmp = 1.0;
} else {
tmp = 1.0 + (-0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 16000.0: tmp = 1.0 else: tmp = 1.0 + (-0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (im <= 16000.0) tmp = 1.0; else tmp = Float64(1.0 + Float64(-0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 16000.0) tmp = 1.0; else tmp = 1.0 + (-0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 16000.0], 1.0, N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 16000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(re \cdot re\right)\\
\end{array}
\end{array}
if im < 16000Initial program 100.0%
Taylor expanded in im around 0 72.0%
Taylor expanded in re around 0 33.8%
if 16000 < im Initial program 100.0%
Taylor expanded in im around 0 3.1%
Taylor expanded in re around 0 15.7%
unpow215.7%
Applied egg-rr15.7%
(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 54.2%
Taylor expanded in re around 0 25.7%
(FPCore (re im) :precision binary64 0.75)
double code(double re, double im) {
return 0.75;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.75d0
end function
public static double code(double re, double im) {
return 0.75;
}
def code(re, im): return 0.75
function code(re, im) return 0.75 end
function tmp = code(re, im) tmp = 0.75; end
code[re_, im_] := 0.75
\begin{array}{l}
\\
0.75
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 60.5%
Applied egg-rr8.9%
metadata-eval8.9%
Applied egg-rr8.9%
(FPCore (re im) :precision binary64 0.125)
double code(double re, double im) {
return 0.125;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.125d0
end function
public static double code(double re, double im) {
return 0.125;
}
def code(re, im): return 0.125
function code(re, im) return 0.125 end
function tmp = code(re, im) tmp = 0.125; end
code[re_, im_] := 0.125
\begin{array}{l}
\\
0.125
\end{array}
Initial program 100.0%
Taylor expanded in re around 0 60.5%
Applied egg-rr7.5%
metadata-eval7.5%
Applied egg-rr7.5%
herbie shell --seed 2024137
(FPCore (re im)
:name "math.cos on complex, real part"
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im))))