
(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 13 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 (- INFINITY)) (not (<= t_0 0.0002)))
(* t_0 (* 0.5 (sin re)))
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0002)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.0002)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.0002): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0002)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.0002))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - 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, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 2.0000000000000001e-4Initial program 36.1%
Taylor expanded in im around 0 99.9%
associate-*r*99.9%
neg-mul-199.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in re around inf 99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -5.5e+102)
t_1
(if (<= im -0.035)
t_0
(if (<= im 3000000000.0)
(* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 5.6e+102) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+102) {
tmp = t_1;
} else if (im <= -0.035) {
tmp = t_0;
} else if (im <= 3000000000.0) {
tmp = sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
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 = (exp(-im) - exp(im)) * (0.5d0 * re)
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-5.5d+102)) then
tmp = t_1
else if (im <= (-0.035d0)) then
tmp = t_0
else if (im <= 3000000000.0d0) then
tmp = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else if (im <= 5.6d+102) 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 = (Math.exp(-im) - Math.exp(im)) * (0.5 * re);
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -5.5e+102) {
tmp = t_1;
} else if (im <= -0.035) {
tmp = t_0;
} else if (im <= 3000000000.0) {
tmp = Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 5.6e+102) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 * re) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -5.5e+102: tmp = t_1 elif im <= -0.035: tmp = t_0 elif im <= 3000000000.0: tmp = math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 5.6e+102: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 * re)) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.5e+102) tmp = t_1; elseif (im <= -0.035) tmp = t_0; elseif (im <= 3000000000.0) tmp = Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) - exp(im)) * (0.5 * re); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -5.5e+102) tmp = t_1; elseif (im <= -0.035) tmp = t_0; elseif (im <= 3000000000.0) tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); elseif (im <= 5.6e+102) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.5e+102], t$95$1, If[LessEqual[im, -0.035], t$95$0, If[LessEqual[im, 3000000000.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.6e+102], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.035:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3000000000:\\
\;\;\;\;\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.49999999999999981e102 or 5.60000000000000037e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -5.49999999999999981e102 < im < -0.035000000000000003 or 3e9 < im < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in re around 0 73.9%
associate-*r*73.9%
*-commutative73.9%
Simplified73.9%
if -0.035000000000000003 < im < 3e9Initial program 36.6%
Taylor expanded in im around 0 99.1%
associate-*r*99.1%
neg-mul-199.1%
associate-*r*99.1%
distribute-rgt-out99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in re around inf 99.1%
Final simplification94.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* im (- (* 0.16666666666666666 (pow re 3.0)) re)))
(t_1 (* (pow im 3.0) (* (sin re) -0.16666666666666666))))
(if (<= im -3.8e+88)
t_1
(if (<= im -2.1e+27)
t_0
(if (<= im 180000.0)
(* (- im) (sin re))
(if (<= im 3.3e+99) t_0 t_1))))))
double code(double re, double im) {
double t_0 = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
double t_1 = pow(im, 3.0) * (sin(re) * -0.16666666666666666);
double tmp;
if (im <= -3.8e+88) {
tmp = t_1;
} else if (im <= -2.1e+27) {
tmp = t_0;
} else if (im <= 180000.0) {
tmp = -im * sin(re);
} else if (im <= 3.3e+99) {
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 = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
t_1 = (im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))
if (im <= (-3.8d+88)) then
tmp = t_1
else if (im <= (-2.1d+27)) then
tmp = t_0
else if (im <= 180000.0d0) then
tmp = -im * sin(re)
else if (im <= 3.3d+99) 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 = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
double t_1 = Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666);
double tmp;
if (im <= -3.8e+88) {
tmp = t_1;
} else if (im <= -2.1e+27) {
tmp = t_0;
} else if (im <= 180000.0) {
tmp = -im * Math.sin(re);
} else if (im <= 3.3e+99) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) t_1 = math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666) tmp = 0 if im <= -3.8e+88: tmp = t_1 elif im <= -2.1e+27: tmp = t_0 elif im <= 180000.0: tmp = -im * math.sin(re) elif im <= 3.3e+99: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)) t_1 = Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) tmp = 0.0 if (im <= -3.8e+88) tmp = t_1; elseif (im <= -2.1e+27) tmp = t_0; elseif (im <= 180000.0) tmp = Float64(Float64(-im) * sin(re)); elseif (im <= 3.3e+99) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = im * ((0.16666666666666666 * (re ^ 3.0)) - re); t_1 = (im ^ 3.0) * (sin(re) * -0.16666666666666666); tmp = 0.0; if (im <= -3.8e+88) tmp = t_1; elseif (im <= -2.1e+27) tmp = t_0; elseif (im <= 180000.0) tmp = -im * sin(re); elseif (im <= 3.3e+99) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+88], t$95$1, If[LessEqual[im, -2.1e+27], t$95$0, If[LessEqual[im, 180000.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.3e+99], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
t_1 := {im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+88}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2.1 \cdot 10^{+27}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 180000:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 3.3 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -3.7999999999999997e88 or 3.2999999999999999e99 < im Initial program 100.0%
Taylor expanded in im around 0 97.0%
associate-*r*97.0%
neg-mul-197.0%
associate-*r*97.0%
distribute-rgt-out97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in im around inf 97.0%
*-commutative97.0%
associate-*l*97.0%
Simplified97.0%
if -3.7999999999999997e88 < im < -2.09999999999999995e27 or 1.8e5 < im < 3.2999999999999999e99Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 26.9%
+-commutative26.9%
mul-1-neg26.9%
unsub-neg26.9%
*-commutative26.9%
associate-*r*26.9%
*-commutative26.9%
distribute-rgt-out--35.4%
Simplified35.4%
if -2.09999999999999995e27 < im < 1.8e5Initial program 40.5%
Taylor expanded in im around 0 92.9%
associate-*r*92.9%
neg-mul-192.9%
Simplified92.9%
Final simplification86.5%
(FPCore (re im) :precision binary64 (* (sin re) (- (* -0.16666666666666666 (pow im 3.0)) im)))
double code(double re, double im) {
return sin(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
end function
public static double code(double re, double im) {
return Math.sin(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
def code(re, im): return math.sin(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im)
function code(re, im) return Float64(sin(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)) end
function tmp = code(re, im) tmp = sin(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)
\end{array}
Initial program 69.8%
Taylor expanded in im around 0 82.4%
associate-*r*82.4%
neg-mul-182.4%
associate-*r*82.4%
distribute-rgt-out82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in re around inf 82.4%
Final simplification82.4%
(FPCore (re im)
:precision binary64
(if (<= im -9.2e+81)
(* -0.16666666666666666 (* re (pow im 3.0)))
(if (<= im -9e+27)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (or (<= im -5.8e-5) (not (<= im 3.5e+68)))
(* re (- (* -0.16666666666666666 (pow im 3.0)) im))
(* (- im) (sin re))))))
double code(double re, double im) {
double tmp;
if (im <= -9.2e+81) {
tmp = -0.16666666666666666 * (re * pow(im, 3.0));
} else if (im <= -9e+27) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if ((im <= -5.8e-5) || !(im <= 3.5e+68)) {
tmp = re * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} 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 <= (-9.2d+81)) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else if (im <= (-9d+27)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if ((im <= (-5.8d-5)) .or. (.not. (im <= 3.5d+68))) then
tmp = re * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -9.2e+81) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else if (im <= -9e+27) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if ((im <= -5.8e-5) || !(im <= 3.5e+68)) {
tmp = re * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -9.2e+81: tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) elif im <= -9e+27: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif (im <= -5.8e-5) or not (im <= 3.5e+68): tmp = re * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -9.2e+81) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); elseif (im <= -9e+27) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif ((im <= -5.8e-5) || !(im <= 3.5e+68)) tmp = Float64(re * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -9.2e+81) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); elseif (im <= -9e+27) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif ((im <= -5.8e-5) || ~((im <= 3.5e+68))) tmp = re * ((-0.16666666666666666 * (im ^ 3.0)) - im); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -9.2e+81], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -9e+27], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -5.8e-5], N[Not[LessEqual[im, 3.5e+68]], $MachinePrecision]], N[(re * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -9.2 \cdot 10^{+81}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{elif}\;im \leq -9 \cdot 10^{+27}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq -5.8 \cdot 10^{-5} \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -9.1999999999999995e81Initial program 100.0%
Taylor expanded in im around 0 95.7%
associate-*r*95.7%
neg-mul-195.7%
associate-*r*95.7%
distribute-rgt-out95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in re around 0 74.4%
Taylor expanded in im around inf 74.4%
if -9.1999999999999995e81 < im < -8.9999999999999998e27Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 34.4%
+-commutative34.4%
mul-1-neg34.4%
unsub-neg34.4%
*-commutative34.4%
associate-*r*34.4%
*-commutative34.4%
distribute-rgt-out--41.1%
Simplified41.1%
if -8.9999999999999998e27 < im < -5.8e-5 or 3.49999999999999977e68 < im Initial program 99.7%
Taylor expanded in im around 0 76.2%
associate-*r*76.2%
neg-mul-176.2%
associate-*r*76.2%
distribute-rgt-out76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in re around 0 66.3%
if -5.8e-5 < im < 3.49999999999999977e68Initial program 42.4%
Taylor expanded in im around 0 89.7%
associate-*r*89.7%
neg-mul-189.7%
Simplified89.7%
Final simplification78.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
(if (<= im -3.8e+83)
t_0
(if (<= im -1.14e+33)
(* im (* 0.16666666666666666 (pow re 3.0)))
(if (or (<= im -55.0) (not (<= im 3.5e+68)))
t_0
(* (- im) (sin re)))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double tmp;
if (im <= -3.8e+83) {
tmp = t_0;
} else if (im <= -1.14e+33) {
tmp = im * (0.16666666666666666 * pow(re, 3.0));
} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
if (im <= (-3.8d+83)) then
tmp = t_0
else if (im <= (-1.14d+33)) then
tmp = im * (0.16666666666666666d0 * (re ** 3.0d0))
else if ((im <= (-55.0d0)) .or. (.not. (im <= 3.5d+68))) then
tmp = t_0
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * Math.pow(im, 3.0));
double tmp;
if (im <= -3.8e+83) {
tmp = t_0;
} else if (im <= -1.14e+33) {
tmp = im * (0.16666666666666666 * Math.pow(re, 3.0));
} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
tmp = t_0;
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) tmp = 0 if im <= -3.8e+83: tmp = t_0 elif im <= -1.14e+33: tmp = im * (0.16666666666666666 * math.pow(re, 3.0)) elif (im <= -55.0) or not (im <= 3.5e+68): tmp = t_0 else: tmp = -im * math.sin(re) return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) tmp = 0.0 if (im <= -3.8e+83) tmp = t_0; elseif (im <= -1.14e+33) tmp = Float64(im * Float64(0.16666666666666666 * (re ^ 3.0))); elseif ((im <= -55.0) || !(im <= 3.5e+68)) tmp = t_0; else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); tmp = 0.0; if (im <= -3.8e+83) tmp = t_0; elseif (im <= -1.14e+33) tmp = im * (0.16666666666666666 * (re ^ 3.0)); elseif ((im <= -55.0) || ~((im <= 3.5e+68))) tmp = t_0; else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+83], t$95$0, If[LessEqual[im, -1.14e+33], N[(im * N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -55.0], N[Not[LessEqual[im, 3.5e+68]], $MachinePrecision]], t$95$0, N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+83}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -1.14 \cdot 10^{+33}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3}\right)\\
\mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -3.8000000000000002e83 or -1.14e33 < im < -55 or 3.49999999999999977e68 < im Initial program 100.0%
Taylor expanded in im around 0 83.9%
associate-*r*83.9%
neg-mul-183.9%
associate-*r*83.9%
distribute-rgt-out83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in re around 0 69.2%
Taylor expanded in im around inf 69.2%
if -3.8000000000000002e83 < im < -1.14e33Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 34.4%
+-commutative34.4%
mul-1-neg34.4%
unsub-neg34.4%
*-commutative34.4%
associate-*r*34.4%
*-commutative34.4%
distribute-rgt-out--41.1%
Simplified41.1%
Taylor expanded in re around inf 40.9%
if -55 < im < 3.49999999999999977e68Initial program 42.7%
Taylor expanded in im around 0 89.6%
associate-*r*89.6%
neg-mul-189.6%
Simplified89.6%
Final simplification78.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (* re (pow im 3.0)))))
(if (<= im -1.55e+83)
t_0
(if (<= im -3.5e+30)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (or (<= im -55.0) (not (<= im 3.5e+68)))
t_0
(* (- im) (sin re)))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * pow(im, 3.0));
double tmp;
if (im <= -1.55e+83) {
tmp = t_0;
} else if (im <= -3.5e+30) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
if (im <= (-1.55d+83)) then
tmp = t_0
else if (im <= (-3.5d+30)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if ((im <= (-55.0d0)) .or. (.not. (im <= 3.5d+68))) then
tmp = t_0
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * (re * Math.pow(im, 3.0));
double tmp;
if (im <= -1.55e+83) {
tmp = t_0;
} else if (im <= -3.5e+30) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if ((im <= -55.0) || !(im <= 3.5e+68)) {
tmp = t_0;
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * (re * math.pow(im, 3.0)) tmp = 0 if im <= -1.55e+83: tmp = t_0 elif im <= -3.5e+30: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif (im <= -55.0) or not (im <= 3.5e+68): tmp = t_0 else: tmp = -im * math.sin(re) return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))) tmp = 0.0 if (im <= -1.55e+83) tmp = t_0; elseif (im <= -3.5e+30) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif ((im <= -55.0) || !(im <= 3.5e+68)) tmp = t_0; else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (re * (im ^ 3.0)); tmp = 0.0; if (im <= -1.55e+83) tmp = t_0; elseif (im <= -3.5e+30) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif ((im <= -55.0) || ~((im <= 3.5e+68))) tmp = t_0; else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.55e+83], t$95$0, If[LessEqual[im, -3.5e+30], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -55.0], N[Not[LessEqual[im, 3.5e+68]], $MachinePrecision]], t$95$0, N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{if}\;im \leq -1.55 \cdot 10^{+83}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -3.5 \cdot 10^{+30}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -1.54999999999999996e83 or -3.50000000000000021e30 < im < -55 or 3.49999999999999977e68 < im Initial program 100.0%
Taylor expanded in im around 0 83.9%
associate-*r*83.9%
neg-mul-183.9%
associate-*r*83.9%
distribute-rgt-out83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in re around 0 69.2%
Taylor expanded in im around inf 69.2%
if -1.54999999999999996e83 < im < -3.50000000000000021e30Initial program 100.0%
Taylor expanded in im around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in re around 0 34.4%
+-commutative34.4%
mul-1-neg34.4%
unsub-neg34.4%
*-commutative34.4%
associate-*r*34.4%
*-commutative34.4%
distribute-rgt-out--41.1%
Simplified41.1%
if -55 < im < 3.49999999999999977e68Initial program 42.7%
Taylor expanded in im around 0 89.6%
associate-*r*89.6%
neg-mul-189.6%
Simplified89.6%
Final simplification78.3%
(FPCore (re im) :precision binary64 (if (or (<= im -55.0) (not (<= im 3.5e+68))) (* -0.16666666666666666 (* re (pow im 3.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -55.0) || !(im <= 3.5e+68)) {
tmp = -0.16666666666666666 * (re * pow(im, 3.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 <= (-55.0d0)) .or. (.not. (im <= 3.5d+68))) then
tmp = (-0.16666666666666666d0) * (re * (im ** 3.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -55.0) || !(im <= 3.5e+68)) {
tmp = -0.16666666666666666 * (re * Math.pow(im, 3.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -55.0) or not (im <= 3.5e+68): tmp = -0.16666666666666666 * (re * math.pow(im, 3.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -55.0) || !(im <= 3.5e+68)) tmp = Float64(-0.16666666666666666 * Float64(re * (im ^ 3.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -55.0) || ~((im <= 3.5e+68))) tmp = -0.16666666666666666 * (re * (im ^ 3.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -55.0], N[Not[LessEqual[im, 3.5e+68]], $MachinePrecision]], N[(-0.16666666666666666 * N[(re * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -55 \lor \neg \left(im \leq 3.5 \cdot 10^{+68}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(re \cdot {im}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -55 or 3.49999999999999977e68 < im Initial program 100.0%
Taylor expanded in im around 0 74.1%
associate-*r*74.1%
neg-mul-174.1%
associate-*r*74.1%
distribute-rgt-out74.1%
*-commutative74.1%
Simplified74.1%
Taylor expanded in re around 0 61.7%
Taylor expanded in im around inf 61.7%
if -55 < im < 3.49999999999999977e68Initial program 42.7%
Taylor expanded in im around 0 89.6%
associate-*r*89.6%
neg-mul-189.6%
Simplified89.6%
Final simplification76.4%
(FPCore (re im) :precision binary64 (if (<= im 9.5e+75) (* (- im) (sin re)) (* im (- re))))
double code(double re, double im) {
double tmp;
if (im <= 9.5e+75) {
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 <= 9.5d+75) 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 <= 9.5e+75) {
tmp = -im * Math.sin(re);
} else {
tmp = im * -re;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.5e+75: tmp = -im * math.sin(re) else: tmp = im * -re return tmp
function code(re, im) tmp = 0.0 if (im <= 9.5e+75) 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 <= 9.5e+75) tmp = -im * sin(re); else tmp = im * -re; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.5e+75], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], N[(im * (-re)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.5 \cdot 10^{+75}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-re\right)\\
\end{array}
\end{array}
if im < 9.50000000000000061e75Initial program 62.1%
Taylor expanded in im around 0 60.8%
associate-*r*60.8%
neg-mul-160.8%
Simplified60.8%
if 9.50000000000000061e75 < im Initial program 100.0%
Taylor expanded in im around 0 4.8%
associate-*r*4.8%
neg-mul-14.8%
Simplified4.8%
Taylor expanded in re around 0 16.4%
associate-*r*16.4%
neg-mul-116.4%
Simplified16.4%
Final simplification51.7%
(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 69.8%
Taylor expanded in im around 0 49.4%
associate-*r*49.4%
neg-mul-149.4%
Simplified49.4%
Taylor expanded in re around 0 32.8%
associate-*r*32.8%
neg-mul-132.8%
Simplified32.8%
Final simplification32.8%
(FPCore (re im) :precision binary64 -3.0)
double code(double re, double im) {
return -3.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -3.0d0
end function
public static double code(double re, double im) {
return -3.0;
}
def code(re, im): return -3.0
function code(re, im) return -3.0 end
function tmp = code(re, im) tmp = -3.0; end
code[re_, im_] := -3.0
\begin{array}{l}
\\
-3
\end{array}
Initial program 69.8%
Taylor expanded in im around 0 49.4%
associate-*r*49.4%
neg-mul-149.4%
Simplified49.4%
Applied egg-rr2.7%
Final simplification2.7%
(FPCore (re im) :precision binary64 -0.004629629629629629)
double code(double re, double im) {
return -0.004629629629629629;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -0.004629629629629629d0
end function
public static double code(double re, double im) {
return -0.004629629629629629;
}
def code(re, im): return -0.004629629629629629
function code(re, im) return -0.004629629629629629 end
function tmp = code(re, im) tmp = -0.004629629629629629; end
code[re_, im_] := -0.004629629629629629
\begin{array}{l}
\\
-0.004629629629629629
\end{array}
Initial program 69.8%
Taylor expanded in im around 0 49.4%
associate-*r*49.4%
neg-mul-149.4%
Simplified49.4%
Applied egg-rr2.7%
Final simplification2.7%
(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 69.8%
Taylor expanded in im around 0 49.4%
associate-*r*49.4%
neg-mul-149.4%
Simplified49.4%
Applied egg-rr17.0%
Final simplification17.0%
(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 2023308
(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))))