
(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 11 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 -1e+53) (not (<= t_0 2e-10)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(-
(+
(* (pow im 3.0) -0.16666666666666666)
(* (pow im 5.0) -0.008333333333333333))
im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1e+53) || !(t_0 <= 2e-10)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 3.0) * -0.16666666666666666) + (pow(im, 5.0) * -0.008333333333333333)) - 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 <= (-1d+53)) .or. (.not. (t_0 <= 2d-10))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * ((((im ** 3.0d0) * (-0.16666666666666666d0)) + ((im ** 5.0d0) * (-0.008333333333333333d0))) - 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 <= -1e+53) || !(t_0 <= 2e-10)) {
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);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1e+53) or not (t_0 <= 2e-10): 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) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1e+53) || !(t_0 <= 2e-10)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64((im ^ 5.0) * -0.008333333333333333)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1e+53) || ~((t_0 <= 2e-10))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 3.0) * -0.16666666666666666) + ((im ^ 5.0) * -0.008333333333333333)) - 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, -1e+53], N[Not[LessEqual[t$95$0, 2e-10]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+53} \lor \neg \left(t_0 \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{3} \cdot -0.16666666666666666 + {im}^{5} \cdot -0.008333333333333333\right) - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -9.9999999999999999e52 or 2.00000000000000007e-10 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -9.9999999999999999e52 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.00000000000000007e-10Initial program 8.1%
neg-sub08.1%
Simplified8.1%
Taylor expanded in im around 0 99.8%
distribute-lft-in99.8%
fma-def99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
fma-def99.8%
Applied egg-rr99.8%
Taylor expanded in re around inf 99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.004) (not (<= t_0 2e-10)))
(* (* 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 <= -0.004) || !(t_0 <= 2e-10)) {
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 <= (-0.004d0)) .or. (.not. (t_0 <= 2d-10))) 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 <= -0.004) || !(t_0 <= 2e-10)) {
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 <= -0.004) or not (t_0 <= 2e-10): 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 <= -0.004) || !(t_0 <= 2e-10)) 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 <= -0.004) || ~((t_0 <= 2e-10))) 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, -0.004], N[Not[LessEqual[t$95$0, 2e-10]], $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 -0.004 \lor \neg \left(t_0 \leq 2 \cdot 10^{-10}\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)) < -0.0040000000000000001 or 2.00000000000000007e-10 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.8%
neg-sub099.8%
Simplified99.8%
if -0.0040000000000000001 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.00000000000000007e-10Initial program 6.8%
neg-sub06.8%
Simplified6.8%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r*99.8%
distribute-rgt-out--99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* (pow im 5.0) -0.008333333333333333))))
(if (<= im -3.9e+62)
t_0
(if (<= im -0.106)
(* 0.5 (- (exp (- im)) (exp im)))
(if (<= im 1.1e+19)
(* im (- (cos re)))
(if (<= im 2.45e+58) (- (* (pow re 2.0) (* im 0.5)) im) t_0))))))
double code(double re, double im) {
double t_0 = cos(re) * (pow(im, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -3.9e+62) {
tmp = t_0;
} else if (im <= -0.106) {
tmp = 0.5 * (exp(-im) - exp(im));
} else if (im <= 1.1e+19) {
tmp = im * -cos(re);
} else if (im <= 2.45e+58) {
tmp = (pow(re, 2.0) * (im * 0.5)) - 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 ** 5.0d0) * (-0.008333333333333333d0))
if (im <= (-3.9d+62)) then
tmp = t_0
else if (im <= (-0.106d0)) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else if (im <= 1.1d+19) then
tmp = im * -cos(re)
else if (im <= 2.45d+58) then
tmp = ((re ** 2.0d0) * (im * 0.5d0)) - 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, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -3.9e+62) {
tmp = t_0;
} else if (im <= -0.106) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else if (im <= 1.1e+19) {
tmp = im * -Math.cos(re);
} else if (im <= 2.45e+58) {
tmp = (Math.pow(re, 2.0) * (im * 0.5)) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (math.pow(im, 5.0) * -0.008333333333333333) tmp = 0 if im <= -3.9e+62: tmp = t_0 elif im <= -0.106: tmp = 0.5 * (math.exp(-im) - math.exp(im)) elif im <= 1.1e+19: tmp = im * -math.cos(re) elif im <= 2.45e+58: tmp = (math.pow(re, 2.0) * (im * 0.5)) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64((im ^ 5.0) * -0.008333333333333333)) tmp = 0.0 if (im <= -3.9e+62) tmp = t_0; elseif (im <= -0.106) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); elseif (im <= 1.1e+19) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 2.45e+58) tmp = Float64(Float64((re ^ 2.0) * Float64(im * 0.5)) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * ((im ^ 5.0) * -0.008333333333333333); tmp = 0.0; if (im <= -3.9e+62) tmp = t_0; elseif (im <= -0.106) tmp = 0.5 * (exp(-im) - exp(im)); elseif (im <= 1.1e+19) tmp = im * -cos(re); elseif (im <= 2.45e+58) tmp = ((re ^ 2.0) * (im * 0.5)) - 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, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.9e+62], t$95$0, If[LessEqual[im, -0.106], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+19], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 2.45e+58], N[(N[(N[Power[re, 2.0], $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -3.9 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.106:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+19}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 2.45 \cdot 10^{+58}:\\
\;\;\;\;{re}^{2} \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.9e62 or 2.45000000000000009e58 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 99.0%
Taylor expanded in im around inf 99.0%
associate-*r*99.0%
Simplified99.0%
if -3.9e62 < im < -0.105999999999999997Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
if -0.105999999999999997 < im < 1.1e19Initial program 11.3%
neg-sub011.3%
Simplified11.3%
Taylor expanded in im around 0 95.8%
associate-*r*95.8%
neg-mul-195.8%
Simplified95.8%
if 1.1e19 < im < 2.45000000000000009e58Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
associate-*r*3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in re around 0 75.8%
mul-1-neg75.8%
+-commutative75.8%
unsub-neg75.8%
*-commutative75.8%
*-commutative75.8%
associate-*l*75.8%
Simplified75.8%
Final simplification95.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (cos re) (* (pow im 5.0) -0.008333333333333333))))
(if (<= im -3.9e+62)
t_0
(if (<= im -0.12)
(* 0.5 (- (exp (- im)) (exp im)))
(if (<= im 1.1e+19)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 4.2e+58) (- (* (pow re 2.0) (* im 0.5)) im) t_0))))))
double code(double re, double im) {
double t_0 = cos(re) * (pow(im, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -3.9e+62) {
tmp = t_0;
} else if (im <= -0.12) {
tmp = 0.5 * (exp(-im) - exp(im));
} else if (im <= 1.1e+19) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.2e+58) {
tmp = (pow(re, 2.0) * (im * 0.5)) - 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 ** 5.0d0) * (-0.008333333333333333d0))
if (im <= (-3.9d+62)) then
tmp = t_0
else if (im <= (-0.12d0)) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else if (im <= 1.1d+19) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 4.2d+58) then
tmp = ((re ** 2.0d0) * (im * 0.5d0)) - 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, 5.0) * -0.008333333333333333);
double tmp;
if (im <= -3.9e+62) {
tmp = t_0;
} else if (im <= -0.12) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else if (im <= 1.1e+19) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.2e+58) {
tmp = (Math.pow(re, 2.0) * (im * 0.5)) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.cos(re) * (math.pow(im, 5.0) * -0.008333333333333333) tmp = 0 if im <= -3.9e+62: tmp = t_0 elif im <= -0.12: tmp = 0.5 * (math.exp(-im) - math.exp(im)) elif im <= 1.1e+19: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 4.2e+58: tmp = (math.pow(re, 2.0) * (im * 0.5)) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(cos(re) * Float64((im ^ 5.0) * -0.008333333333333333)) tmp = 0.0 if (im <= -3.9e+62) tmp = t_0; elseif (im <= -0.12) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); elseif (im <= 1.1e+19) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 4.2e+58) tmp = Float64(Float64((re ^ 2.0) * Float64(im * 0.5)) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = cos(re) * ((im ^ 5.0) * -0.008333333333333333); tmp = 0.0; if (im <= -3.9e+62) tmp = t_0; elseif (im <= -0.12) tmp = 0.5 * (exp(-im) - exp(im)); elseif (im <= 1.1e+19) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 4.2e+58) tmp = ((re ^ 2.0) * (im * 0.5)) - 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, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.9e+62], t$95$0, If[LessEqual[im, -0.12], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+19], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.2e+58], N[(N[(N[Power[re, 2.0], $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos re \cdot \left({im}^{5} \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -3.9 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.12:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+19}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+58}:\\
\;\;\;\;{re}^{2} \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.9e62 or 4.20000000000000024e58 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 99.0%
Taylor expanded in im around inf 99.0%
associate-*r*99.0%
Simplified99.0%
if -3.9e62 < im < -0.12Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 80.0%
if -0.12 < im < 1.1e19Initial program 11.3%
neg-sub011.3%
Simplified11.3%
Taylor expanded in im around 0 96.5%
+-commutative96.5%
mul-1-neg96.5%
unsub-neg96.5%
associate-*r*96.5%
distribute-rgt-out--96.5%
*-commutative96.5%
Simplified96.5%
if 1.1e19 < im < 4.20000000000000024e58Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
associate-*r*3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in re around 0 75.8%
mul-1-neg75.8%
+-commutative75.8%
unsub-neg75.8%
*-commutative75.8%
*-commutative75.8%
associate-*l*75.8%
Simplified75.8%
Final simplification95.8%
(FPCore (re im)
:precision binary64
(if (<= im -0.106)
(* 0.5 (- (exp (- im)) (exp im)))
(if (<= im 1.1e+19)
(* im (- (cos re)))
(if (<= im 1.8e+97)
(- (* (pow re 2.0) (* im 0.5)) im)
(- (* (pow im 5.0) -0.008333333333333333) im)))))
double code(double re, double im) {
double tmp;
if (im <= -0.106) {
tmp = 0.5 * (exp(-im) - exp(im));
} else if (im <= 1.1e+19) {
tmp = im * -cos(re);
} else if (im <= 1.8e+97) {
tmp = (pow(re, 2.0) * (im * 0.5)) - im;
} else {
tmp = (pow(im, 5.0) * -0.008333333333333333) - 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.106d0)) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else if (im <= 1.1d+19) then
tmp = im * -cos(re)
else if (im <= 1.8d+97) then
tmp = ((re ** 2.0d0) * (im * 0.5d0)) - im
else
tmp = ((im ** 5.0d0) * (-0.008333333333333333d0)) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -0.106) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else if (im <= 1.1e+19) {
tmp = im * -Math.cos(re);
} else if (im <= 1.8e+97) {
tmp = (Math.pow(re, 2.0) * (im * 0.5)) - im;
} else {
tmp = (Math.pow(im, 5.0) * -0.008333333333333333) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -0.106: tmp = 0.5 * (math.exp(-im) - math.exp(im)) elif im <= 1.1e+19: tmp = im * -math.cos(re) elif im <= 1.8e+97: tmp = (math.pow(re, 2.0) * (im * 0.5)) - im else: tmp = (math.pow(im, 5.0) * -0.008333333333333333) - im return tmp
function code(re, im) tmp = 0.0 if (im <= -0.106) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); elseif (im <= 1.1e+19) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.8e+97) tmp = Float64(Float64((re ^ 2.0) * Float64(im * 0.5)) - im); else tmp = Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -0.106) tmp = 0.5 * (exp(-im) - exp(im)); elseif (im <= 1.1e+19) tmp = im * -cos(re); elseif (im <= 1.8e+97) tmp = ((re ^ 2.0) * (im * 0.5)) - im; else tmp = ((im ^ 5.0) * -0.008333333333333333) - im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -0.106], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+19], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.8e+97], N[(N[(N[Power[re, 2.0], $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.106:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+19}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+97}:\\
\;\;\;\;{re}^{2} \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{else}:\\
\;\;\;\;{im}^{5} \cdot -0.008333333333333333 - im\\
\end{array}
\end{array}
if im < -0.105999999999999997Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 73.8%
if -0.105999999999999997 < im < 1.1e19Initial program 11.3%
neg-sub011.3%
Simplified11.3%
Taylor expanded in im around 0 95.8%
associate-*r*95.8%
neg-mul-195.8%
Simplified95.8%
if 1.1e19 < im < 1.79999999999999983e97Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 3.6%
associate-*r*3.6%
neg-mul-13.6%
Simplified3.6%
Taylor expanded in re around 0 77.7%
mul-1-neg77.7%
+-commutative77.7%
unsub-neg77.7%
*-commutative77.7%
*-commutative77.7%
associate-*l*77.7%
Simplified77.7%
if 1.79999999999999983e97 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-lft-in100.0%
associate-*r*100.0%
metadata-eval100.0%
associate-*r*100.0%
metadata-eval100.0%
mul-1-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in re around 0 80.5%
Final simplification87.2%
(FPCore (re im) :precision binary64 (* (cos re) (- (* (pow im 5.0) -0.008333333333333333) im)))
double code(double re, double im) {
return cos(re) * ((pow(im, 5.0) * -0.008333333333333333) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(re) * (((im ** 5.0d0) * (-0.008333333333333333d0)) - im)
end function
public static double code(double re, double im) {
return Math.cos(re) * ((Math.pow(im, 5.0) * -0.008333333333333333) - im);
}
def code(re, im): return math.cos(re) * ((math.pow(im, 5.0) * -0.008333333333333333) - im)
function code(re, im) return Float64(cos(re) * Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im)) end
function tmp = code(re, im) tmp = cos(re) * (((im ^ 5.0) * -0.008333333333333333) - im); end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 - im\right)
\end{array}
Initial program 51.1%
neg-sub051.1%
Simplified51.1%
Taylor expanded in im around 0 89.8%
Taylor expanded in im around inf 89.2%
Taylor expanded in re around inf 89.2%
*-commutative89.2%
associate-*r*89.2%
*-commutative89.2%
distribute-lft-in89.2%
associate-*r*89.2%
metadata-eval89.2%
associate-*r*89.2%
metadata-eval89.2%
mul-1-neg89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in re around inf 89.2%
Final simplification89.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 5.0) -0.008333333333333333) im)))
(if (<= im -1.6e+23)
t_0
(if (<= im 620.0)
(* im (- (cos re)))
(if (<= im 1.7e+97) (- (* (pow re 2.0) (* im 0.5)) im) t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 5.0) * -0.008333333333333333) - im;
double tmp;
if (im <= -1.6e+23) {
tmp = t_0;
} else if (im <= 620.0) {
tmp = im * -cos(re);
} else if (im <= 1.7e+97) {
tmp = (pow(re, 2.0) * (im * 0.5)) - 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 = ((im ** 5.0d0) * (-0.008333333333333333d0)) - im
if (im <= (-1.6d+23)) then
tmp = t_0
else if (im <= 620.0d0) then
tmp = im * -cos(re)
else if (im <= 1.7d+97) then
tmp = ((re ** 2.0d0) * (im * 0.5d0)) - im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 5.0) * -0.008333333333333333) - im;
double tmp;
if (im <= -1.6e+23) {
tmp = t_0;
} else if (im <= 620.0) {
tmp = im * -Math.cos(re);
} else if (im <= 1.7e+97) {
tmp = (Math.pow(re, 2.0) * (im * 0.5)) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 5.0) * -0.008333333333333333) - im tmp = 0 if im <= -1.6e+23: tmp = t_0 elif im <= 620.0: tmp = im * -math.cos(re) elif im <= 1.7e+97: tmp = (math.pow(re, 2.0) * (im * 0.5)) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im) tmp = 0.0 if (im <= -1.6e+23) tmp = t_0; elseif (im <= 620.0) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.7e+97) tmp = Float64(Float64((re ^ 2.0) * Float64(im * 0.5)) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 5.0) * -0.008333333333333333) - im; tmp = 0.0; if (im <= -1.6e+23) tmp = t_0; elseif (im <= 620.0) tmp = im * -cos(re); elseif (im <= 1.7e+97) tmp = ((re ^ 2.0) * (im * 0.5)) - im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -1.6e+23], t$95$0, If[LessEqual[im, 620.0], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.7e+97], N[(N[(N[Power[re, 2.0], $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{5} \cdot -0.008333333333333333 - im\\
\mathbf{if}\;im \leq -1.6 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 620:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+97}:\\
\;\;\;\;{re}^{2} \cdot \left(im \cdot 0.5\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.6e23 or 1.70000000000000005e97 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 93.1%
Taylor expanded in im around inf 93.1%
Taylor expanded in re around inf 93.1%
*-commutative93.1%
associate-*r*93.1%
*-commutative93.1%
distribute-lft-in93.1%
associate-*r*93.1%
metadata-eval93.1%
associate-*r*93.1%
metadata-eval93.1%
mul-1-neg93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in re around 0 71.0%
if -1.6e23 < im < 620Initial program 13.7%
neg-sub013.7%
Simplified13.7%
Taylor expanded in im around 0 93.2%
associate-*r*93.2%
neg-mul-193.2%
Simplified93.2%
if 620 < im < 1.70000000000000005e97Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 3.5%
associate-*r*3.5%
neg-mul-13.5%
Simplified3.5%
Taylor expanded in re around 0 63.7%
mul-1-neg63.7%
+-commutative63.7%
unsub-neg63.7%
*-commutative63.7%
*-commutative63.7%
associate-*l*63.7%
Simplified63.7%
Final simplification83.1%
(FPCore (re im) :precision binary64 (if (or (<= im -4.2e+46) (not (<= im 1.7e+97))) (- (* (pow im 3.0) -0.16666666666666666) im) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -4.2e+46) || !(im <= 1.7e+97)) {
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 <= (-4.2d+46)) .or. (.not. (im <= 1.7d+97))) 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 <= -4.2e+46) || !(im <= 1.7e+97)) {
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 <= -4.2e+46) or not (im <= 1.7e+97): 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 <= -4.2e+46) || !(im <= 1.7e+97)) 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 <= -4.2e+46) || ~((im <= 1.7e+97))) tmp = ((im ^ 3.0) * -0.16666666666666666) - im; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.2e+46], N[Not[LessEqual[im, 1.7e+97]], $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 -4.2 \cdot 10^{+46} \lor \neg \left(im \leq 1.7 \cdot 10^{+97}\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -4.2e46 or 1.70000000000000005e97 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 90.7%
+-commutative90.7%
mul-1-neg90.7%
unsub-neg90.7%
associate-*r*90.7%
distribute-rgt-out--90.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in re around 0 69.5%
if -4.2e46 < im < 1.70000000000000005e97Initial program 24.7%
neg-sub024.7%
Simplified24.7%
Taylor expanded in im around 0 81.9%
associate-*r*81.9%
neg-mul-181.9%
Simplified81.9%
Final simplification77.5%
(FPCore (re im) :precision binary64 (if (or (<= im -1.48e+23) (not (<= im 1.7e+97))) (- (* (pow im 5.0) -0.008333333333333333) im) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -1.48e+23) || !(im <= 1.7e+97)) {
tmp = (pow(im, 5.0) * -0.008333333333333333) - 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 <= (-1.48d+23)) .or. (.not. (im <= 1.7d+97))) then
tmp = ((im ** 5.0d0) * (-0.008333333333333333d0)) - im
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.48e+23) || !(im <= 1.7e+97)) {
tmp = (Math.pow(im, 5.0) * -0.008333333333333333) - im;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.48e+23) or not (im <= 1.7e+97): tmp = (math.pow(im, 5.0) * -0.008333333333333333) - im else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.48e+23) || !(im <= 1.7e+97)) tmp = Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.48e+23) || ~((im <= 1.7e+97))) tmp = ((im ^ 5.0) * -0.008333333333333333) - im; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.48e+23], N[Not[LessEqual[im, 1.7e+97]], $MachinePrecision]], N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.48 \cdot 10^{+23} \lor \neg \left(im \leq 1.7 \cdot 10^{+97}\right):\\
\;\;\;\;{im}^{5} \cdot -0.008333333333333333 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -1.4799999999999999e23 or 1.70000000000000005e97 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 93.1%
Taylor expanded in im around inf 93.1%
Taylor expanded in re around inf 93.1%
*-commutative93.1%
associate-*r*93.1%
*-commutative93.1%
distribute-lft-in93.1%
associate-*r*93.1%
metadata-eval93.1%
associate-*r*93.1%
metadata-eval93.1%
mul-1-neg93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in re around 0 71.0%
if -1.4799999999999999e23 < im < 1.70000000000000005e97Initial program 22.3%
neg-sub022.3%
Simplified22.3%
Taylor expanded in im around 0 84.3%
associate-*r*84.3%
neg-mul-184.3%
Simplified84.3%
Final simplification79.3%
(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 51.1%
neg-sub051.1%
Simplified51.1%
Taylor expanded in im around 0 55.2%
associate-*r*55.2%
neg-mul-155.2%
Simplified55.2%
Final simplification55.2%
(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 51.1%
neg-sub051.1%
Simplified51.1%
Taylor expanded in im around 0 55.2%
associate-*r*55.2%
neg-mul-155.2%
Simplified55.2%
Taylor expanded in re around 0 30.8%
mul-1-neg30.8%
Simplified30.8%
Final simplification30.8%
(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 2023318
(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))))