
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - 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((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - 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 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - 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((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -100.0) (not (<= t_0 0.02)))
(* (* 0.5 (cos re)) t_0)
(-
(*
(cos re)
(+
(* (pow im 3.0) -0.16666666666666666)
(* (pow im 5.0) -0.008333333333333333)))
(* im (cos re))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -100.0) || !(t_0 <= 0.02)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = (cos(re) * ((pow(im, 3.0) * -0.16666666666666666) + (pow(im, 5.0) * -0.008333333333333333))) - (im * cos(re));
}
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 <= (-100.0d0)) .or. (.not. (t_0 <= 0.02d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = (cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) + ((im ** 5.0d0) * (-0.008333333333333333d0)))) - (im * cos(re))
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 <= -100.0) || !(t_0 <= 0.02)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = (Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) + (Math.pow(im, 5.0) * -0.008333333333333333))) - (im * Math.cos(re));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -100.0) or not (t_0 <= 0.02): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = (math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) + (math.pow(im, 5.0) * -0.008333333333333333))) - (im * math.cos(re)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -100.0) || !(t_0 <= 0.02)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64((im ^ 5.0) * -0.008333333333333333))) - Float64(im * cos(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -100.0) || ~((t_0 <= 0.02))) tmp = (0.5 * cos(re)) * t_0; else tmp = (cos(re) * (((im ^ 3.0) * -0.16666666666666666) + ((im ^ 5.0) * -0.008333333333333333))) - (im * cos(re)); 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, -100.0], N[Not[LessEqual[t$95$0, 0.02]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(im * N[Cos[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -100 \lor \neg \left(t_0 \leq 0.02\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 + {im}^{5} \cdot -0.008333333333333333\right) - im \cdot \cos re\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -100 or 0.0200000000000000004 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -100 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.0200000000000000004Initial program 9.2%
neg-sub09.2%
Simplified9.2%
Taylor expanded in im around 0 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))) (t_1 (* 0.5 (cos re))))
(if (or (<= t_0 -100.0) (not (<= t_0 0.02)))
(* t_1 t_0)
(*
t_1
(+
(* im -2.0)
(+
(* (pow im 3.0) -0.3333333333333333)
(* (pow im 5.0) -0.016666666666666666)))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = 0.5 * cos(re);
double tmp;
if ((t_0 <= -100.0) || !(t_0 <= 0.02)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((pow(im, 3.0) * -0.3333333333333333) + (pow(im, 5.0) * -0.016666666666666666)));
}
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) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = 0.5d0 * cos(re)
if ((t_0 <= (-100.0d0)) .or. (.not. (t_0 <= 0.02d0))) then
tmp = t_1 * t_0
else
tmp = t_1 * ((im * (-2.0d0)) + (((im ** 3.0d0) * (-0.3333333333333333d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0))))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = 0.5 * Math.cos(re);
double tmp;
if ((t_0 <= -100.0) || !(t_0 <= 0.02)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((Math.pow(im, 3.0) * -0.3333333333333333) + (Math.pow(im, 5.0) * -0.016666666666666666)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = 0.5 * math.cos(re) tmp = 0 if (t_0 <= -100.0) or not (t_0 <= 0.02): tmp = t_1 * t_0 else: tmp = t_1 * ((im * -2.0) + ((math.pow(im, 3.0) * -0.3333333333333333) + (math.pow(im, 5.0) * -0.016666666666666666))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(0.5 * cos(re)) tmp = 0.0 if ((t_0 <= -100.0) || !(t_0 <= 0.02)) tmp = Float64(t_1 * t_0); else tmp = Float64(t_1 * Float64(Float64(im * -2.0) + Float64(Float64((im ^ 3.0) * -0.3333333333333333) + Float64((im ^ 5.0) * -0.016666666666666666)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = 0.5 * cos(re); tmp = 0.0; if ((t_0 <= -100.0) || ~((t_0 <= 0.02))) tmp = t_1 * t_0; else tmp = t_1 * ((im * -2.0) + (((im ^ 3.0) * -0.3333333333333333) + ((im ^ 5.0) * -0.016666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -100.0], N[Not[LessEqual[t$95$0, 0.02]], $MachinePrecision]], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$1 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := 0.5 \cdot \cos re\\
\mathbf{if}\;t_0 \leq -100 \lor \neg \left(t_0 \leq 0.02\right):\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(im \cdot -2 + \left({im}^{3} \cdot -0.3333333333333333 + {im}^{5} \cdot -0.016666666666666666\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -100 or 0.0200000000000000004 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -100 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.0200000000000000004Initial program 9.2%
neg-sub09.2%
Simplified9.2%
Taylor expanded in im around 0 99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -100.0) (not (<= t_0 0.0001)))
(* (* 0.5 (cos re)) t_0)
(* (cos 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 <= -100.0) || !(t_0 <= 0.0001)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - 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 = exp(-im) - exp(im)
if ((t_0 <= (-100.0d0)) .or. (.not. (t_0 <= 0.0001d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
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 <= -100.0) || !(t_0 <= 0.0001)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(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 <= -100.0) or not (t_0 <= 0.0001): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(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 <= -100.0) || !(t_0 <= 0.0001)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(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 <= -100.0) || ~((t_0 <= 0.0001))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(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, -100.0], N[Not[LessEqual[t$95$0, 0.0001]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[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 -100 \lor \neg \left(t_0 \leq 0.0001\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -100 or 1.00000000000000005e-4 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
neg-sub099.9%
Simplified99.9%
if -100 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 1.00000000000000005e-4Initial program 7.9%
neg-sub07.9%
Simplified7.9%
Taylor expanded in im around 0 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
associate-*r*99.9%
distribute-rgt-out--99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* (pow im 7.0) -0.0001984126984126984))))
(if (<= im -4.1)
t_0
(if (<= im 5.9e-6)
(* im (- (cos re)))
(if (<= im 1.1e+44) (* 0.5 (- (exp (- im)) (exp im))) t_0)))))
double code(double re, double im) {
double t_0 = cos(re) * (pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -4.1) {
tmp = t_0;
} else if (im <= 5.9e-6) {
tmp = im * -cos(re);
} else if (im <= 1.1e+44) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * ((im ** 7.0d0) * (-0.0001984126984126984d0))
if (im <= (-4.1d0)) then
tmp = t_0
else if (im <= 5.9d-6) then
tmp = im * -cos(re)
else if (im <= 1.1d+44) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (Math.pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -4.1) {
tmp = t_0;
} else if (im <= 5.9e-6) {
tmp = im * -Math.cos(re);
} else if (im <= 1.1e+44) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (math.pow(im, 7.0) * -0.0001984126984126984) tmp = 0 if im <= -4.1: tmp = t_0 elif im <= 5.9e-6: tmp = im * -math.cos(re) elif im <= 1.1e+44: tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64((im ^ 7.0) * -0.0001984126984126984)) tmp = 0.0 if (im <= -4.1) tmp = t_0; elseif (im <= 5.9e-6) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.1e+44) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * ((im ^ 7.0) * -0.0001984126984126984); tmp = 0.0; if (im <= -4.1) tmp = t_0; elseif (im <= 5.9e-6) tmp = im * -cos(re); elseif (im <= 1.1e+44) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.1], t$95$0, If[LessEqual[im, 5.9e-6], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left({im}^{7} \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -4.1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 5.9 \cdot 10^{-6}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.0999999999999996 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 95.2%
Taylor expanded in im around inf 95.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*95.2%
Simplified95.2%
if -4.0999999999999996 < im < 5.90000000000000026e-6Initial program 8.7%
neg-sub08.7%
Simplified8.7%
Taylor expanded in im around 0 98.8%
associate-*r*98.8%
neg-mul-198.8%
Simplified98.8%
if 5.90000000000000026e-6 < im < 1.09999999999999998e44Initial program 97.7%
neg-sub097.7%
Simplified97.7%
Taylor expanded in re around 0 69.3%
Final simplification96.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* (pow im 7.0) -0.0001984126984126984))))
(if (<= im -5.6)
t_0
(if (<= im 4.7)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 5e+40) (* 0.5 (- (exp (- im)) (exp im))) t_0)))))
double code(double re, double im) {
double t_0 = cos(re) * (pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -5.6) {
tmp = t_0;
} else if (im <= 4.7) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 5e+40) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = cos(re) * ((im ** 7.0d0) * (-0.0001984126984126984d0))
if (im <= (-5.6d0)) then
tmp = t_0
else if (im <= 4.7d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 5d+40) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.cos(re) * (Math.pow(im, 7.0) * -0.0001984126984126984);
double tmp;
if (im <= -5.6) {
tmp = t_0;
} else if (im <= 4.7) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 5e+40) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (math.pow(im, 7.0) * -0.0001984126984126984) tmp = 0 if im <= -5.6: tmp = t_0 elif im <= 4.7: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 5e+40: tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64((im ^ 7.0) * -0.0001984126984126984)) tmp = 0.0 if (im <= -5.6) tmp = t_0; elseif (im <= 4.7) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 5e+40) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * ((im ^ 7.0) * -0.0001984126984126984); tmp = 0.0; if (im <= -5.6) tmp = t_0; elseif (im <= 4.7) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 5e+40) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.6], t$95$0, If[LessEqual[im, 4.7], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5e+40], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left({im}^{7} \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -5.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.7:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+40}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.5999999999999996 or 5.00000000000000003e40 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 95.2%
Taylor expanded in im around inf 95.2%
*-commutative95.2%
*-commutative95.2%
associate-*l*95.2%
Simplified95.2%
if -5.5999999999999996 < im < 4.70000000000000018Initial program 9.9%
neg-sub09.9%
Simplified9.9%
Taylor expanded in im around 0 98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
distribute-rgt-out--98.9%
*-commutative98.9%
Simplified98.9%
if 4.70000000000000018 < im < 5.00000000000000003e40Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
Final simplification96.5%
(FPCore (re im) :precision binary64 (if (or (<= im -0.0074) (not (<= im 5.9e-6))) (* 0.5 (- (exp (- im)) (exp im))) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -0.0074) || !(im <= 5.9e-6)) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-0.0074d0)) .or. (.not. (im <= 5.9d-6))) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -0.0074) || !(im <= 5.9e-6)) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -0.0074) or not (im <= 5.9e-6): tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -0.0074) || !(im <= 5.9e-6)) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -0.0074) || ~((im <= 5.9e-6))) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -0.0074], N[Not[LessEqual[im, 5.9e-6]], $MachinePrecision]], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.0074 \lor \neg \left(im \leq 5.9 \cdot 10^{-6}\right):\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -0.0074000000000000003 or 5.90000000000000026e-6 < im Initial program 99.8%
neg-sub099.8%
Simplified99.8%
Taylor expanded in re around 0 79.3%
if -0.0074000000000000003 < im < 5.90000000000000026e-6Initial program 8.0%
neg-sub08.0%
Simplified8.0%
Taylor expanded in im around 0 99.2%
associate-*r*99.2%
neg-mul-199.2%
Simplified99.2%
Final simplification89.4%
(FPCore (re im) :precision binary64 (if (or (<= im -3.3e+42) (not (<= im 7.8e+34))) (* 0.5 (+ (* im -2.0) (* (pow im 5.0) -0.016666666666666666))) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -3.3e+42) || !(im <= 7.8e+34)) {
tmp = 0.5 * ((im * -2.0) + (pow(im, 5.0) * -0.016666666666666666));
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-3.3d+42)) .or. (.not. (im <= 7.8d+34))) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((im ** 5.0d0) * (-0.016666666666666666d0)))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.3e+42) || !(im <= 7.8e+34)) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(im, 5.0) * -0.016666666666666666));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.3e+42) or not (im <= 7.8e+34): tmp = 0.5 * ((im * -2.0) + (math.pow(im, 5.0) * -0.016666666666666666)) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.3e+42) || !(im <= 7.8e+34)) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 5.0) * -0.016666666666666666))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.3e+42) || ~((im <= 7.8e+34))) tmp = 0.5 * ((im * -2.0) + ((im ^ 5.0) * -0.016666666666666666)); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.3e+42], N[Not[LessEqual[im, 7.8e+34]], $MachinePrecision]], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.3 \cdot 10^{+42} \lor \neg \left(im \leq 7.8 \cdot 10^{+34}\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{5} \cdot -0.016666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -3.2999999999999999e42 or 7.80000000000000038e34 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 94.1%
Taylor expanded in re around 0 76.9%
Taylor expanded in im around inf 76.9%
if -3.2999999999999999e42 < im < 7.80000000000000038e34Initial program 17.4%
neg-sub017.4%
Simplified17.4%
Taylor expanded in im around 0 90.2%
associate-*r*90.2%
neg-mul-190.2%
Simplified90.2%
Final simplification84.5%
(FPCore (re im) :precision binary64 (if (or (<= im -5.4e+20) (not (<= im 1.2e+16))) (* 0.5 (+ (* im -2.0) (* (pow im 7.0) -0.0003968253968253968))) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -5.4e+20) || !(im <= 1.2e+16)) {
tmp = 0.5 * ((im * -2.0) + (pow(im, 7.0) * -0.0003968253968253968));
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-5.4d+20)) .or. (.not. (im <= 1.2d+16))) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((im ** 7.0d0) * (-0.0003968253968253968d0)))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -5.4e+20) || !(im <= 1.2e+16)) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(im, 7.0) * -0.0003968253968253968));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -5.4e+20) or not (im <= 1.2e+16): tmp = 0.5 * ((im * -2.0) + (math.pow(im, 7.0) * -0.0003968253968253968)) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -5.4e+20) || !(im <= 1.2e+16)) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 7.0) * -0.0003968253968253968))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -5.4e+20) || ~((im <= 1.2e+16))) tmp = 0.5 * ((im * -2.0) + ((im ^ 7.0) * -0.0003968253968253968)); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -5.4e+20], N[Not[LessEqual[im, 1.2e+16]], $MachinePrecision]], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.4 \cdot 10^{+20} \lor \neg \left(im \leq 1.2 \cdot 10^{+16}\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{7} \cdot -0.0003968253968253968\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -5.4e20 or 1.2e16 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 93.6%
Taylor expanded in re around 0 76.4%
Taylor expanded in im around inf 76.4%
if -5.4e20 < im < 1.2e16Initial program 13.8%
neg-sub013.8%
Simplified13.8%
Taylor expanded in im around 0 94.0%
associate-*r*94.0%
neg-mul-194.0%
Simplified94.0%
Final simplification86.0%
(FPCore (re im) :precision binary64 (if (or (<= im -0.0062) (not (<= im 1.45e-28))) (- (* (pow im 3.0) -0.16666666666666666) im) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -0.0062) || !(im <= 1.45e-28)) {
tmp = (pow(im, 3.0) * -0.16666666666666666) - im;
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-0.0062d0)) .or. (.not. (im <= 1.45d-28))) then
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -0.0062) || !(im <= 1.45e-28)) {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -0.0062) or not (im <= 1.45e-28): tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -0.0062) || !(im <= 1.45e-28)) tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -0.0062) || ~((im <= 1.45e-28))) tmp = ((im ^ 3.0) * -0.16666666666666666) - im; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -0.0062], N[Not[LessEqual[im, 1.45e-28]], $MachinePrecision]], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.0062 \lor \neg \left(im \leq 1.45 \cdot 10^{-28}\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -0.00619999999999999978 or 1.45000000000000006e-28 < im Initial program 97.2%
neg-sub097.2%
Simplified97.2%
Taylor expanded in im around 0 70.2%
+-commutative70.2%
mul-1-neg70.2%
unsub-neg70.2%
associate-*r*70.2%
distribute-rgt-out--70.2%
*-commutative70.2%
Simplified70.2%
Taylor expanded in re around 0 57.5%
*-commutative57.5%
Simplified57.5%
if -0.00619999999999999978 < im < 1.45000000000000006e-28Initial program 7.8%
neg-sub07.8%
Simplified7.8%
Taylor expanded in im around 0 99.2%
associate-*r*99.2%
neg-mul-199.2%
Simplified99.2%
Final simplification78.0%
(FPCore (re im) :precision binary64 (if (<= im -13800.0) (* (pow re 2.0) (* im 0.5)) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if (im <= -13800.0) {
tmp = pow(re, 2.0) * (im * 0.5);
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-13800.0d0)) then
tmp = (re ** 2.0d0) * (im * 0.5d0)
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -13800.0) {
tmp = Math.pow(re, 2.0) * (im * 0.5);
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -13800.0: tmp = math.pow(re, 2.0) * (im * 0.5) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -13800.0) tmp = Float64((re ^ 2.0) * Float64(im * 0.5)); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -13800.0) tmp = (re ^ 2.0) * (im * 0.5); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -13800.0], N[(N[Power[re, 2.0], $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -13800:\\
\;\;\;\;{re}^{2} \cdot \left(im \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -13800Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 5.4%
associate-*r*5.4%
neg-mul-15.4%
Simplified5.4%
Taylor expanded in re around 0 22.0%
mul-1-neg22.0%
+-commutative22.0%
unsub-neg22.0%
Simplified22.0%
Taylor expanded in re around inf 19.7%
*-commutative19.7%
*-commutative19.7%
associate-*l*19.7%
Simplified19.7%
if -13800 < im Initial program 37.9%
neg-sub037.9%
Simplified37.9%
Taylor expanded in im around 0 69.3%
associate-*r*69.3%
neg-mul-169.3%
Simplified69.3%
Final simplification57.1%
(FPCore (re im) :precision binary64 (* im (- (cos re))))
double code(double re, double im) {
return im * -cos(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * -cos(re)
end function
public static double code(double re, double im) {
return im * -Math.cos(re);
}
def code(re, im): return im * -math.cos(re)
function code(re, im) return Float64(im * Float64(-cos(re))) end
function tmp = code(re, im) tmp = im * -cos(re); end
code[re_, im_] := N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
im \cdot \left(-\cos re\right)
\end{array}
Initial program 53.2%
neg-sub053.2%
Simplified53.2%
Taylor expanded in im around 0 53.6%
associate-*r*53.6%
neg-mul-153.6%
Simplified53.6%
Final simplification53.6%
(FPCore (re im) :precision binary64 (- im))
double code(double re, double im) {
return -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -im
end function
public static double code(double re, double im) {
return -im;
}
def code(re, im): return -im
function code(re, im) return Float64(-im) end
function tmp = code(re, im) tmp = -im; end
code[re_, im_] := (-im)
\begin{array}{l}
\\
-im
\end{array}
Initial program 53.2%
neg-sub053.2%
Simplified53.2%
Taylor expanded in im around 0 53.6%
associate-*r*53.6%
neg-mul-153.6%
Simplified53.6%
Taylor expanded in re around 0 36.0%
mul-1-neg36.0%
Simplified36.0%
Final simplification36.0%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(cos re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * cos(re)) * (exp((0.0 - 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 = -(cos(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * cos(re)) * (exp((0.0d0 - 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.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(cos(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 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Cos[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[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\cos 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 \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023333
(FPCore (re im)
:name "math.sin on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (cos re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))