
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -5e+66) (not (<= t_0 2e-5)))
(* t_0 (* 0.5 (sin re)))
(*
(sin re)
(+
(- (* (pow im 5.0) -0.008333333333333333) im)
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 3.0) -0.16666666666666666)))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -5e+66) || !(t_0 <= 2e-5)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * (((pow(im, 5.0) * -0.008333333333333333) - im) + ((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 3.0) * -0.16666666666666666)));
}
return tmp;
}
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 <= (-5d+66)) .or. (.not. (t_0 <= 2d-5))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(re) * ((((im ** 5.0d0) * (-0.008333333333333333d0)) - im) + (((im ** 7.0d0) * (-0.0001984126984126984d0)) + ((im ** 3.0d0) * (-0.16666666666666666d0))))
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 <= -5e+66) || !(t_0 <= 2e-5)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) - im) + ((Math.pow(im, 7.0) * -0.0001984126984126984) + (Math.pow(im, 3.0) * -0.16666666666666666)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -5e+66) or not (t_0 <= 2e-5): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * (((math.pow(im, 5.0) * -0.008333333333333333) - im) + ((math.pow(im, 7.0) * -0.0001984126984126984) + (math.pow(im, 3.0) * -0.16666666666666666))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -5e+66) || !(t_0 <= 2e-5)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im) + Float64(Float64((im ^ 7.0) * -0.0001984126984126984) + Float64((im ^ 3.0) * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -5e+66) || ~((t_0 <= 2e-5))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((((im ^ 5.0) * -0.008333333333333333) - im) + (((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 3.0) * -0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e+66], N[Not[LessEqual[t$95$0, 2e-5]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision] + N[(N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+66} \lor \neg \left(t_0 \leq 2 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + {im}^{3} \cdot -0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -4.99999999999999991e66 or 2.00000000000000016e-5 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -4.99999999999999991e66 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 2.00000000000000016e-5Initial program 31.0%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
+-commutative99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.05) (not (<= t_0 2e-5)))
(* t_0 (* 0.5 (sin re)))
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -0.05) || !(t_0 <= 2e-5)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(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.05d0)) .or. (.not. (t_0 <= 2d-5))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = sin(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.05) || !(t_0 <= 2e-5)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -0.05) or not (t_0 <= 2e-5): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -0.05) || !(t_0 <= 2e-5)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -0.05) || ~((t_0 <= 2e-5))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.05], N[Not[LessEqual[t$95$0, 2e-5]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.05 \lor \neg \left(t_0 \leq 2 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -0.050000000000000003 or 2.00000000000000016e-5 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -0.050000000000000003 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 2.00000000000000016e-5Initial program 30.4%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (- (exp (- im)) (exp im)) re)))
(t_1 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -1.05e+44)
t_1
(if (<= im -0.0013)
t_0
(if (<= im 0.0015) (* (- im) (sin re)) (if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
double t_1 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -1.05e+44) {
tmp = t_1;
} else if (im <= -0.0013) {
tmp = t_0;
} else if (im <= 0.0015) {
tmp = -im * sin(re);
} else if (im <= 1.1e+44) {
tmp = t_0;
} 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 = 0.5d0 * ((exp(-im) - exp(im)) * re)
t_1 = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
if (im <= (-1.05d+44)) then
tmp = t_1
else if (im <= (-0.0013d0)) then
tmp = t_0
else if (im <= 0.0015d0) then
tmp = -im * sin(re)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
double t_1 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.05e+44) {
tmp = t_1;
} else if (im <= -0.0013) {
tmp = t_0;
} else if (im <= 0.0015) {
tmp = -im * Math.sin(re);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((math.exp(-im) - math.exp(im)) * re) t_1 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.05e+44: tmp = t_1 elif im <= -0.0013: tmp = t_0 elif im <= 0.0015: tmp = -im * math.sin(re) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re)) t_1 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.05e+44) tmp = t_1; elseif (im <= -0.0013) tmp = t_0; elseif (im <= 0.0015) tmp = Float64(Float64(-im) * sin(re)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((exp(-im) - exp(im)) * re); t_1 = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.05e+44) tmp = t_1; elseif (im <= -0.0013) tmp = t_0; elseif (im <= 0.0015) tmp = -im * sin(re); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.05e+44], t$95$1, If[LessEqual[im, -0.0013], t$95$0, If[LessEqual[im, 0.0015], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.05 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0013:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0015:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.04999999999999993e44 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
+-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1.04999999999999993e44 < im < -0.0012999999999999999 or 0.0015 < im < 1.09999999999999998e44Initial program 99.7%
Taylor expanded in re around 0 73.5%
if -0.0012999999999999999 < im < 0.0015Initial program 30.4%
Taylor expanded in im around 0 99.3%
mul-1-neg99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
Simplified99.3%
Final simplification97.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* (- (exp (- im)) (exp im)) re)))
(t_1 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -1.05e+44)
t_1
(if (<= im -0.095)
t_0
(if (<= im 0.023)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * ((exp(-im) - exp(im)) * re);
double t_1 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -1.05e+44) {
tmp = t_1;
} else if (im <= -0.095) {
tmp = t_0;
} else if (im <= 0.023) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} 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 = 0.5d0 * ((exp(-im) - exp(im)) * re)
t_1 = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
if (im <= (-1.05d+44)) then
tmp = t_1
else if (im <= (-0.095d0)) then
tmp = t_0
else if (im <= 0.023d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * ((Math.exp(-im) - Math.exp(im)) * re);
double t_1 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.05e+44) {
tmp = t_1;
} else if (im <= -0.095) {
tmp = t_0;
} else if (im <= 0.023) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * ((math.exp(-im) - math.exp(im)) * re) t_1 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.05e+44: tmp = t_1 elif im <= -0.095: tmp = t_0 elif im <= 0.023: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(Float64(exp(Float64(-im)) - exp(im)) * re)) t_1 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.05e+44) tmp = t_1; elseif (im <= -0.095) tmp = t_0; elseif (im <= 0.023) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * ((exp(-im) - exp(im)) * re); t_1 = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.05e+44) tmp = t_1; elseif (im <= -0.095) tmp = t_0; elseif (im <= 0.023) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.05e+44], t$95$1, If[LessEqual[im, -0.095], t$95$0, If[LessEqual[im, 0.023], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\left(e^{-im} - e^{im}\right) \cdot re\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.05 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.095:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.023:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.04999999999999993e44 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
+-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1.04999999999999993e44 < im < -0.095000000000000001 or 0.023 < im < 1.09999999999999998e44Initial program 99.7%
Taylor expanded in re around 0 73.5%
if -0.095000000000000001 < im < 0.023Initial program 30.4%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification97.9%
(FPCore (re im) :precision binary64 (if (or (<= im -4.2) (not (<= im 4.2))) (* -0.0001984126984126984 (* (sin re) (pow im 7.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -4.2) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
} else {
tmp = -im * sin(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.2d0)) .or. (.not. (im <= 4.2d0))) then
tmp = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -4.2) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -4.2) or not (im <= 4.2): tmp = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -4.2) || !(im <= 4.2)) tmp = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -4.2) || ~((im <= 4.2))) tmp = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.2], N[Not[LessEqual[im, 4.2]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.2 \lor \neg \left(im \leq 4.2\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -4.20000000000000018 or 4.20000000000000018 < im Initial program 100.0%
Taylor expanded in im around 0 87.2%
associate-+r+87.2%
+-commutative87.2%
+-commutative87.2%
mul-1-neg87.2%
*-commutative87.2%
distribute-lft-neg-in87.2%
*-commutative87.2%
associate-*r*87.2%
distribute-rgt-out87.2%
*-commutative87.2%
associate-*r*87.2%
*-commutative87.2%
associate-*r*87.2%
Simplified87.2%
Taylor expanded in im around inf 87.2%
*-commutative87.2%
Simplified87.2%
if -4.20000000000000018 < im < 4.20000000000000018Initial program 31.0%
Taylor expanded in im around 0 98.8%
mul-1-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Final simplification92.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.0001984126984126984 (* re (pow im 7.0))))
(t_1
(*
(pow im 7.0)
(*
re
(+ -0.0001984126984126984 (* 3.306878306878307e-5 (* re re)))))))
(if (<= im -2.3e+95)
t_1
(if (<= im -5e+50)
t_0
(if (<= im -5.3e+14)
t_1
(if (<= im 4.8e+17) (* (- im) (sin re)) t_0))))))
double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (re * pow(im, 7.0));
double t_1 = pow(im, 7.0) * (re * (-0.0001984126984126984 + (3.306878306878307e-5 * (re * re))));
double tmp;
if (im <= -2.3e+95) {
tmp = t_1;
} else if (im <= -5e+50) {
tmp = t_0;
} else if (im <= -5.3e+14) {
tmp = t_1;
} else if (im <= 4.8e+17) {
tmp = -im * sin(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) :: t_1
real(8) :: tmp
t_0 = (-0.0001984126984126984d0) * (re * (im ** 7.0d0))
t_1 = (im ** 7.0d0) * (re * ((-0.0001984126984126984d0) + (3.306878306878307d-5 * (re * re))))
if (im <= (-2.3d+95)) then
tmp = t_1
else if (im <= (-5d+50)) then
tmp = t_0
else if (im <= (-5.3d+14)) then
tmp = t_1
else if (im <= 4.8d+17) then
tmp = -im * sin(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (re * Math.pow(im, 7.0));
double t_1 = Math.pow(im, 7.0) * (re * (-0.0001984126984126984 + (3.306878306878307e-5 * (re * re))));
double tmp;
if (im <= -2.3e+95) {
tmp = t_1;
} else if (im <= -5e+50) {
tmp = t_0;
} else if (im <= -5.3e+14) {
tmp = t_1;
} else if (im <= 4.8e+17) {
tmp = -im * Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.0001984126984126984 * (re * math.pow(im, 7.0)) t_1 = math.pow(im, 7.0) * (re * (-0.0001984126984126984 + (3.306878306878307e-5 * (re * re)))) tmp = 0 if im <= -2.3e+95: tmp = t_1 elif im <= -5e+50: tmp = t_0 elif im <= -5.3e+14: tmp = t_1 elif im <= 4.8e+17: tmp = -im * math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.0001984126984126984 * Float64(re * (im ^ 7.0))) t_1 = Float64((im ^ 7.0) * Float64(re * Float64(-0.0001984126984126984 + Float64(3.306878306878307e-5 * Float64(re * re))))) tmp = 0.0 if (im <= -2.3e+95) tmp = t_1; elseif (im <= -5e+50) tmp = t_0; elseif (im <= -5.3e+14) tmp = t_1; elseif (im <= 4.8e+17) tmp = Float64(Float64(-im) * sin(re)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = -0.0001984126984126984 * (re * (im ^ 7.0)); t_1 = (im ^ 7.0) * (re * (-0.0001984126984126984 + (3.306878306878307e-5 * (re * re)))); tmp = 0.0; if (im <= -2.3e+95) tmp = t_1; elseif (im <= -5e+50) tmp = t_0; elseif (im <= -5.3e+14) tmp = t_1; elseif (im <= 4.8e+17) tmp = -im * sin(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(re * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(re * N[(-0.0001984126984126984 + N[(3.306878306878307e-5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.3e+95], t$95$1, If[LessEqual[im, -5e+50], t$95$0, If[LessEqual[im, -5.3e+14], t$95$1, If[LessEqual[im, 4.8e+17], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(re \cdot {im}^{7}\right)\\
t_1 := {im}^{7} \cdot \left(re \cdot \left(-0.0001984126984126984 + 3.306878306878307 \cdot 10^{-5} \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{if}\;im \leq -2.3 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -5 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -5.3 \cdot 10^{+14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+17}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.29999999999999997e95 or -5e50 < im < -5.3e14Initial program 100.0%
Taylor expanded in im around 0 91.1%
associate-+r+91.1%
+-commutative91.1%
+-commutative91.1%
mul-1-neg91.1%
*-commutative91.1%
distribute-lft-neg-in91.1%
*-commutative91.1%
associate-*r*91.1%
distribute-rgt-out91.1%
*-commutative91.1%
associate-*r*91.1%
*-commutative91.1%
associate-*r*91.1%
Simplified91.1%
Taylor expanded in im around inf 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in re around 0 2.0%
associate-*r*2.0%
*-commutative2.0%
associate-*r*2.0%
distribute-rgt-out87.2%
*-commutative87.2%
unpow387.2%
unpow287.2%
associate-*r*87.2%
distribute-rgt-out87.2%
unpow287.2%
Simplified87.2%
if -2.29999999999999997e95 < im < -5e50 or 4.8e17 < im Initial program 100.0%
Taylor expanded in im around 0 91.0%
associate-+r+91.0%
+-commutative91.0%
+-commutative91.0%
mul-1-neg91.0%
*-commutative91.0%
distribute-lft-neg-in91.0%
*-commutative91.0%
associate-*r*91.0%
distribute-rgt-out91.0%
*-commutative91.0%
associate-*r*91.0%
*-commutative91.0%
associate-*r*91.0%
Simplified91.0%
Taylor expanded in re around 0 78.8%
Taylor expanded in im around inf 78.8%
if -5.3e14 < im < 4.8e17Initial program 34.2%
Taylor expanded in im around 0 94.3%
mul-1-neg94.3%
*-commutative94.3%
distribute-rgt-neg-in94.3%
Simplified94.3%
Final simplification88.3%
(FPCore (re im) :precision binary64 (if (or (<= im -30000.0) (not (<= im 4.5e+17))) (* -0.0001984126984126984 (* re (pow im 7.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -30000.0) || !(im <= 4.5e+17)) {
tmp = -0.0001984126984126984 * (re * pow(im, 7.0));
} else {
tmp = -im * sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-30000.0d0)) .or. (.not. (im <= 4.5d+17))) then
tmp = (-0.0001984126984126984d0) * (re * (im ** 7.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -30000.0) || !(im <= 4.5e+17)) {
tmp = -0.0001984126984126984 * (re * Math.pow(im, 7.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -30000.0) or not (im <= 4.5e+17): tmp = -0.0001984126984126984 * (re * math.pow(im, 7.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -30000.0) || !(im <= 4.5e+17)) tmp = Float64(-0.0001984126984126984 * Float64(re * (im ^ 7.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -30000.0) || ~((im <= 4.5e+17))) tmp = -0.0001984126984126984 * (re * (im ^ 7.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -30000.0], N[Not[LessEqual[im, 4.5e+17]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(re * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -30000 \lor \neg \left(im \leq 4.5 \cdot 10^{+17}\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -3e4 or 4.5e17 < im Initial program 100.0%
Taylor expanded in im around 0 89.1%
associate-+r+89.1%
+-commutative89.1%
+-commutative89.1%
mul-1-neg89.1%
*-commutative89.1%
distribute-lft-neg-in89.1%
*-commutative89.1%
associate-*r*89.1%
distribute-rgt-out89.1%
*-commutative89.1%
associate-*r*89.1%
*-commutative89.1%
associate-*r*89.1%
Simplified89.1%
Taylor expanded in re around 0 73.0%
Taylor expanded in im around inf 73.0%
if -3e4 < im < 4.5e17Initial program 32.6%
Taylor expanded in im around 0 96.5%
mul-1-neg96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
Simplified96.5%
Final simplification84.5%
(FPCore (re im) :precision binary64 (if (<= im -5.3e+14) (sqrt (* (* re re) 182.25)) (if (<= im 2.5e+32) (* (- im) (sin re)) (* im (- re)))))
double code(double re, double im) {
double tmp;
if (im <= -5.3e+14) {
tmp = sqrt(((re * re) * 182.25));
} else if (im <= 2.5e+32) {
tmp = -im * sin(re);
} else {
tmp = im * -re;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-5.3d+14)) then
tmp = sqrt(((re * re) * 182.25d0))
else if (im <= 2.5d+32) then
tmp = -im * sin(re)
else
tmp = im * -re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -5.3e+14) {
tmp = Math.sqrt(((re * re) * 182.25));
} else if (im <= 2.5e+32) {
tmp = -im * Math.sin(re);
} else {
tmp = im * -re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -5.3e+14: tmp = math.sqrt(((re * re) * 182.25)) elif im <= 2.5e+32: tmp = -im * math.sin(re) else: tmp = im * -re return tmp
function code(re, im) tmp = 0.0 if (im <= -5.3e+14) tmp = sqrt(Float64(Float64(re * re) * 182.25)); elseif (im <= 2.5e+32) tmp = Float64(Float64(-im) * sin(re)); else tmp = Float64(im * Float64(-re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -5.3e+14) tmp = sqrt(((re * re) * 182.25)); elseif (im <= 2.5e+32) tmp = -im * sin(re); else tmp = im * -re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -5.3e+14], N[Sqrt[N[(N[(re * re), $MachinePrecision] * 182.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 2.5e+32], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(im * (-re)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.3 \cdot 10^{+14}:\\
\;\;\;\;\sqrt{\left(re \cdot re\right) \cdot 182.25}\\
\mathbf{elif}\;im \leq 2.5 \cdot 10^{+32}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-re\right)\\
\end{array}
\end{array}
if im < -5.3e14Initial program 100.0%
Taylor expanded in re around 0 79.4%
Applied egg-rr2.2%
add-sqr-sqrt1.1%
sqrt-unprod11.7%
associate-*r*11.7%
associate-*r*11.7%
swap-sqr11.7%
metadata-eval11.7%
metadata-eval11.7%
metadata-eval11.7%
Applied egg-rr11.7%
if -5.3e14 < im < 2.4999999999999999e32Initial program 36.2%
Taylor expanded in im around 0 91.5%
mul-1-neg91.5%
*-commutative91.5%
distribute-rgt-neg-in91.5%
Simplified91.5%
if 2.4999999999999999e32 < im Initial program 100.0%
Taylor expanded in re around 0 82.1%
Taylor expanded in im around 0 23.9%
mul-1-neg23.9%
distribute-rgt-neg-in23.9%
Simplified23.9%
Final simplification55.6%
(FPCore (re im) :precision binary64 (if (<= im 2.4e+31) (* (- im) (sin re)) (* im (- re))))
double code(double re, double im) {
double tmp;
if (im <= 2.4e+31) {
tmp = -im * sin(re);
} else {
tmp = im * -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.4d+31) then
tmp = -im * sin(re)
else
tmp = im * -re
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.4e+31) {
tmp = -im * Math.sin(re);
} else {
tmp = im * -re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.4e+31: tmp = -im * math.sin(re) else: tmp = im * -re return tmp
function code(re, im) tmp = 0.0 if (im <= 2.4e+31) tmp = Float64(Float64(-im) * sin(re)); else tmp = Float64(im * Float64(-re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.4e+31) tmp = -im * sin(re); else tmp = im * -re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.4e+31], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(im * (-re)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.4 \cdot 10^{+31}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-re\right)\\
\end{array}
\end{array}
if im < 2.39999999999999982e31Initial program 57.9%
Taylor expanded in im around 0 61.9%
mul-1-neg61.9%
*-commutative61.9%
distribute-rgt-neg-in61.9%
Simplified61.9%
if 2.39999999999999982e31 < im Initial program 100.0%
Taylor expanded in re around 0 82.1%
Taylor expanded in im around 0 23.9%
mul-1-neg23.9%
distribute-rgt-neg-in23.9%
Simplified23.9%
Final simplification53.6%
(FPCore (re im) :precision binary64 (* im (- re)))
double code(double re, double im) {
return im * -re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * -re
end function
public static double code(double re, double im) {
return im * -re;
}
def code(re, im): return im * -re
function code(re, im) return Float64(im * Float64(-re)) end
function tmp = code(re, im) tmp = im * -re; end
code[re_, im_] := N[(im * (-re)), $MachinePrecision]
\begin{array}{l}
\\
im \cdot \left(-re\right)
\end{array}
Initial program 67.1%
Taylor expanded in re around 0 56.1%
Taylor expanded in im around 0 30.3%
mul-1-neg30.3%
distribute-rgt-neg-in30.3%
Simplified30.3%
Final simplification30.3%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 67.1%
Taylor expanded in re around 0 56.1%
expm1-log1p-u34.3%
expm1-udef33.5%
add-sqr-sqrt16.0%
sqrt-unprod24.1%
sqr-neg24.1%
sqrt-unprod8.2%
add-sqr-sqrt14.0%
Applied egg-rr14.0%
expm1-def14.0%
expm1-log1p14.0%
+-inverses14.4%
mul0-lft14.4%
metadata-eval14.4%
Simplified14.4%
Final simplification14.4%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(sin re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (abs(im) < 1.0d0) then
tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.abs(im) < 1.0) {
tmp = -(Math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(sin(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im)))); else tmp = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * sin(re)) * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023240
(FPCore (re im)
:name "math.cos on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (sin re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
(* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))