
(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 9 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 (* 0.5 (log1p (expm1 (* im (* -2.0 (cos re)))))))
double code(double re, double im) {
return 0.5 * log1p(expm1((im * (-2.0 * cos(re)))));
}
public static double code(double re, double im) {
return 0.5 * Math.log1p(Math.expm1((im * (-2.0 * Math.cos(re)))));
}
def code(re, im): return 0.5 * math.log1p(math.expm1((im * (-2.0 * math.cos(re)))))
function code(re, im) return Float64(0.5 * log1p(expm1(Float64(im * Float64(-2.0 * cos(re)))))) end
code[re_, im_] := N[(0.5 * N[Log[1 + N[(Exp[N[(im * N[(-2.0 * N[Cos[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(-2 \cdot \cos re\right)\right)\right)
\end{array}
Initial program 56.6%
/-rgt-identity56.6%
exp-056.6%
associate-*l/56.6%
cos-neg56.6%
associate-*l*56.6%
associate-*r/56.6%
exp-056.6%
/-rgt-identity56.6%
*-commutative56.6%
neg-sub056.6%
cos-neg56.6%
Simplified56.6%
Taylor expanded in im around 0 49.9%
log1p-expm1-u98.7%
*-commutative98.7%
associate-*l*98.7%
Applied egg-rr98.7%
Final simplification98.7%
(FPCore (re im)
:precision binary64
(if (<= im 450000000.0)
(*
0.5
(* (cos re) (+ (* im (* (pow im 2.0) -0.3333333333333333)) (* im -2.0))))
(if (<= im 2.9e+60)
(*
0.5
(+
(* im -2.0)
(* (pow re 2.0) (+ im (* -0.08333333333333333 (* im (pow re 2.0)))))))
(* 0.5 (* -0.016666666666666666 (* (cos re) (pow im 5.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 450000000.0) {
tmp = 0.5 * (cos(re) * ((im * (pow(im, 2.0) * -0.3333333333333333)) + (im * -2.0)));
} else if (im <= 2.9e+60) {
tmp = 0.5 * ((im * -2.0) + (pow(re, 2.0) * (im + (-0.08333333333333333 * (im * pow(re, 2.0))))));
} else {
tmp = 0.5 * (-0.016666666666666666 * (cos(re) * pow(im, 5.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 450000000.0d0) then
tmp = 0.5d0 * (cos(re) * ((im * ((im ** 2.0d0) * (-0.3333333333333333d0))) + (im * (-2.0d0))))
else if (im <= 2.9d+60) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((re ** 2.0d0) * (im + ((-0.08333333333333333d0) * (im * (re ** 2.0d0))))))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (cos(re) * (im ** 5.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 450000000.0) {
tmp = 0.5 * (Math.cos(re) * ((im * (Math.pow(im, 2.0) * -0.3333333333333333)) + (im * -2.0)));
} else if (im <= 2.9e+60) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(re, 2.0) * (im + (-0.08333333333333333 * (im * Math.pow(re, 2.0))))));
} else {
tmp = 0.5 * (-0.016666666666666666 * (Math.cos(re) * Math.pow(im, 5.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 450000000.0: tmp = 0.5 * (math.cos(re) * ((im * (math.pow(im, 2.0) * -0.3333333333333333)) + (im * -2.0))) elif im <= 2.9e+60: tmp = 0.5 * ((im * -2.0) + (math.pow(re, 2.0) * (im + (-0.08333333333333333 * (im * math.pow(re, 2.0)))))) else: tmp = 0.5 * (-0.016666666666666666 * (math.cos(re) * math.pow(im, 5.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 450000000.0) tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(im * Float64((im ^ 2.0) * -0.3333333333333333)) + Float64(im * -2.0)))); elseif (im <= 2.9e+60) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((re ^ 2.0) * Float64(im + Float64(-0.08333333333333333 * Float64(im * (re ^ 2.0))))))); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * Float64(cos(re) * (im ^ 5.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 450000000.0) tmp = 0.5 * (cos(re) * ((im * ((im ^ 2.0) * -0.3333333333333333)) + (im * -2.0))); elseif (im <= 2.9e+60) tmp = 0.5 * ((im * -2.0) + ((re ^ 2.0) * (im + (-0.08333333333333333 * (im * (re ^ 2.0)))))); else tmp = 0.5 * (-0.016666666666666666 * (cos(re) * (im ^ 5.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 450000000.0], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(im * N[(N[Power[im, 2.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.9e+60], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[re, 2.0], $MachinePrecision] * N[(im + N[(-0.08333333333333333 * N[(im * N[Power[re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 450000000:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(im \cdot \left({im}^{2} \cdot -0.3333333333333333\right) + im \cdot -2\right)\right)\\
\mathbf{elif}\;im \leq 2.9 \cdot 10^{+60}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {re}^{2} \cdot \left(im + -0.08333333333333333 \cdot \left(im \cdot {re}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(\cos re \cdot {im}^{5}\right)\right)\\
\end{array}
\end{array}
if im < 4.5e8Initial program 42.1%
/-rgt-identity42.1%
exp-042.1%
associate-*l/42.1%
cos-neg42.1%
associate-*l*42.1%
associate-*r/42.1%
exp-042.1%
/-rgt-identity42.1%
*-commutative42.1%
neg-sub042.1%
cos-neg42.1%
Simplified42.1%
Taylor expanded in im around 0 88.4%
sub-neg88.4%
metadata-eval88.4%
distribute-rgt-in88.5%
*-commutative88.5%
*-commutative88.5%
Applied egg-rr88.5%
if 4.5e8 < im < 2.9e60Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
Taylor expanded in re around 0 31.4%
if 2.9e60 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
distribute-lft-in100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-undefine100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification88.7%
(FPCore (re im)
:precision binary64
(if (<= im 450000000.0)
(*
0.5
(* (cos re) (+ (* im (* (pow im 2.0) -0.3333333333333333)) (* im -2.0))))
(if (<= im 2.85e+60)
(* 0.5 (+ (* im -2.0) (* (pow re 4.0) (* im -0.08333333333333333))))
(* 0.5 (* -0.016666666666666666 (* (cos re) (pow im 5.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 450000000.0) {
tmp = 0.5 * (cos(re) * ((im * (pow(im, 2.0) * -0.3333333333333333)) + (im * -2.0)));
} else if (im <= 2.85e+60) {
tmp = 0.5 * ((im * -2.0) + (pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * (cos(re) * pow(im, 5.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 450000000.0d0) then
tmp = 0.5d0 * (cos(re) * ((im * ((im ** 2.0d0) * (-0.3333333333333333d0))) + (im * (-2.0d0))))
else if (im <= 2.85d+60) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((re ** 4.0d0) * (im * (-0.08333333333333333d0))))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (cos(re) * (im ** 5.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 450000000.0) {
tmp = 0.5 * (Math.cos(re) * ((im * (Math.pow(im, 2.0) * -0.3333333333333333)) + (im * -2.0)));
} else if (im <= 2.85e+60) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * (Math.cos(re) * Math.pow(im, 5.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 450000000.0: tmp = 0.5 * (math.cos(re) * ((im * (math.pow(im, 2.0) * -0.3333333333333333)) + (im * -2.0))) elif im <= 2.85e+60: tmp = 0.5 * ((im * -2.0) + (math.pow(re, 4.0) * (im * -0.08333333333333333))) else: tmp = 0.5 * (-0.016666666666666666 * (math.cos(re) * math.pow(im, 5.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 450000000.0) tmp = Float64(0.5 * Float64(cos(re) * Float64(Float64(im * Float64((im ^ 2.0) * -0.3333333333333333)) + Float64(im * -2.0)))); elseif (im <= 2.85e+60) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((re ^ 4.0) * Float64(im * -0.08333333333333333)))); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * Float64(cos(re) * (im ^ 5.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 450000000.0) tmp = 0.5 * (cos(re) * ((im * ((im ^ 2.0) * -0.3333333333333333)) + (im * -2.0))); elseif (im <= 2.85e+60) tmp = 0.5 * ((im * -2.0) + ((re ^ 4.0) * (im * -0.08333333333333333))); else tmp = 0.5 * (-0.016666666666666666 * (cos(re) * (im ^ 5.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 450000000.0], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(N[(im * N[(N[Power[im, 2.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.85e+60], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[re, 4.0], $MachinePrecision] * N[(im * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 450000000:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(im \cdot \left({im}^{2} \cdot -0.3333333333333333\right) + im \cdot -2\right)\right)\\
\mathbf{elif}\;im \leq 2.85 \cdot 10^{+60}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {re}^{4} \cdot \left(im \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(\cos re \cdot {im}^{5}\right)\right)\\
\end{array}
\end{array}
if im < 4.5e8Initial program 42.1%
/-rgt-identity42.1%
exp-042.1%
associate-*l/42.1%
cos-neg42.1%
associate-*l*42.1%
associate-*r/42.1%
exp-042.1%
/-rgt-identity42.1%
*-commutative42.1%
neg-sub042.1%
cos-neg42.1%
Simplified42.1%
Taylor expanded in im around 0 88.4%
sub-neg88.4%
metadata-eval88.4%
distribute-rgt-in88.5%
*-commutative88.5%
*-commutative88.5%
Applied egg-rr88.5%
if 4.5e8 < im < 2.84999999999999989e60Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
Taylor expanded in re around 0 31.4%
Taylor expanded in re around inf 31.4%
associate-*r*31.4%
*-commutative31.4%
*-commutative31.4%
Simplified31.4%
if 2.84999999999999989e60 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
distribute-lft-in100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-undefine100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification88.7%
(FPCore (re im)
:precision binary64
(if (<= im 0.3)
(* 0.5 (* (cos re) (* im -2.0)))
(if (<= im 1.3e+60)
(* 0.5 (+ (* im -2.0) (* (pow re 4.0) (* im -0.08333333333333333))))
(* 0.5 (* -0.016666666666666666 (* (cos re) (pow im 5.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 0.3) {
tmp = 0.5 * (cos(re) * (im * -2.0));
} else if (im <= 1.3e+60) {
tmp = 0.5 * ((im * -2.0) + (pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * (cos(re) * pow(im, 5.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.3d0) then
tmp = 0.5d0 * (cos(re) * (im * (-2.0d0)))
else if (im <= 1.3d+60) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((re ** 4.0d0) * (im * (-0.08333333333333333d0))))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (cos(re) * (im ** 5.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.3) {
tmp = 0.5 * (Math.cos(re) * (im * -2.0));
} else if (im <= 1.3e+60) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * (Math.cos(re) * Math.pow(im, 5.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.3: tmp = 0.5 * (math.cos(re) * (im * -2.0)) elif im <= 1.3e+60: tmp = 0.5 * ((im * -2.0) + (math.pow(re, 4.0) * (im * -0.08333333333333333))) else: tmp = 0.5 * (-0.016666666666666666 * (math.cos(re) * math.pow(im, 5.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.3) tmp = Float64(0.5 * Float64(cos(re) * Float64(im * -2.0))); elseif (im <= 1.3e+60) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((re ^ 4.0) * Float64(im * -0.08333333333333333)))); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * Float64(cos(re) * (im ^ 5.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.3) tmp = 0.5 * (cos(re) * (im * -2.0)); elseif (im <= 1.3e+60) tmp = 0.5 * ((im * -2.0) + ((re ^ 4.0) * (im * -0.08333333333333333))); else tmp = 0.5 * (-0.016666666666666666 * (cos(re) * (im ^ 5.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.3], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.3e+60], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[re, 4.0], $MachinePrecision] * N[(im * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.3:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(im \cdot -2\right)\right)\\
\mathbf{elif}\;im \leq 1.3 \cdot 10^{+60}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {re}^{4} \cdot \left(im \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(\cos re \cdot {im}^{5}\right)\right)\\
\end{array}
\end{array}
if im < 0.299999999999999989Initial program 40.9%
/-rgt-identity40.9%
exp-040.9%
associate-*l/40.9%
cos-neg40.9%
associate-*l*40.9%
associate-*r/40.9%
exp-040.9%
/-rgt-identity40.9%
*-commutative40.9%
neg-sub040.9%
cos-neg40.9%
Simplified40.9%
Taylor expanded in im around 0 65.8%
if 0.299999999999999989 < im < 1.30000000000000004e60Initial program 99.9%
/-rgt-identity99.9%
exp-099.9%
associate-*l/99.9%
cos-neg99.9%
associate-*l*99.9%
associate-*r/99.9%
exp-099.9%
/-rgt-identity99.9%
*-commutative99.9%
neg-sub099.9%
cos-neg99.9%
Simplified99.9%
Taylor expanded in im around 0 7.3%
Taylor expanded in re around 0 27.3%
Taylor expanded in re around inf 27.3%
associate-*r*27.3%
*-commutative27.3%
*-commutative27.3%
Simplified27.3%
if 1.30000000000000004e60 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
distribute-lft-in100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-undefine100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification70.9%
(FPCore (re im)
:precision binary64
(if (<= im 450000000.0)
(* 0.5 (* im (* (cos re) (- (* (pow im 2.0) -0.3333333333333333) 2.0))))
(if (<= im 2.9e+60)
(* 0.5 (+ (* im -2.0) (* (pow re 4.0) (* im -0.08333333333333333))))
(* 0.5 (* -0.016666666666666666 (* (cos re) (pow im 5.0)))))))
double code(double re, double im) {
double tmp;
if (im <= 450000000.0) {
tmp = 0.5 * (im * (cos(re) * ((pow(im, 2.0) * -0.3333333333333333) - 2.0)));
} else if (im <= 2.9e+60) {
tmp = 0.5 * ((im * -2.0) + (pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * (cos(re) * pow(im, 5.0)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 450000000.0d0) then
tmp = 0.5d0 * (im * (cos(re) * (((im ** 2.0d0) * (-0.3333333333333333d0)) - 2.0d0)))
else if (im <= 2.9d+60) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((re ** 4.0d0) * (im * (-0.08333333333333333d0))))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (cos(re) * (im ** 5.0d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 450000000.0) {
tmp = 0.5 * (im * (Math.cos(re) * ((Math.pow(im, 2.0) * -0.3333333333333333) - 2.0)));
} else if (im <= 2.9e+60) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * (Math.cos(re) * Math.pow(im, 5.0)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 450000000.0: tmp = 0.5 * (im * (math.cos(re) * ((math.pow(im, 2.0) * -0.3333333333333333) - 2.0))) elif im <= 2.9e+60: tmp = 0.5 * ((im * -2.0) + (math.pow(re, 4.0) * (im * -0.08333333333333333))) else: tmp = 0.5 * (-0.016666666666666666 * (math.cos(re) * math.pow(im, 5.0))) return tmp
function code(re, im) tmp = 0.0 if (im <= 450000000.0) tmp = Float64(0.5 * Float64(im * Float64(cos(re) * Float64(Float64((im ^ 2.0) * -0.3333333333333333) - 2.0)))); elseif (im <= 2.9e+60) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((re ^ 4.0) * Float64(im * -0.08333333333333333)))); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * Float64(cos(re) * (im ^ 5.0)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 450000000.0) tmp = 0.5 * (im * (cos(re) * (((im ^ 2.0) * -0.3333333333333333) - 2.0))); elseif (im <= 2.9e+60) tmp = 0.5 * ((im * -2.0) + ((re ^ 4.0) * (im * -0.08333333333333333))); else tmp = 0.5 * (-0.016666666666666666 * (cos(re) * (im ^ 5.0))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 450000000.0], N[(0.5 * N[(im * N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 2.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.9e+60], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[re, 4.0], $MachinePrecision] * N[(im * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 450000000:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(\cos re \cdot \left({im}^{2} \cdot -0.3333333333333333 - 2\right)\right)\right)\\
\mathbf{elif}\;im \leq 2.9 \cdot 10^{+60}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {re}^{4} \cdot \left(im \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot \left(\cos re \cdot {im}^{5}\right)\right)\\
\end{array}
\end{array}
if im < 4.5e8Initial program 42.1%
/-rgt-identity42.1%
exp-042.1%
associate-*l/42.1%
cos-neg42.1%
associate-*l*42.1%
associate-*r/42.1%
exp-042.1%
/-rgt-identity42.1%
*-commutative42.1%
neg-sub042.1%
cos-neg42.1%
Simplified42.1%
Taylor expanded in im around 0 88.4%
Taylor expanded in re around inf 88.4%
if 4.5e8 < im < 2.9e60Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
Taylor expanded in re around 0 31.4%
Taylor expanded in re around inf 31.4%
associate-*r*31.4%
*-commutative31.4%
*-commutative31.4%
Simplified31.4%
if 2.9e60 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
distribute-lft-in100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-undefine100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification88.7%
(FPCore (re im)
:precision binary64
(if (<= im 0.3)
(* 0.5 (* (cos re) (* im -2.0)))
(if (<= im 2.9e+60)
(* 0.5 (+ (* im -2.0) (* (pow re 4.0) (* im -0.08333333333333333))))
(* 0.5 (* -0.016666666666666666 (pow im 5.0))))))
double code(double re, double im) {
double tmp;
if (im <= 0.3) {
tmp = 0.5 * (cos(re) * (im * -2.0));
} else if (im <= 2.9e+60) {
tmp = 0.5 * ((im * -2.0) + (pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * pow(im, 5.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.3d0) then
tmp = 0.5d0 * (cos(re) * (im * (-2.0d0)))
else if (im <= 2.9d+60) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((re ** 4.0d0) * (im * (-0.08333333333333333d0))))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (im ** 5.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.3) {
tmp = 0.5 * (Math.cos(re) * (im * -2.0));
} else if (im <= 2.9e+60) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(re, 4.0) * (im * -0.08333333333333333)));
} else {
tmp = 0.5 * (-0.016666666666666666 * Math.pow(im, 5.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.3: tmp = 0.5 * (math.cos(re) * (im * -2.0)) elif im <= 2.9e+60: tmp = 0.5 * ((im * -2.0) + (math.pow(re, 4.0) * (im * -0.08333333333333333))) else: tmp = 0.5 * (-0.016666666666666666 * math.pow(im, 5.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.3) tmp = Float64(0.5 * Float64(cos(re) * Float64(im * -2.0))); elseif (im <= 2.9e+60) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((re ^ 4.0) * Float64(im * -0.08333333333333333)))); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * (im ^ 5.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.3) tmp = 0.5 * (cos(re) * (im * -2.0)); elseif (im <= 2.9e+60) tmp = 0.5 * ((im * -2.0) + ((re ^ 4.0) * (im * -0.08333333333333333))); else tmp = 0.5 * (-0.016666666666666666 * (im ^ 5.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.3], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.9e+60], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[re, 4.0], $MachinePrecision] * N[(im * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.3:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(im \cdot -2\right)\right)\\
\mathbf{elif}\;im \leq 2.9 \cdot 10^{+60}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {re}^{4} \cdot \left(im \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot {im}^{5}\right)\\
\end{array}
\end{array}
if im < 0.299999999999999989Initial program 40.9%
/-rgt-identity40.9%
exp-040.9%
associate-*l/40.9%
cos-neg40.9%
associate-*l*40.9%
associate-*r/40.9%
exp-040.9%
/-rgt-identity40.9%
*-commutative40.9%
neg-sub040.9%
cos-neg40.9%
Simplified40.9%
Taylor expanded in im around 0 65.8%
if 0.299999999999999989 < im < 2.9e60Initial program 99.9%
/-rgt-identity99.9%
exp-099.9%
associate-*l/99.9%
cos-neg99.9%
associate-*l*99.9%
associate-*r/99.9%
exp-099.9%
/-rgt-identity99.9%
*-commutative99.9%
neg-sub099.9%
cos-neg99.9%
Simplified99.9%
Taylor expanded in im around 0 7.3%
Taylor expanded in re around 0 27.3%
Taylor expanded in re around inf 27.3%
associate-*r*27.3%
*-commutative27.3%
*-commutative27.3%
Simplified27.3%
if 2.9e60 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
distribute-lft-in100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-undefine100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 74.1%
Final simplification65.4%
(FPCore (re im) :precision binary64 (if (<= im 9.8e+24) (* 0.5 (* (cos re) (* im -2.0))) (* 0.5 (* -0.016666666666666666 (pow im 5.0)))))
double code(double re, double im) {
double tmp;
if (im <= 9.8e+24) {
tmp = 0.5 * (cos(re) * (im * -2.0));
} else {
tmp = 0.5 * (-0.016666666666666666 * pow(im, 5.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 9.8d+24) then
tmp = 0.5d0 * (cos(re) * (im * (-2.0d0)))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (im ** 5.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.8e+24) {
tmp = 0.5 * (Math.cos(re) * (im * -2.0));
} else {
tmp = 0.5 * (-0.016666666666666666 * Math.pow(im, 5.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.8e+24: tmp = 0.5 * (math.cos(re) * (im * -2.0)) else: tmp = 0.5 * (-0.016666666666666666 * math.pow(im, 5.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.8e+24) tmp = Float64(0.5 * Float64(cos(re) * Float64(im * -2.0))); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * (im ^ 5.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.8e+24) tmp = 0.5 * (cos(re) * (im * -2.0)); else tmp = 0.5 * (-0.016666666666666666 * (im ^ 5.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.8e+24], N[(0.5 * N[(N[Cos[re], $MachinePrecision] * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.8 \cdot 10^{+24}:\\
\;\;\;\;0.5 \cdot \left(\cos re \cdot \left(im \cdot -2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot {im}^{5}\right)\\
\end{array}
\end{array}
if im < 9.80000000000000059e24Initial program 42.7%
/-rgt-identity42.7%
exp-042.7%
associate-*l/42.7%
cos-neg42.7%
associate-*l*42.7%
associate-*r/42.7%
exp-042.7%
/-rgt-identity42.7%
*-commutative42.7%
neg-sub042.7%
cos-neg42.7%
Simplified42.7%
Taylor expanded in im around 0 64.1%
if 9.80000000000000059e24 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.0%
distribute-lft-in88.0%
+-commutative88.0%
associate-*r*88.0%
*-commutative88.0%
fma-undefine88.0%
Simplified88.0%
Taylor expanded in im around inf 88.0%
Taylor expanded in re around 0 65.2%
Final simplification64.4%
(FPCore (re im) :precision binary64 (if (<= im 3.3) (* 0.5 (* im -2.0)) (* 0.5 (* -0.016666666666666666 (pow im 5.0)))))
double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = 0.5 * (im * -2.0);
} else {
tmp = 0.5 * (-0.016666666666666666 * pow(im, 5.0));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 3.3d0) then
tmp = 0.5d0 * (im * (-2.0d0))
else
tmp = 0.5d0 * ((-0.016666666666666666d0) * (im ** 5.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.3) {
tmp = 0.5 * (im * -2.0);
} else {
tmp = 0.5 * (-0.016666666666666666 * Math.pow(im, 5.0));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.3: tmp = 0.5 * (im * -2.0) else: tmp = 0.5 * (-0.016666666666666666 * math.pow(im, 5.0)) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.3) tmp = Float64(0.5 * Float64(im * -2.0)); else tmp = Float64(0.5 * Float64(-0.016666666666666666 * (im ^ 5.0))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.3) tmp = 0.5 * (im * -2.0); else tmp = 0.5 * (-0.016666666666666666 * (im ^ 5.0)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.3], N[(0.5 * N[(im * -2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(-0.016666666666666666 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.3:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(-0.016666666666666666 \cdot {im}^{5}\right)\\
\end{array}
\end{array}
if im < 3.2999999999999998Initial program 41.5%
/-rgt-identity41.5%
exp-041.5%
associate-*l/41.5%
cos-neg41.5%
associate-*l*41.5%
associate-*r/41.5%
exp-041.5%
/-rgt-identity41.5%
*-commutative41.5%
neg-sub041.5%
cos-neg41.5%
Simplified41.5%
Taylor expanded in im around 0 65.3%
Taylor expanded in re around 0 38.0%
*-commutative38.0%
Simplified38.0%
if 3.2999999999999998 < im Initial program 100.0%
/-rgt-identity100.0%
exp-0100.0%
associate-*l/100.0%
cos-neg100.0%
associate-*l*100.0%
associate-*r/100.0%
exp-0100.0%
/-rgt-identity100.0%
*-commutative100.0%
neg-sub0100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.0%
distribute-lft-in83.0%
+-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
fma-undefine83.0%
Simplified83.0%
Taylor expanded in im around inf 83.0%
Taylor expanded in re around 0 61.6%
Final simplification44.1%
(FPCore (re im) :precision binary64 (* 0.5 (* im -2.0)))
double code(double re, double im) {
return 0.5 * (im * -2.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (im * (-2.0d0))
end function
public static double code(double re, double im) {
return 0.5 * (im * -2.0);
}
def code(re, im): return 0.5 * (im * -2.0)
function code(re, im) return Float64(0.5 * Float64(im * -2.0)) end
function tmp = code(re, im) tmp = 0.5 * (im * -2.0); end
code[re_, im_] := N[(0.5 * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(im \cdot -2\right)
\end{array}
Initial program 56.6%
/-rgt-identity56.6%
exp-056.6%
associate-*l/56.6%
cos-neg56.6%
associate-*l*56.6%
associate-*r/56.6%
exp-056.6%
/-rgt-identity56.6%
*-commutative56.6%
neg-sub056.6%
cos-neg56.6%
Simplified56.6%
Taylor expanded in im around 0 49.9%
Taylor expanded in re around 0 29.3%
*-commutative29.3%
Simplified29.3%
Final simplification29.3%
(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 2024055
(FPCore (re im)
:name "math.sin on complex, imaginary part"
:precision binary64
:alt
(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))))