
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 2e-6)))
(* (* 0.5 (sin re)) t_0)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 2e-6)) {
tmp = (0.5 * sin(re)) * t_0;
} else {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 2e-6)) {
tmp = (0.5 * Math.sin(re)) * t_0;
} else {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 2e-6): tmp = (0.5 * math.sin(re)) * t_0 else: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 2e-6)) tmp = Float64(Float64(0.5 * sin(re)) * t_0); else tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 2e-6))) tmp = (0.5 * sin(re)) * t_0; else tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 2e-6]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -inf.0 or 1.99999999999999991e-6 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 99.9%
if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1.99999999999999991e-6Initial program 31.0%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
(if (<= t_0 (- INFINITY))
t_0
(*
(sin re)
(+
(- (* (pow im 5.0) -0.008333333333333333) im)
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 3.0) -0.16666666666666666)))))))
double code(double re, double im) {
double t_0 = (0.5 * sin(re)) * (exp(-im) - exp(im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_0;
} else {
tmp = sin(re) * (((pow(im, 5.0) * -0.008333333333333333) - im) + ((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 3.0) * -0.16666666666666666)));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = Math.sin(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) - im) + ((Math.pow(im, 7.0) * -0.0001984126984126984) + (Math.pow(im, 3.0) * -0.16666666666666666)));
}
return tmp;
}
def code(re, im): t_0 = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im)) tmp = 0 if t_0 <= -math.inf: tmp = t_0 else: tmp = math.sin(re) * (((math.pow(im, 5.0) * -0.008333333333333333) - im) + ((math.pow(im, 7.0) * -0.0001984126984126984) + (math.pow(im, 3.0) * -0.16666666666666666))) return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_0; else tmp = Float64(sin(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im) + Float64(Float64((im ^ 7.0) * -0.0001984126984126984) + Float64((im ^ 3.0) * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * sin(re)) * (exp(-im) - exp(im)); tmp = 0.0; if (t_0 <= -Inf) tmp = t_0; else tmp = sin(re) * ((((im ^ 5.0) * -0.008333333333333333) - im) + (((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 3.0) * -0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$0, N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision] + N[(N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + {im}^{3} \cdot -0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 1/2 (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -inf.0Initial program 100.0%
if -inf.0 < (*.f64 (*.f64 1/2 (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) Initial program 53.9%
Taylor expanded in im around 0 98.3%
associate-+r+98.3%
+-commutative98.3%
+-commutative98.3%
mul-1-neg98.3%
*-commutative98.3%
distribute-lft-neg-in98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt-out98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
associate-*r*98.3%
Simplified98.3%
Final simplification98.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (<= t_0 0.01)
(*
(sin re)
(+
(* (pow im 5.0) -0.008333333333333333)
(- (* (pow im 3.0) -0.16666666666666666) im)))
(* (* 0.5 (sin re)) t_0))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if (t_0 <= 0.01) {
tmp = sin(re) * ((pow(im, 5.0) * -0.008333333333333333) + ((pow(im, 3.0) * -0.16666666666666666) - im));
} else {
tmp = (0.5 * sin(re)) * 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 = exp(-im) - exp(im)
if (t_0 <= 0.01d0) then
tmp = sin(re) * (((im ** 5.0d0) * (-0.008333333333333333d0)) + (((im ** 3.0d0) * (-0.16666666666666666d0)) - im))
else
tmp = (0.5d0 * sin(re)) * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if (t_0 <= 0.01) {
tmp = Math.sin(re) * ((Math.pow(im, 5.0) * -0.008333333333333333) + ((Math.pow(im, 3.0) * -0.16666666666666666) - im));
} else {
tmp = (0.5 * Math.sin(re)) * t_0;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if t_0 <= 0.01: tmp = math.sin(re) * ((math.pow(im, 5.0) * -0.008333333333333333) + ((math.pow(im, 3.0) * -0.16666666666666666) - im)) else: tmp = (0.5 * math.sin(re)) * t_0 return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if (t_0 <= 0.01) tmp = Float64(sin(re) * Float64(Float64((im ^ 5.0) * -0.008333333333333333) + Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im))); else tmp = Float64(Float64(0.5 * sin(re)) * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if (t_0 <= 0.01) tmp = sin(re) * (((im ^ 5.0) * -0.008333333333333333) + (((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = (0.5 * sin(re)) * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.01], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq 0.01:\\
\;\;\;\;\sin re \cdot \left({im}^{5} \cdot -0.008333333333333333 + \left({im}^{3} \cdot -0.16666666666666666 - im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot t_0\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 0.0100000000000000002Initial program 53.4%
Taylor expanded in im around 0 97.8%
+-commutative97.8%
associate-+r+97.8%
+-commutative97.8%
mul-1-neg97.8%
*-commutative97.8%
distribute-lft-neg-in97.8%
*-commutative97.8%
associate-*r*97.8%
distribute-rgt-out97.8%
associate-*r*97.8%
*-commutative97.8%
associate-*l*97.8%
distribute-lft-out97.8%
Simplified97.8%
if 0.0100000000000000002 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 99.9%
Final simplification98.4%
(FPCore (re im) :precision binary64 (if (or (<= im -1.3e+36) (not (<= im 29000000000.0))) (* -0.0001984126984126984 (* (sin re) (pow im 7.0))) (log1p (expm1 (* (sin re) (- im))))))
double code(double re, double im) {
double tmp;
if ((im <= -1.3e+36) || !(im <= 29000000000.0)) {
tmp = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
} else {
tmp = log1p(expm1((sin(re) * -im)));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if ((im <= -1.3e+36) || !(im <= 29000000000.0)) {
tmp = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
} else {
tmp = Math.log1p(Math.expm1((Math.sin(re) * -im)));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.3e+36) or not (im <= 29000000000.0): tmp = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) else: tmp = math.log1p(math.expm1((math.sin(re) * -im))) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.3e+36) || !(im <= 29000000000.0)) tmp = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))); else tmp = log1p(expm1(Float64(sin(re) * Float64(-im)))); end return tmp end
code[re_, im_] := If[Or[LessEqual[im, -1.3e+36], N[Not[LessEqual[im, 29000000000.0]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.3 \cdot 10^{+36} \lor \neg \left(im \leq 29000000000\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\sin re \cdot \left(-im\right)\right)\right)\\
\end{array}
\end{array}
if im < -1.3000000000000001e36 or 2.9e10 < im Initial program 100.0%
Taylor expanded in im around 0 97.6%
associate-+r+97.6%
+-commutative97.6%
+-commutative97.6%
mul-1-neg97.6%
*-commutative97.6%
distribute-lft-neg-in97.6%
*-commutative97.6%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
associate-*r*97.6%
*-commutative97.6%
associate-*r*97.6%
Simplified97.6%
Taylor expanded in im around inf 97.6%
*-commutative97.6%
Simplified97.6%
if -1.3000000000000001e36 < im < 2.9e10Initial program 37.0%
Taylor expanded in im around 0 91.8%
mul-1-neg91.8%
*-commutative91.8%
distribute-rgt-neg-in91.8%
Simplified91.8%
log1p-expm1-u96.1%
Applied egg-rr96.1%
Final simplification96.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -1.1e+44)
t_0
(if (<= im -0.0027)
(* 0.5 (* re (- (exp (- im)) (exp im))))
(if (<= im 5.6)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
t_0)))))
double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_0;
} else if (im <= -0.0027) {
tmp = 0.5 * (re * (exp(-im) - exp(im)));
} else if (im <= 5.6) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
if (im <= (-1.1d+44)) then
tmp = t_0
else if (im <= (-0.0027d0)) then
tmp = 0.5d0 * (re * (exp(-im) - exp(im)))
else if (im <= 5.6d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_0;
} else if (im <= -0.0027) {
tmp = 0.5 * (re * (Math.exp(-im) - Math.exp(im)));
} else if (im <= 5.6) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.1e+44: tmp = t_0 elif im <= -0.0027: tmp = 0.5 * (re * (math.exp(-im) - math.exp(im))) elif im <= 5.6: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.1e+44) tmp = t_0; elseif (im <= -0.0027) tmp = Float64(0.5 * Float64(re * Float64(exp(Float64(-im)) - exp(im)))); elseif (im <= 5.6) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.1e+44) tmp = t_0; elseif (im <= -0.0027) tmp = 0.5 * (re * (exp(-im) - exp(im))); elseif (im <= 5.6) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.1e+44], t$95$0, If[LessEqual[im, -0.0027], N[(0.5 * N[(re * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.0027:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(e^{-im} - e^{im}\right)\right)\\
\mathbf{elif}\;im \leq 5.6:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.09999999999999998e44 or 5.5999999999999996 < im Initial program 100.0%
Taylor expanded in im around 0 97.6%
associate-+r+97.6%
+-commutative97.6%
+-commutative97.6%
mul-1-neg97.6%
*-commutative97.6%
distribute-lft-neg-in97.6%
*-commutative97.6%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
associate-*r*97.6%
*-commutative97.6%
associate-*r*97.6%
Simplified97.6%
Taylor expanded in im around inf 97.6%
*-commutative97.6%
Simplified97.6%
if -1.09999999999999998e44 < im < -0.0027000000000000001Initial program 98.9%
Taylor expanded in re around 0 65.6%
if -0.0027000000000000001 < im < 5.5999999999999996Initial program 31.0%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification97.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -1.1e+44)
t_0
(if (<= im -0.0025)
(* 0.5 (* re (- (exp (- im)) (exp im))))
(if (<= im 4.2) (* (sin re) (- im)) t_0)))))
double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_0;
} else if (im <= -0.0025) {
tmp = 0.5 * (re * (exp(-im) - exp(im)));
} else if (im <= 4.2) {
tmp = sin(re) * -im;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
if (im <= (-1.1d+44)) then
tmp = t_0
else if (im <= (-0.0025d0)) then
tmp = 0.5d0 * (re * (exp(-im) - exp(im)))
else if (im <= 4.2d0) then
tmp = sin(re) * -im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_0;
} else if (im <= -0.0025) {
tmp = 0.5 * (re * (Math.exp(-im) - Math.exp(im)));
} else if (im <= 4.2) {
tmp = Math.sin(re) * -im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.1e+44: tmp = t_0 elif im <= -0.0025: tmp = 0.5 * (re * (math.exp(-im) - math.exp(im))) elif im <= 4.2: tmp = math.sin(re) * -im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.1e+44) tmp = t_0; elseif (im <= -0.0025) tmp = Float64(0.5 * Float64(re * Float64(exp(Float64(-im)) - exp(im)))); elseif (im <= 4.2) tmp = Float64(sin(re) * Float64(-im)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.1e+44) tmp = t_0; elseif (im <= -0.0025) tmp = 0.5 * (re * (exp(-im) - exp(im))); elseif (im <= 4.2) tmp = sin(re) * -im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.1e+44], t$95$0, If[LessEqual[im, -0.0025], N[(0.5 * N[(re * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.2], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.0025:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(e^{-im} - e^{im}\right)\right)\\
\mathbf{elif}\;im \leq 4.2:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.09999999999999998e44 or 4.20000000000000018 < im Initial program 100.0%
Taylor expanded in im around 0 97.6%
associate-+r+97.6%
+-commutative97.6%
+-commutative97.6%
mul-1-neg97.6%
*-commutative97.6%
distribute-lft-neg-in97.6%
*-commutative97.6%
associate-*r*97.6%
distribute-rgt-out97.6%
*-commutative97.6%
associate-*r*97.6%
*-commutative97.6%
associate-*r*97.6%
Simplified97.6%
Taylor expanded in im around inf 97.6%
*-commutative97.6%
Simplified97.6%
if -1.09999999999999998e44 < im < -0.00250000000000000005Initial program 98.9%
Taylor expanded in re around 0 65.6%
if -0.00250000000000000005 < im < 4.20000000000000018Initial program 31.0%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Final simplification97.1%
(FPCore (re im) :precision binary64 (if (or (<= im -4.1) (not (<= im 4.2))) (* -0.0001984126984126984 (* (sin re) (pow im 7.0))) (* (sin re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -4.1) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
} else {
tmp = sin(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.1d0)) .or. (.not. (im <= 4.2d0))) then
tmp = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
else
tmp = sin(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -4.1) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
} else {
tmp = Math.sin(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -4.1) or not (im <= 4.2): tmp = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) else: tmp = math.sin(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -4.1) || !(im <= 4.2)) tmp = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))); else tmp = Float64(sin(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -4.1) || ~((im <= 4.2))) tmp = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); else tmp = sin(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.1], N[Not[LessEqual[im, 4.2]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.1 \lor \neg \left(im \leq 4.2\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -4.0999999999999996 or 4.20000000000000018 < im Initial program 100.0%
Taylor expanded in im around 0 90.3%
associate-+r+90.3%
+-commutative90.3%
+-commutative90.3%
mul-1-neg90.3%
*-commutative90.3%
distribute-lft-neg-in90.3%
*-commutative90.3%
associate-*r*90.3%
distribute-rgt-out90.3%
*-commutative90.3%
associate-*r*90.3%
*-commutative90.3%
associate-*r*90.3%
Simplified90.3%
Taylor expanded in im around inf 90.3%
*-commutative90.3%
Simplified90.3%
if -4.0999999999999996 < im < 4.20000000000000018Initial program 32.0%
Taylor expanded in im around 0 98.8%
mul-1-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Final simplification94.5%
(FPCore (re im) :precision binary64 (if (or (<= im -1.2e+21) (not (<= im 1.85e+56))) (* -0.0001984126984126984 (* re (pow im 7.0))) (* (sin re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -1.2e+21) || !(im <= 1.85e+56)) {
tmp = -0.0001984126984126984 * (re * pow(im, 7.0));
} else {
tmp = sin(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.2d+21)) .or. (.not. (im <= 1.85d+56))) then
tmp = (-0.0001984126984126984d0) * (re * (im ** 7.0d0))
else
tmp = sin(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.2e+21) || !(im <= 1.85e+56)) {
tmp = -0.0001984126984126984 * (re * Math.pow(im, 7.0));
} else {
tmp = Math.sin(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.2e+21) or not (im <= 1.85e+56): tmp = -0.0001984126984126984 * (re * math.pow(im, 7.0)) else: tmp = math.sin(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.2e+21) || !(im <= 1.85e+56)) tmp = Float64(-0.0001984126984126984 * Float64(re * (im ^ 7.0))); else tmp = Float64(sin(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.2e+21) || ~((im <= 1.85e+56))) tmp = -0.0001984126984126984 * (re * (im ^ 7.0)); else tmp = sin(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.2e+21], N[Not[LessEqual[im, 1.85e+56]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(re * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.2 \cdot 10^{+21} \lor \neg \left(im \leq 1.85 \cdot 10^{+56}\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -1.2e21 or 1.84999999999999998e56 < im Initial program 100.0%
Taylor expanded in im around 0 96.8%
associate-+r+96.8%
+-commutative96.8%
+-commutative96.8%
mul-1-neg96.8%
*-commutative96.8%
distribute-lft-neg-in96.8%
*-commutative96.8%
associate-*r*96.8%
distribute-rgt-out96.8%
*-commutative96.8%
associate-*r*96.8%
*-commutative96.8%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in re around 0 69.2%
Taylor expanded in im around inf 69.2%
if -1.2e21 < im < 1.84999999999999998e56Initial program 37.0%
Taylor expanded in im around 0 91.8%
mul-1-neg91.8%
*-commutative91.8%
distribute-rgt-neg-in91.8%
Simplified91.8%
Final simplification81.2%
(FPCore (re im) :precision binary64 (if (or (<= im -5.5e+27) (not (<= im 8e+68))) (* re (- im)) (* (sin re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -5.5e+27) || !(im <= 8e+68)) {
tmp = re * -im;
} else {
tmp = sin(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 <= (-5.5d+27)) .or. (.not. (im <= 8d+68))) then
tmp = re * -im
else
tmp = sin(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -5.5e+27) || !(im <= 8e+68)) {
tmp = re * -im;
} else {
tmp = Math.sin(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -5.5e+27) or not (im <= 8e+68): tmp = re * -im else: tmp = math.sin(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -5.5e+27) || !(im <= 8e+68)) tmp = Float64(re * Float64(-im)); else tmp = Float64(sin(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -5.5e+27) || ~((im <= 8e+68))) tmp = re * -im; else tmp = sin(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -5.5e+27], N[Not[LessEqual[im, 8e+68]], $MachinePrecision]], N[(re * (-im)), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.5 \cdot 10^{+27} \lor \neg \left(im \leq 8 \cdot 10^{+68}\right):\\
\;\;\;\;re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -5.49999999999999966e27 or 7.99999999999999962e68 < im Initial program 100.0%
Taylor expanded in im around 0 4.9%
mul-1-neg4.9%
*-commutative4.9%
distribute-rgt-neg-in4.9%
Simplified4.9%
Taylor expanded in re around 0 16.6%
mul-1-neg16.6%
*-commutative16.6%
distribute-rgt-neg-in16.6%
Simplified16.6%
if -5.49999999999999966e27 < im < 7.99999999999999962e68Initial program 39.2%
Taylor expanded in im around 0 88.6%
mul-1-neg88.6%
*-commutative88.6%
distribute-rgt-neg-in88.6%
Simplified88.6%
Final simplification56.3%
(FPCore (re im) :precision binary64 (if (<= im -3.45e+37) (sqrt (* re (* re 9.5367431640625e-7))) (if (<= im 7.6e+69) (* (sin re) (- im)) (* re (- im)))))
double code(double re, double im) {
double tmp;
if (im <= -3.45e+37) {
tmp = sqrt((re * (re * 9.5367431640625e-7)));
} else if (im <= 7.6e+69) {
tmp = sin(re) * -im;
} else {
tmp = 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 <= (-3.45d+37)) then
tmp = sqrt((re * (re * 9.5367431640625d-7)))
else if (im <= 7.6d+69) then
tmp = sin(re) * -im
else
tmp = re * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -3.45e+37) {
tmp = Math.sqrt((re * (re * 9.5367431640625e-7)));
} else if (im <= 7.6e+69) {
tmp = Math.sin(re) * -im;
} else {
tmp = re * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -3.45e+37: tmp = math.sqrt((re * (re * 9.5367431640625e-7))) elif im <= 7.6e+69: tmp = math.sin(re) * -im else: tmp = re * -im return tmp
function code(re, im) tmp = 0.0 if (im <= -3.45e+37) tmp = sqrt(Float64(re * Float64(re * 9.5367431640625e-7))); elseif (im <= 7.6e+69) tmp = Float64(sin(re) * Float64(-im)); else tmp = Float64(re * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -3.45e+37) tmp = sqrt((re * (re * 9.5367431640625e-7))); elseif (im <= 7.6e+69) tmp = sin(re) * -im; else tmp = re * -im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -3.45e+37], N[Sqrt[N[(re * N[(re * 9.5367431640625e-7), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 7.6e+69], N[(N[Sin[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(re * (-im)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.45 \cdot 10^{+37}:\\
\;\;\;\;\sqrt{re \cdot \left(re \cdot 9.5367431640625 \cdot 10^{-7}\right)}\\
\mathbf{elif}\;im \leq 7.6 \cdot 10^{+69}:\\
\;\;\;\;\sin re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -3.4499999999999998e37Initial program 100.0%
Taylor expanded in re around 0 73.8%
Applied egg-rr2.4%
log1p-expm1-u24.2%
associate-*r*24.2%
metadata-eval24.2%
Applied egg-rr24.2%
log1p-expm1-u2.4%
add-sqr-sqrt1.3%
sqrt-unprod14.4%
swap-sqr14.4%
metadata-eval14.4%
Applied egg-rr14.4%
associate-*r*14.4%
Simplified14.4%
if -3.4499999999999998e37 < im < 7.60000000000000055e69Initial program 40.5%
Taylor expanded in im around 0 86.8%
mul-1-neg86.8%
*-commutative86.8%
distribute-rgt-neg-in86.8%
Simplified86.8%
if 7.60000000000000055e69 < im Initial program 100.0%
Taylor expanded in im around 0 5.5%
mul-1-neg5.5%
*-commutative5.5%
distribute-rgt-neg-in5.5%
Simplified5.5%
Taylor expanded in re around 0 23.8%
mul-1-neg23.8%
*-commutative23.8%
distribute-rgt-neg-in23.8%
Simplified23.8%
Final simplification57.0%
(FPCore (re im) :precision binary64 (* re (- im)))
double code(double re, double im) {
return re * -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * -im
end function
public static double code(double re, double im) {
return re * -im;
}
def code(re, im): return re * -im
function code(re, im) return Float64(re * Float64(-im)) end
function tmp = code(re, im) tmp = re * -im; end
code[re_, im_] := N[(re * (-im)), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(-im\right)
\end{array}
Initial program 66.5%
Taylor expanded in im around 0 51.0%
mul-1-neg51.0%
*-commutative51.0%
distribute-rgt-neg-in51.0%
Simplified51.0%
Taylor expanded in re around 0 34.4%
mul-1-neg34.4%
*-commutative34.4%
distribute-rgt-neg-in34.4%
Simplified34.4%
Final simplification34.4%
(FPCore (re im) :precision binary64 (* re 0.0009765625))
double code(double re, double im) {
return re * 0.0009765625;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * 0.0009765625d0
end function
public static double code(double re, double im) {
return re * 0.0009765625;
}
def code(re, im): return re * 0.0009765625
function code(re, im) return Float64(re * 0.0009765625) end
function tmp = code(re, im) tmp = re * 0.0009765625; end
code[re_, im_] := N[(re * 0.0009765625), $MachinePrecision]
\begin{array}{l}
\\
re \cdot 0.0009765625
\end{array}
Initial program 66.5%
Taylor expanded in re around 0 51.2%
Applied egg-rr3.5%
Taylor expanded in re around 0 3.5%
*-commutative3.5%
Simplified3.5%
Final simplification3.5%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(sin re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (abs(im) < 1.0d0) then
tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.abs(im) < 1.0) {
tmp = -(Math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(sin(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im)))); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023192
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (sin re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))