
(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 13 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 (* (cos re) (- 0.0 (sinh im))))
double code(double re, double im) {
return cos(re) * (0.0 - sinh(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(re) * (0.0d0 - sinh(im))
end function
public static double code(double re, double im) {
return Math.cos(re) * (0.0 - Math.sinh(im));
}
def code(re, im): return math.cos(re) * (0.0 - math.sinh(im))
function code(re, im) return Float64(cos(re) * Float64(0.0 - sinh(im))) end
function tmp = code(re, im) tmp = cos(re) * (0.0 - sinh(im)); end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \left(0 - \sinh im\right)
\end{array}
Initial program 55.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr99.9%
remove-double-divN/A
un-div-invN/A
associate-/l/N/A
associate-/r/N/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
neg-lowering-neg.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sinh-lowering-sinh.f6499.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(if (<= (cos re) 0.983)
(*
(* (cos re) 0.5)
(*
im
(+
-2.0
(*
(* im im)
(+
-0.3333333333333333
(*
(* im im)
(+ -0.016666666666666666 (* (* im im) -0.0003968253968253968))))))))
(- 0.0 (sinh im))))
double code(double re, double im) {
double tmp;
if (cos(re) <= 0.983) {
tmp = (cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))));
} else {
tmp = 0.0 - sinh(im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (cos(re) <= 0.983d0) then
tmp = (cos(re) * 0.5d0) * (im * ((-2.0d0) + ((im * im) * ((-0.3333333333333333d0) + ((im * im) * ((-0.016666666666666666d0) + ((im * im) * (-0.0003968253968253968d0))))))))
else
tmp = 0.0d0 - sinh(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.cos(re) <= 0.983) {
tmp = (Math.cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))));
} else {
tmp = 0.0 - Math.sinh(im);
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= 0.983: tmp = (math.cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968))))))) else: tmp = 0.0 - math.sinh(im) return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= 0.983) tmp = Float64(Float64(cos(re) * 0.5) * Float64(im * Float64(-2.0 + Float64(Float64(im * im) * Float64(-0.3333333333333333 + Float64(Float64(im * im) * Float64(-0.016666666666666666 + Float64(Float64(im * im) * -0.0003968253968253968)))))))); else tmp = Float64(0.0 - sinh(im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= 0.983) tmp = (cos(re) * 0.5) * (im * (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968))))))); else tmp = 0.0 - sinh(im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.983], N[(N[(N[Cos[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(im * N[(-2.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.3333333333333333 + N[(N[(im * im), $MachinePrecision] * N[(-0.016666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.983:\\
\;\;\;\;\left(\cos re \cdot 0.5\right) \cdot \left(im \cdot \left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0 - \sinh im\\
\end{array}
\end{array}
if (cos.f64 re) < 0.982999999999999985Initial program 55.6%
Taylor expanded in im around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.8%
Simplified96.8%
if 0.982999999999999985 < (cos.f64 re) Initial program 56.1%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr100.0%
remove-double-divN/A
un-div-invN/A
associate-/l/N/A
associate-/r/N/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
neg-lowering-neg.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sinh-lowering-sinh.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified99.9%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(if (<= (cos re) 0.983)
(*
im
(*
(cos re)
(+
-1.0
(*
(* im im)
(+ -0.16666666666666666 (* (* im im) -0.008333333333333333))))))
(- 0.0 (sinh im))))
double code(double re, double im) {
double tmp;
if (cos(re) <= 0.983) {
tmp = im * (cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333)))));
} else {
tmp = 0.0 - sinh(im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (cos(re) <= 0.983d0) then
tmp = im * (cos(re) * ((-1.0d0) + ((im * im) * ((-0.16666666666666666d0) + ((im * im) * (-0.008333333333333333d0))))))
else
tmp = 0.0d0 - sinh(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.cos(re) <= 0.983) {
tmp = im * (Math.cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333)))));
} else {
tmp = 0.0 - Math.sinh(im);
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= 0.983: tmp = im * (math.cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333))))) else: tmp = 0.0 - math.sinh(im) return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= 0.983) tmp = Float64(im * Float64(cos(re) * Float64(-1.0 + Float64(Float64(im * im) * Float64(-0.16666666666666666 + Float64(Float64(im * im) * -0.008333333333333333)))))); else tmp = Float64(0.0 - sinh(im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= 0.983) tmp = im * (cos(re) * (-1.0 + ((im * im) * (-0.16666666666666666 + ((im * im) * -0.008333333333333333))))); else tmp = 0.0 - sinh(im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], 0.983], N[(im * N[(N[Cos[re], $MachinePrecision] * N[(-1.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.16666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq 0.983:\\
\;\;\;\;im \cdot \left(\cos re \cdot \left(-1 + \left(im \cdot im\right) \cdot \left(-0.16666666666666666 + \left(im \cdot im\right) \cdot -0.008333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0 - \sinh im\\
\end{array}
\end{array}
if (cos.f64 re) < 0.982999999999999985Initial program 55.6%
Taylor expanded in im around 0
*-lowering-*.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
distribute-lft-outN/A
Simplified95.4%
if 0.982999999999999985 < (cos.f64 re) Initial program 56.1%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr100.0%
remove-double-divN/A
un-div-invN/A
associate-/l/N/A
associate-/r/N/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
neg-lowering-neg.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sinh-lowering-sinh.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified99.9%
Final simplification97.7%
(FPCore (re im) :precision binary64 (let* ((t_0 (* (cos re) (* im (+ -1.0 (* (* im im) -0.16666666666666666)))))) (if (<= im 0.00013) t_0 (if (<= im 1.05e+103) (- 0.0 (sinh im)) t_0))))
double code(double re, double im) {
double t_0 = cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666)));
double tmp;
if (im <= 0.00013) {
tmp = t_0;
} else if (im <= 1.05e+103) {
tmp = 0.0 - sinh(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 * ((-1.0d0) + ((im * im) * (-0.16666666666666666d0))))
if (im <= 0.00013d0) then
tmp = t_0
else if (im <= 1.05d+103) then
tmp = 0.0d0 - sinh(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) * (im * (-1.0 + ((im * im) * -0.16666666666666666)));
double tmp;
if (im <= 0.00013) {
tmp = t_0;
} else if (im <= 1.05e+103) {
tmp = 0.0 - Math.sinh(im);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666))) tmp = 0 if im <= 0.00013: tmp = t_0 elif im <= 1.05e+103: tmp = 0.0 - math.sinh(im) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64(im * Float64(-1.0 + Float64(Float64(im * im) * -0.16666666666666666)))) tmp = 0.0 if (im <= 0.00013) tmp = t_0; elseif (im <= 1.05e+103) tmp = Float64(0.0 - sinh(im)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * (im * (-1.0 + ((im * im) * -0.16666666666666666))); tmp = 0.0; if (im <= 0.00013) tmp = t_0; elseif (im <= 1.05e+103) tmp = 0.0 - sinh(im); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Cos[re], $MachinePrecision] * N[(im * N[(-1.0 + N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 0.00013], t$95$0, If[LessEqual[im, 1.05e+103], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left(im \cdot \left(-1 + \left(im \cdot im\right) \cdot -0.16666666666666666\right)\right)\\
\mathbf{if}\;im \leq 0.00013:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;0 - \sinh im\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 1.29999999999999989e-4 or 1.0500000000000001e103 < im Initial program 51.6%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
neg-mul-1N/A
*-commutativeN/A
Simplified94.6%
if 1.29999999999999989e-4 < im < 1.0500000000000001e103Initial program 100.0%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr100.0%
remove-double-divN/A
un-div-invN/A
associate-/l/N/A
associate-/r/N/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
neg-lowering-neg.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sinh-lowering-sinh.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified64.3%
Final simplification92.0%
(FPCore (re im) :precision binary64 (if (<= im 0.00012) (- 0.0 (* (cos re) im)) (- 0.0 (sinh im))))
double code(double re, double im) {
double tmp;
if (im <= 0.00012) {
tmp = 0.0 - (cos(re) * im);
} else {
tmp = 0.0 - sinh(im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 0.00012d0) then
tmp = 0.0d0 - (cos(re) * im)
else
tmp = 0.0d0 - sinh(im)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 0.00012) {
tmp = 0.0 - (Math.cos(re) * im);
} else {
tmp = 0.0 - Math.sinh(im);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 0.00012: tmp = 0.0 - (math.cos(re) * im) else: tmp = 0.0 - math.sinh(im) return tmp
function code(re, im) tmp = 0.0 if (im <= 0.00012) tmp = Float64(0.0 - Float64(cos(re) * im)); else tmp = Float64(0.0 - sinh(im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 0.00012) tmp = 0.0 - (cos(re) * im); else tmp = 0.0 - sinh(im); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 0.00012], N[(0.0 - N[(N[Cos[re], $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 0.00012:\\
\;\;\;\;0 - \cos re \cdot im\\
\mathbf{else}:\\
\;\;\;\;0 - \sinh im\\
\end{array}
\end{array}
if im < 1.20000000000000003e-4Initial program 40.4%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6465.9%
Simplified65.9%
sub0-negN/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
cos-lowering-cos.f6465.9%
Applied egg-rr65.9%
if 1.20000000000000003e-4 < im Initial program 100.0%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr100.0%
remove-double-divN/A
un-div-invN/A
associate-/l/N/A
associate-/r/N/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
neg-lowering-neg.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sinh-lowering-sinh.f64100.0%
Applied egg-rr100.0%
Taylor expanded in re around 0
Simplified77.5%
Final simplification68.9%
(FPCore (re im) :precision binary64 (- 0.0 (sinh im)))
double code(double re, double im) {
return 0.0 - sinh(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0 - sinh(im)
end function
public static double code(double re, double im) {
return 0.0 - Math.sinh(im);
}
def code(re, im): return 0.0 - math.sinh(im)
function code(re, im) return Float64(0.0 - sinh(im)) end
function tmp = code(re, im) tmp = 0.0 - sinh(im); end
code[re_, im_] := N[(0.0 - N[Sinh[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0 - \sinh im
\end{array}
Initial program 55.8%
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr99.9%
remove-double-divN/A
un-div-invN/A
associate-/l/N/A
associate-/r/N/A
associate-*l*N/A
metadata-evalN/A
*-commutativeN/A
neg-mul-1N/A
neg-lowering-neg.f64N/A
associate-/r/N/A
/-rgt-identityN/A
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
sinh-lowering-sinh.f6499.9%
Applied egg-rr99.9%
Taylor expanded in re around 0
Simplified64.9%
Final simplification64.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (+ -2.0 (* im (* im -0.3333333333333333)))))
(t_1 (* 0.5 t_0)))
(if (<= im 5.6e+20)
t_1
(if (<= im 3e+132) (* t_0 (+ 0.5 (* (* re re) -0.25))) t_1))))
double code(double re, double im) {
double t_0 = im * (-2.0 + (im * (im * -0.3333333333333333)));
double t_1 = 0.5 * t_0;
double tmp;
if (im <= 5.6e+20) {
tmp = t_1;
} else if (im <= 3e+132) {
tmp = t_0 * (0.5 + ((re * re) * -0.25));
} else {
tmp = t_1;
}
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 = im * ((-2.0d0) + (im * (im * (-0.3333333333333333d0))))
t_1 = 0.5d0 * t_0
if (im <= 5.6d+20) then
tmp = t_1
else if (im <= 3d+132) then
tmp = t_0 * (0.5d0 + ((re * re) * (-0.25d0)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = im * (-2.0 + (im * (im * -0.3333333333333333)));
double t_1 = 0.5 * t_0;
double tmp;
if (im <= 5.6e+20) {
tmp = t_1;
} else if (im <= 3e+132) {
tmp = t_0 * (0.5 + ((re * re) * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = im * (-2.0 + (im * (im * -0.3333333333333333))) t_1 = 0.5 * t_0 tmp = 0 if im <= 5.6e+20: tmp = t_1 elif im <= 3e+132: tmp = t_0 * (0.5 + ((re * re) * -0.25)) else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(im * Float64(-2.0 + Float64(im * Float64(im * -0.3333333333333333)))) t_1 = Float64(0.5 * t_0) tmp = 0.0 if (im <= 5.6e+20) tmp = t_1; elseif (im <= 3e+132) tmp = Float64(t_0 * Float64(0.5 + Float64(Float64(re * re) * -0.25))); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = im * (-2.0 + (im * (im * -0.3333333333333333))); t_1 = 0.5 * t_0; tmp = 0.0; if (im <= 5.6e+20) tmp = t_1; elseif (im <= 3e+132) tmp = t_0 * (0.5 + ((re * re) * -0.25)); else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(-2.0 + N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * t$95$0), $MachinePrecision]}, If[LessEqual[im, 5.6e+20], t$95$1, If[LessEqual[im, 3e+132], N[(t$95$0 * N[(0.5 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\\
t_1 := 0.5 \cdot t\_0\\
\mathbf{if}\;im \leq 5.6 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;im \leq 3 \cdot 10^{+132}:\\
\;\;\;\;t\_0 \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if im < 5.6e20 or 2.9999999999999998e132 < im Initial program 51.0%
Taylor expanded in im around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6493.7%
Simplified93.7%
Taylor expanded in re around 0
Simplified59.7%
if 5.6e20 < im < 2.9999999999999998e132Initial program 100.0%
Taylor expanded in im around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6425.3%
Simplified25.3%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.4%
Simplified50.4%
Final simplification58.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im (+ -2.0 (* im (* im -0.3333333333333333)))))))
(if (<= im 1.75e+30)
t_0
(if (<= im 6e+103) (* (* re re) (* im (+ 0.5 (/ -1.0 (* re re))))) t_0))))
double code(double re, double im) {
double t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
double tmp;
if (im <= 1.75e+30) {
tmp = t_0;
} else if (im <= 6e+103) {
tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (im * ((-2.0d0) + (im * (im * (-0.3333333333333333d0)))))
if (im <= 1.75d+30) then
tmp = t_0
else if (im <= 6d+103) then
tmp = (re * re) * (im * (0.5d0 + ((-1.0d0) / (re * re))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
double tmp;
if (im <= 1.75e+30) {
tmp = t_0;
} else if (im <= 6e+103) {
tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re))));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333)))) tmp = 0 if im <= 1.75e+30: tmp = t_0 elif im <= 6e+103: tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re)))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(im * Float64(-2.0 + Float64(im * Float64(im * -0.3333333333333333))))) tmp = 0.0 if (im <= 1.75e+30) tmp = t_0; elseif (im <= 6e+103) tmp = Float64(Float64(re * re) * Float64(im * Float64(0.5 + Float64(-1.0 / Float64(re * re))))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333)))); tmp = 0.0; if (im <= 1.75e+30) tmp = t_0; elseif (im <= 6e+103) tmp = (re * re) * (im * (0.5 + (-1.0 / (re * re)))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * N[(-2.0 + N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 1.75e+30], t$95$0, If[LessEqual[im, 6e+103], N[(N[(re * re), $MachinePrecision] * N[(im * N[(0.5 + N[(-1.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)\\
\mathbf{if}\;im \leq 1.75 \cdot 10^{+30}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;im \leq 6 \cdot 10^{+103}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot \left(0.5 + \frac{-1}{re \cdot re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if im < 1.75000000000000011e30 or 6e103 < im Initial program 52.7%
Taylor expanded in im around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.7%
Simplified92.7%
Taylor expanded in re around 0
Simplified59.0%
if 1.75000000000000011e30 < im < 6e103Initial program 100.0%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f643.8%
Simplified3.8%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6431.7%
Simplified31.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6442.6%
Simplified42.6%
Final simplification57.9%
(FPCore (re im)
:precision binary64
(*
(+
-2.0
(*
(* im im)
(+
-0.3333333333333333
(*
(* im im)
(+ -0.016666666666666666 (* (* im im) -0.0003968253968253968))))))
(* im 0.5)))
double code(double re, double im) {
return (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = ((-2.0d0) + ((im * im) * ((-0.3333333333333333d0) + ((im * im) * ((-0.016666666666666666d0) + ((im * im) * (-0.0003968253968253968d0))))))) * (im * 0.5d0)
end function
public static double code(double re, double im) {
return (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5);
}
def code(re, im): return (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5)
function code(re, im) return Float64(Float64(-2.0 + Float64(Float64(im * im) * Float64(-0.3333333333333333 + Float64(Float64(im * im) * Float64(-0.016666666666666666 + Float64(Float64(im * im) * -0.0003968253968253968)))))) * Float64(im * 0.5)) end
function tmp = code(re, im) tmp = (-2.0 + ((im * im) * (-0.3333333333333333 + ((im * im) * (-0.016666666666666666 + ((im * im) * -0.0003968253968253968)))))) * (im * 0.5); end
code[re_, im_] := N[(N[(-2.0 + N[(N[(im * im), $MachinePrecision] * N[(-0.3333333333333333 + N[(N[(im * im), $MachinePrecision] * N[(-0.016666666666666666 + N[(N[(im * im), $MachinePrecision] * -0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-2 + \left(im \cdot im\right) \cdot \left(-0.3333333333333333 + \left(im \cdot im\right) \cdot \left(-0.016666666666666666 + \left(im \cdot im\right) \cdot -0.0003968253968253968\right)\right)\right) \cdot \left(im \cdot 0.5\right)
\end{array}
Initial program 55.8%
Taylor expanded in im around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6494.7%
Simplified94.7%
Taylor expanded in re around 0
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
Simplified60.4%
(FPCore (re im) :precision binary64 (if (<= im 2.1e+22) (- 0.0 im) (* im (+ -1.0 (* 0.5 (* re re))))))
double code(double re, double im) {
double tmp;
if (im <= 2.1e+22) {
tmp = 0.0 - im;
} else {
tmp = im * (-1.0 + (0.5 * (re * re)));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.1d+22) then
tmp = 0.0d0 - im
else
tmp = im * ((-1.0d0) + (0.5d0 * (re * re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.1e+22) {
tmp = 0.0 - im;
} else {
tmp = im * (-1.0 + (0.5 * (re * re)));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.1e+22: tmp = 0.0 - im else: tmp = im * (-1.0 + (0.5 * (re * re))) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.1e+22) tmp = Float64(0.0 - im); else tmp = Float64(im * Float64(-1.0 + Float64(0.5 * Float64(re * re)))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.1e+22) tmp = 0.0 - im; else tmp = im * (-1.0 + (0.5 * (re * re))); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.1e+22], N[(0.0 - im), $MachinePrecision], N[(im * N[(-1.0 + N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.1 \cdot 10^{+22}:\\
\;\;\;\;0 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-1 + 0.5 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 2.0999999999999998e22Initial program 41.4%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6464.9%
Simplified64.9%
Taylor expanded in re around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f6436.2%
Simplified36.2%
sub0-negN/A
neg-lowering-neg.f6436.2%
Applied egg-rr36.2%
if 2.0999999999999998e22 < im Initial program 100.0%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f645.6%
Simplified5.6%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6420.5%
Simplified20.5%
sub0-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
distribute-neg-inN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f64N/A
*-lowering-*.f6420.5%
Applied egg-rr20.5%
Final simplification32.4%
(FPCore (re im) :precision binary64 (if (<= im 3.7e+32) (- 0.0 im) (* 0.5 (* im (* re re)))))
double code(double re, double im) {
double tmp;
if (im <= 3.7e+32) {
tmp = 0.0 - im;
} else {
tmp = 0.5 * (im * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 3.7d+32) then
tmp = 0.0d0 - im
else
tmp = 0.5d0 * (im * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 3.7e+32) {
tmp = 0.0 - im;
} else {
tmp = 0.5 * (im * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 3.7e+32: tmp = 0.0 - im else: tmp = 0.5 * (im * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (im <= 3.7e+32) tmp = Float64(0.0 - im); else tmp = Float64(0.5 * Float64(im * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 3.7e+32) tmp = 0.0 - im; else tmp = 0.5 * (im * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 3.7e+32], N[(0.0 - im), $MachinePrecision], N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 3.7 \cdot 10^{+32}:\\
\;\;\;\;0 - im\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 3.7e32Initial program 42.6%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6463.7%
Simplified63.7%
Taylor expanded in re around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f6435.6%
Simplified35.6%
sub0-negN/A
neg-lowering-neg.f6435.6%
Applied egg-rr35.6%
if 3.7e32 < im Initial program 100.0%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f645.7%
Simplified5.7%
Taylor expanded in re around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6421.7%
Simplified21.7%
Taylor expanded in re around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6419.5%
Simplified19.5%
Final simplification31.9%
(FPCore (re im) :precision binary64 (* 0.5 (* im (+ -2.0 (* im (* im -0.3333333333333333))))))
double code(double re, double im) {
return 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (im * ((-2.0d0) + (im * (im * (-0.3333333333333333d0)))))
end function
public static double code(double re, double im) {
return 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))));
}
def code(re, im): return 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333))))
function code(re, im) return Float64(0.5 * Float64(im * Float64(-2.0 + Float64(im * Float64(im * -0.3333333333333333))))) end
function tmp = code(re, im) tmp = 0.5 * (im * (-2.0 + (im * (im * -0.3333333333333333)))); end
code[re_, im_] := N[(0.5 * N[(im * N[(-2.0 + N[(im * N[(im * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(im \cdot \left(-2 + im \cdot \left(im \cdot -0.3333333333333333\right)\right)\right)
\end{array}
Initial program 55.8%
Taylor expanded in im around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.1%
Simplified87.1%
Taylor expanded in re around 0
Simplified55.3%
(FPCore (re im) :precision binary64 (- 0.0 im))
double code(double re, double im) {
return 0.0 - im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0 - im
end function
public static double code(double re, double im) {
return 0.0 - im;
}
def code(re, im): return 0.0 - im
function code(re, im) return Float64(0.0 - im) end
function tmp = code(re, im) tmp = 0.0 - im; end
code[re_, im_] := N[(0.0 - im), $MachinePrecision]
\begin{array}{l}
\\
0 - im
\end{array}
Initial program 55.8%
Taylor expanded in im around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
cos-lowering-cos.f6450.3%
Simplified50.3%
Taylor expanded in re around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f6428.5%
Simplified28.5%
sub0-negN/A
neg-lowering-neg.f6428.5%
Applied egg-rr28.5%
Final simplification28.5%
(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 2024164
(FPCore (re im)
:name "math.sin on complex, imaginary part"
:precision binary64
:alt
(! :herbie-platform default (if (< (fabs im) 1) (- (* (cos re) (+ im (* 1/6 im im im) (* 1/120 im im im im im)))) (* (* 1/2 (cos re)) (- (exp (- 0 im)) (exp im)))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))