
(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 18 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 -0.2) (not (<= t_0 1e-7)))
(* t_0 (* 0.5 (sin re)))
(- (* (pow im 3.0) (* (sin re) -0.16666666666666666)) (* im (sin re))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -0.2) || !(t_0 <= 1e-7)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = (pow(im, 3.0) * (sin(re) * -0.16666666666666666)) - (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 = exp(-im) - exp(im)
if ((t_0 <= (-0.2d0)) .or. (.not. (t_0 <= 1d-7))) then
tmp = t_0 * (0.5d0 * sin(re))
else
tmp = ((im ** 3.0d0) * (sin(re) * (-0.16666666666666666d0))) - (im * sin(re))
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.2) || !(t_0 <= 1e-7)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = (Math.pow(im, 3.0) * (Math.sin(re) * -0.16666666666666666)) - (im * Math.sin(re));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -0.2) or not (t_0 <= 1e-7): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = (math.pow(im, 3.0) * (math.sin(re) * -0.16666666666666666)) - (im * math.sin(re)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -0.2) || !(t_0 <= 1e-7)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(Float64((im ^ 3.0) * Float64(sin(re) * -0.16666666666666666)) - Float64(im * sin(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -0.2) || ~((t_0 <= 1e-7))) tmp = t_0 * (0.5 * sin(re)); else tmp = ((im ^ 3.0) * (sin(re) * -0.16666666666666666)) - (im * sin(re)); 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.2], N[Not[LessEqual[t$95$0, 1e-7]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(im * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.2 \lor \neg \left(t_0 \leq 10^{-7}\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot \left(\sin re \cdot -0.16666666666666666\right) - im \cdot \sin re\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -0.20000000000000001 or 9.9999999999999995e-8 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 9.9999999999999995e-8Initial program 30.9%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.2) (not (<= t_0 1e-7)))
(* 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.2) || !(t_0 <= 1e-7)) {
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.2d0)) .or. (.not. (t_0 <= 1d-7))) 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.2) || !(t_0 <= 1e-7)) {
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.2) or not (t_0 <= 1e-7): 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.2) || !(t_0 <= 1e-7)) 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.2) || ~((t_0 <= 1e-7))) 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.2], N[Not[LessEqual[t$95$0, 1e-7]], $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.2 \lor \neg \left(t_0 \leq 10^{-7}\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.20000000000000001 or 9.9999999999999995e-8 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) Initial program 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 9.9999999999999995e-8Initial program 30.9%
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 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* (pow im 3.0) -0.16666666666666666))
(t_2 (* (sin re) t_1)))
(if (<= im -2.35e+103)
t_2
(if (<= im -0.024)
t_0
(if (<= im 0.043)
(* (sin re) (- t_1 im))
(if (<= im 2e+102) t_0 t_2))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = pow(im, 3.0) * -0.16666666666666666;
double t_2 = sin(re) * t_1;
double tmp;
if (im <= -2.35e+103) {
tmp = t_2;
} else if (im <= -0.024) {
tmp = t_0;
} else if (im <= 0.043) {
tmp = sin(re) * (t_1 - im);
} else if (im <= 2e+102) {
tmp = t_0;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = (exp(-im) - exp(im)) * (0.5d0 * re)
t_1 = (im ** 3.0d0) * (-0.16666666666666666d0)
t_2 = sin(re) * t_1
if (im <= (-2.35d+103)) then
tmp = t_2
else if (im <= (-0.024d0)) then
tmp = t_0
else if (im <= 0.043d0) then
tmp = sin(re) * (t_1 - im)
else if (im <= 2d+102) then
tmp = t_0
else
tmp = t_2
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) * -0.16666666666666666;
double t_2 = Math.sin(re) * t_1;
double tmp;
if (im <= -2.35e+103) {
tmp = t_2;
} else if (im <= -0.024) {
tmp = t_0;
} else if (im <= 0.043) {
tmp = Math.sin(re) * (t_1 - im);
} else if (im <= 2e+102) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 * re) t_1 = math.pow(im, 3.0) * -0.16666666666666666 t_2 = math.sin(re) * t_1 tmp = 0 if im <= -2.35e+103: tmp = t_2 elif im <= -0.024: tmp = t_0 elif im <= 0.043: tmp = math.sin(re) * (t_1 - im) elif im <= 2e+102: tmp = t_0 else: tmp = t_2 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) * -0.16666666666666666) t_2 = Float64(sin(re) * t_1) tmp = 0.0 if (im <= -2.35e+103) tmp = t_2; elseif (im <= -0.024) tmp = t_0; elseif (im <= 0.043) tmp = Float64(sin(re) * Float64(t_1 - im)); elseif (im <= 2e+102) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) - exp(im)) * (0.5 * re); t_1 = (im ^ 3.0) * -0.16666666666666666; t_2 = sin(re) * t_1; tmp = 0.0; if (im <= -2.35e+103) tmp = t_2; elseif (im <= -0.024) tmp = t_0; elseif (im <= 0.043) tmp = sin(re) * (t_1 - im); elseif (im <= 2e+102) tmp = t_0; else tmp = t_2; 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] * -0.16666666666666666), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[im, -2.35e+103], t$95$2, If[LessEqual[im, -0.024], t$95$0, If[LessEqual[im, 0.043], N[(N[Sin[re], $MachinePrecision] * N[(t$95$1 - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2e+102], t$95$0, t$95$2]]]]]]]
\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 -0.16666666666666666\\
t_2 := \sin re \cdot t_1\\
\mathbf{if}\;im \leq -2.35 \cdot 10^{+103}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -0.024:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.043:\\
\;\;\;\;\sin re \cdot \left(t_1 - im\right)\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < -2.35000000000000016e103 or 1.99999999999999995e102 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -2.35000000000000016e103 < im < -0.024 or 0.042999999999999997 < im < 1.99999999999999995e102Initial program 99.9%
Taylor expanded in re around 0 79.9%
if -0.024 < im < 0.042999999999999997Initial program 30.9%
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 simplification96.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (sin re) (* (pow im 3.0) -0.16666666666666666))))
(if (<= im -5.6e+102)
t_0
(if (<= im -850000000000.0)
(log1p (expm1 (* re 13.5)))
(if (<= im 2.4) (* im (- (sin re))) t_0)))))
double code(double re, double im) {
double t_0 = sin(re) * (pow(im, 3.0) * -0.16666666666666666);
double tmp;
if (im <= -5.6e+102) {
tmp = t_0;
} else if (im <= -850000000000.0) {
tmp = log1p(expm1((re * 13.5)));
} else if (im <= 2.4) {
tmp = im * -sin(re);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.sin(re) * (Math.pow(im, 3.0) * -0.16666666666666666);
double tmp;
if (im <= -5.6e+102) {
tmp = t_0;
} else if (im <= -850000000000.0) {
tmp = Math.log1p(Math.expm1((re * 13.5)));
} else if (im <= 2.4) {
tmp = im * -Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.sin(re) * (math.pow(im, 3.0) * -0.16666666666666666) tmp = 0 if im <= -5.6e+102: tmp = t_0 elif im <= -850000000000.0: tmp = math.log1p(math.expm1((re * 13.5))) elif im <= 2.4: tmp = im * -math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(sin(re) * Float64((im ^ 3.0) * -0.16666666666666666)) tmp = 0.0 if (im <= -5.6e+102) tmp = t_0; elseif (im <= -850000000000.0) tmp = log1p(expm1(Float64(re * 13.5))); elseif (im <= 2.4) tmp = Float64(im * Float64(-sin(re))); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.6e+102], t$95$0, If[LessEqual[im, -850000000000.0], N[Log[1 + N[(Exp[N[(re * 13.5), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 2.4], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin re \cdot \left({im}^{3} \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -5.6 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -850000000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot 13.5\right)\right)\\
\mathbf{elif}\;im \leq 2.4:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.60000000000000037e102 or 2.39999999999999991 < im Initial program 100.0%
Taylor expanded in im around 0 88.6%
mul-1-neg88.6%
unsub-neg88.6%
*-commutative88.6%
associate-*l*88.6%
distribute-lft-out--88.6%
Simplified88.6%
Taylor expanded in im around inf 88.6%
*-commutative88.6%
associate-*l*88.6%
*-commutative88.6%
Simplified88.6%
if -5.60000000000000037e102 < im < -8.5e11Initial program 100.0%
Taylor expanded in re around 0 73.9%
Applied egg-rr2.7%
log1p-expm1-u35.5%
*-commutative35.5%
associate-*l*35.5%
metadata-eval35.5%
Applied egg-rr35.5%
if -8.5e11 < im < 2.39999999999999991Initial program 32.9%
Taylor expanded in im around 0 97.1%
mul-1-neg97.1%
*-commutative97.1%
distribute-rgt-neg-in97.1%
Simplified97.1%
Final simplification88.2%
(FPCore (re im)
:precision binary64
(if (<= im -6e+135)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im -7.8e+105)
(log1p (expm1 (* re -1.5)))
(if (<= im -950000000000.0)
(log1p (expm1 (* re 13.5)))
(if (<= im 4.2e-5)
(* im (- (sin re)))
(- (* re (* (pow im 3.0) -0.16666666666666666)) (* im re)))))))
double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -7.8e+105) {
tmp = log1p(expm1((re * -1.5)));
} else if (im <= -950000000000.0) {
tmp = log1p(expm1((re * 13.5)));
} else if (im <= 4.2e-5) {
tmp = im * -sin(re);
} else {
tmp = (re * (pow(im, 3.0) * -0.16666666666666666)) - (im * re);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -7.8e+105) {
tmp = Math.log1p(Math.expm1((re * -1.5)));
} else if (im <= -950000000000.0) {
tmp = Math.log1p(Math.expm1((re * 13.5)));
} else if (im <= 4.2e-5) {
tmp = im * -Math.sin(re);
} else {
tmp = (re * (Math.pow(im, 3.0) * -0.16666666666666666)) - (im * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -6e+135: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= -7.8e+105: tmp = math.log1p(math.expm1((re * -1.5))) elif im <= -950000000000.0: tmp = math.log1p(math.expm1((re * 13.5))) elif im <= 4.2e-5: tmp = im * -math.sin(re) else: tmp = (re * (math.pow(im, 3.0) * -0.16666666666666666)) - (im * re) return tmp
function code(re, im) tmp = 0.0 if (im <= -6e+135) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= -7.8e+105) tmp = log1p(expm1(Float64(re * -1.5))); elseif (im <= -950000000000.0) tmp = log1p(expm1(Float64(re * 13.5))); elseif (im <= 4.2e-5) tmp = Float64(im * Float64(-sin(re))); else tmp = Float64(Float64(re * Float64((im ^ 3.0) * -0.16666666666666666)) - Float64(im * re)); end return tmp end
code[re_, im_] := If[LessEqual[im, -6e+135], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -7.8e+105], N[Log[1 + N[(Exp[N[(re * -1.5), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, -950000000000.0], N[Log[1 + N[(Exp[N[(re * 13.5), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 4.2e-5], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], N[(N[(re * N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(im * re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6 \cdot 10^{+135}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq -7.8 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot -1.5\right)\right)\\
\mathbf{elif}\;im \leq -950000000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot 13.5\right)\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) - im \cdot re\\
\end{array}
\end{array}
if im < -6.0000000000000001e135Initial program 100.0%
Taylor expanded in re around 0 80.6%
Taylor expanded in im around 0 80.6%
Taylor expanded in im around inf 80.6%
*-commutative80.6%
associate-*r*80.6%
*-commutative80.6%
associate-*r*80.6%
Simplified80.6%
if -6.0000000000000001e135 < im < -7.79999999999999957e105Initial program 100.0%
Taylor expanded in re around 0 27.3%
Applied egg-rr4.7%
log1p-expm1-u72.8%
*-commutative72.8%
associate-*l*72.8%
metadata-eval72.8%
Applied egg-rr72.8%
if -7.79999999999999957e105 < im < -9.5e11Initial program 100.0%
Taylor expanded in re around 0 75.0%
Applied egg-rr2.7%
log1p-expm1-u34.1%
*-commutative34.1%
associate-*l*34.1%
metadata-eval34.1%
Applied egg-rr34.1%
if -9.5e11 < im < 4.19999999999999977e-5Initial program 32.1%
Taylor expanded in im around 0 97.8%
mul-1-neg97.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
Simplified97.8%
if 4.19999999999999977e-5 < im Initial program 99.6%
Taylor expanded in re around 0 71.8%
Taylor expanded in im around 0 55.6%
+-commutative55.6%
mul-1-neg55.6%
unsub-neg55.6%
*-commutative55.6%
associate-*l*55.6%
Applied egg-rr55.6%
Final simplification78.6%
(FPCore (re im) :precision binary64 (* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im)))
double code(double re, double im) {
return sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end function
public static double code(double re, double im) {
return Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
def code(re, im): return math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im)
function code(re, im) return Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) end
function tmp = code(re, im) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end
code[re_, im_] := N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)
\end{array}
Initial program 65.7%
Taylor expanded in im around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
*-commutative85.6%
associate-*l*85.6%
distribute-lft-out--85.6%
Simplified85.6%
Final simplification85.6%
(FPCore (re im)
:precision binary64
(if (<= im -6e+135)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im -8.1e+105)
(log1p (expm1 (* re -1.5)))
(if (or (<= im -0.098) (not (<= im 4.7e-5)))
(- (* re (* (pow im 3.0) -0.16666666666666666)) (* im re))
(* im (- (sin re)))))))
double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -8.1e+105) {
tmp = log1p(expm1((re * -1.5)));
} else if ((im <= -0.098) || !(im <= 4.7e-5)) {
tmp = (re * (pow(im, 3.0) * -0.16666666666666666)) - (im * re);
} else {
tmp = im * -sin(re);
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -8.1e+105) {
tmp = Math.log1p(Math.expm1((re * -1.5)));
} else if ((im <= -0.098) || !(im <= 4.7e-5)) {
tmp = (re * (Math.pow(im, 3.0) * -0.16666666666666666)) - (im * re);
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -6e+135: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= -8.1e+105: tmp = math.log1p(math.expm1((re * -1.5))) elif (im <= -0.098) or not (im <= 4.7e-5): tmp = (re * (math.pow(im, 3.0) * -0.16666666666666666)) - (im * re) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -6e+135) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= -8.1e+105) tmp = log1p(expm1(Float64(re * -1.5))); elseif ((im <= -0.098) || !(im <= 4.7e-5)) tmp = Float64(Float64(re * Float64((im ^ 3.0) * -0.16666666666666666)) - Float64(im * re)); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
code[re_, im_] := If[LessEqual[im, -6e+135], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -8.1e+105], N[Log[1 + N[(Exp[N[(re * -1.5), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[im, -0.098], N[Not[LessEqual[im, 4.7e-5]], $MachinePrecision]], N[(N[(re * N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(im * re), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6 \cdot 10^{+135}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq -8.1 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot -1.5\right)\right)\\
\mathbf{elif}\;im \leq -0.098 \lor \neg \left(im \leq 4.7 \cdot 10^{-5}\right):\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) - im \cdot re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -6.0000000000000001e135Initial program 100.0%
Taylor expanded in re around 0 80.6%
Taylor expanded in im around 0 80.6%
Taylor expanded in im around inf 80.6%
*-commutative80.6%
associate-*r*80.6%
*-commutative80.6%
associate-*r*80.6%
Simplified80.6%
if -6.0000000000000001e135 < im < -8.09999999999999998e105Initial program 100.0%
Taylor expanded in re around 0 27.3%
Applied egg-rr4.7%
log1p-expm1-u72.8%
*-commutative72.8%
associate-*l*72.8%
metadata-eval72.8%
Applied egg-rr72.8%
if -8.09999999999999998e105 < im < -0.098000000000000004 or 4.69999999999999972e-5 < im Initial program 99.7%
Taylor expanded in re around 0 73.6%
Taylor expanded in im around 0 47.5%
+-commutative47.5%
mul-1-neg47.5%
unsub-neg47.5%
*-commutative47.5%
associate-*l*47.5%
Applied egg-rr47.5%
if -0.098000000000000004 < im < 4.69999999999999972e-5Initial program 30.5%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Final simplification78.4%
(FPCore (re im)
:precision binary64
(if (<= im -6e+135)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im -8.1e+105)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (or (<= im -0.0088) (not (<= im 4.7e-5)))
(- (* re (* (pow im 3.0) -0.16666666666666666)) (* im re))
(* im (- (sin re)))))))
double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -8.1e+105) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if ((im <= -0.0088) || !(im <= 4.7e-5)) {
tmp = (re * (pow(im, 3.0) * -0.16666666666666666)) - (im * re);
} 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 <= (-6d+135)) then
tmp = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
else if (im <= (-8.1d+105)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if ((im <= (-0.0088d0)) .or. (.not. (im <= 4.7d-5))) then
tmp = (re * ((im ** 3.0d0) * (-0.16666666666666666d0))) - (im * re)
else
tmp = im * -sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -8.1e+105) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if ((im <= -0.0088) || !(im <= 4.7e-5)) {
tmp = (re * (Math.pow(im, 3.0) * -0.16666666666666666)) - (im * re);
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -6e+135: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= -8.1e+105: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif (im <= -0.0088) or not (im <= 4.7e-5): tmp = (re * (math.pow(im, 3.0) * -0.16666666666666666)) - (im * re) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -6e+135) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= -8.1e+105) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif ((im <= -0.0088) || !(im <= 4.7e-5)) tmp = Float64(Float64(re * Float64((im ^ 3.0) * -0.16666666666666666)) - Float64(im * re)); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -6e+135) tmp = (im ^ 3.0) * (re * -0.16666666666666666); elseif (im <= -8.1e+105) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif ((im <= -0.0088) || ~((im <= 4.7e-5))) tmp = (re * ((im ^ 3.0) * -0.16666666666666666)) - (im * re); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -6e+135], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -8.1e+105], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -0.0088], N[Not[LessEqual[im, 4.7e-5]], $MachinePrecision]], N[(N[(re * N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(im * re), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6 \cdot 10^{+135}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq -8.1 \cdot 10^{+105}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq -0.0088 \lor \neg \left(im \leq 4.7 \cdot 10^{-5}\right):\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666\right) - im \cdot re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -6.0000000000000001e135Initial program 100.0%
Taylor expanded in re around 0 80.6%
Taylor expanded in im around 0 80.6%
Taylor expanded in im around inf 80.6%
*-commutative80.6%
associate-*r*80.6%
*-commutative80.6%
associate-*r*80.6%
Simplified80.6%
if -6.0000000000000001e135 < im < -8.09999999999999998e105Initial program 100.0%
Taylor expanded in im around 0 4.2%
mul-1-neg4.2%
*-commutative4.2%
distribute-rgt-neg-in4.2%
Simplified4.2%
Taylor expanded in re around 0 37.1%
+-commutative37.1%
mul-1-neg37.1%
unsub-neg37.1%
associate-*r*37.1%
distribute-rgt-out--64.4%
Simplified64.4%
if -8.09999999999999998e105 < im < -0.00880000000000000053 or 4.69999999999999972e-5 < im Initial program 99.7%
Taylor expanded in re around 0 73.6%
Taylor expanded in im around 0 47.5%
+-commutative47.5%
mul-1-neg47.5%
unsub-neg47.5%
*-commutative47.5%
associate-*l*47.5%
Applied egg-rr47.5%
if -0.00880000000000000053 < im < 4.69999999999999972e-5Initial program 30.5%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Final simplification78.0%
(FPCore (re im)
:precision binary64
(if (<= im -6e+135)
(* (pow im 3.0) (* re -0.16666666666666666))
(if (<= im -8.1e+105)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (or (<= im -0.0016) (not (<= im 2.3e-5)))
(* re (- (* (pow im 3.0) -0.16666666666666666) im))
(* im (- (sin re)))))))
double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -8.1e+105) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if ((im <= -0.0016) || !(im <= 2.3e-5)) {
tmp = re * ((pow(im, 3.0) * -0.16666666666666666) - 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 <= (-6d+135)) then
tmp = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
else if (im <= (-8.1d+105)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if ((im <= (-0.0016d0)) .or. (.not. (im <= 2.3d-5))) then
tmp = re * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = im * -sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -6e+135) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else if (im <= -8.1e+105) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if ((im <= -0.0016) || !(im <= 2.3e-5)) {
tmp = re * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -6e+135: tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) elif im <= -8.1e+105: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif (im <= -0.0016) or not (im <= 2.3e-5): tmp = re * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if (im <= -6e+135) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); elseif (im <= -8.1e+105) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif ((im <= -0.0016) || !(im <= 2.3e-5)) tmp = Float64(re * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -6e+135) tmp = (im ^ 3.0) * (re * -0.16666666666666666); elseif (im <= -8.1e+105) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif ((im <= -0.0016) || ~((im <= 2.3e-5))) tmp = re * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -6e+135], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -8.1e+105], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -0.0016], N[Not[LessEqual[im, 2.3e-5]], $MachinePrecision]], N[(re * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6 \cdot 10^{+135}:\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;im \leq -8.1 \cdot 10^{+105}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq -0.0016 \lor \neg \left(im \leq 2.3 \cdot 10^{-5}\right):\\
\;\;\;\;re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -6.0000000000000001e135Initial program 100.0%
Taylor expanded in re around 0 80.6%
Taylor expanded in im around 0 80.6%
Taylor expanded in im around inf 80.6%
*-commutative80.6%
associate-*r*80.6%
*-commutative80.6%
associate-*r*80.6%
Simplified80.6%
if -6.0000000000000001e135 < im < -8.09999999999999998e105Initial program 100.0%
Taylor expanded in im around 0 4.2%
mul-1-neg4.2%
*-commutative4.2%
distribute-rgt-neg-in4.2%
Simplified4.2%
Taylor expanded in re around 0 37.1%
+-commutative37.1%
mul-1-neg37.1%
unsub-neg37.1%
associate-*r*37.1%
distribute-rgt-out--64.4%
Simplified64.4%
if -8.09999999999999998e105 < im < -0.00160000000000000008 or 2.3e-5 < im Initial program 99.7%
Taylor expanded in im around 0 58.4%
mul-1-neg58.4%
unsub-neg58.4%
*-commutative58.4%
associate-*l*58.4%
distribute-lft-out--58.4%
Simplified58.4%
Taylor expanded in re around 0 47.5%
if -0.00160000000000000008 < im < 2.3e-5Initial program 30.5%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Final simplification78.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) (* re -0.16666666666666666))))
(if (<= im -6e+135)
t_0
(if (<= im -8.1e+105)
(* (pow re 3.0) (* im 0.16666666666666666))
(if (or (<= im -4.2e+20) (not (<= im 700.0)))
t_0
(* im (- (sin re))))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * (re * -0.16666666666666666);
double tmp;
if (im <= -6e+135) {
tmp = t_0;
} else if (im <= -8.1e+105) {
tmp = pow(re, 3.0) * (im * 0.16666666666666666);
} else if ((im <= -4.2e+20) || !(im <= 700.0)) {
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 = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
if (im <= (-6d+135)) then
tmp = t_0
else if (im <= (-8.1d+105)) then
tmp = (re ** 3.0d0) * (im * 0.16666666666666666d0)
else if ((im <= (-4.2d+20)) .or. (.not. (im <= 700.0d0))) 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 = Math.pow(im, 3.0) * (re * -0.16666666666666666);
double tmp;
if (im <= -6e+135) {
tmp = t_0;
} else if (im <= -8.1e+105) {
tmp = Math.pow(re, 3.0) * (im * 0.16666666666666666);
} else if ((im <= -4.2e+20) || !(im <= 700.0)) {
tmp = t_0;
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * (re * -0.16666666666666666) tmp = 0 if im <= -6e+135: tmp = t_0 elif im <= -8.1e+105: tmp = math.pow(re, 3.0) * (im * 0.16666666666666666) elif (im <= -4.2e+20) or not (im <= 700.0): tmp = t_0 else: tmp = im * -math.sin(re) return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)) tmp = 0.0 if (im <= -6e+135) tmp = t_0; elseif (im <= -8.1e+105) tmp = Float64((re ^ 3.0) * Float64(im * 0.16666666666666666)); elseif ((im <= -4.2e+20) || !(im <= 700.0)) tmp = t_0; else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * (re * -0.16666666666666666); tmp = 0.0; if (im <= -6e+135) tmp = t_0; elseif (im <= -8.1e+105) tmp = (re ^ 3.0) * (im * 0.16666666666666666); elseif ((im <= -4.2e+20) || ~((im <= 700.0))) tmp = t_0; else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6e+135], t$95$0, If[LessEqual[im, -8.1e+105], N[(N[Power[re, 3.0], $MachinePrecision] * N[(im * 0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -4.2e+20], N[Not[LessEqual[im, 700.0]], $MachinePrecision]], t$95$0, N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -6 \cdot 10^{+135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8.1 \cdot 10^{+105}:\\
\;\;\;\;{re}^{3} \cdot \left(im \cdot 0.16666666666666666\right)\\
\mathbf{elif}\;im \leq -4.2 \cdot 10^{+20} \lor \neg \left(im \leq 700\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -6.0000000000000001e135 or -8.09999999999999998e105 < im < -4.2e20 or 700 < im Initial program 100.0%
Taylor expanded in re around 0 75.7%
Taylor expanded in im around 0 58.3%
Taylor expanded in im around inf 58.3%
*-commutative58.3%
associate-*r*58.3%
*-commutative58.3%
associate-*r*58.3%
Simplified58.3%
if -6.0000000000000001e135 < im < -8.09999999999999998e105Initial program 100.0%
Taylor expanded in im around 0 4.2%
mul-1-neg4.2%
*-commutative4.2%
distribute-rgt-neg-in4.2%
Simplified4.2%
Taylor expanded in re around 0 37.1%
+-commutative37.1%
mul-1-neg37.1%
unsub-neg37.1%
associate-*r*37.1%
distribute-rgt-out--64.4%
Simplified64.4%
Taylor expanded in re around inf 64.2%
*-commutative64.2%
associate-*l*64.2%
Simplified64.2%
if -4.2e20 < im < 700Initial program 34.4%
Taylor expanded in im around 0 95.0%
mul-1-neg95.0%
*-commutative95.0%
distribute-rgt-neg-in95.0%
Simplified95.0%
Final simplification77.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) (* re -0.16666666666666666))))
(if (<= im -6e+135)
t_0
(if (<= im -8.1e+105)
(* im (- (* 0.16666666666666666 (pow re 3.0)) re))
(if (or (<= im -4.2e+20) (not (<= im 480.0)))
t_0
(* im (- (sin re))))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * (re * -0.16666666666666666);
double tmp;
if (im <= -6e+135) {
tmp = t_0;
} else if (im <= -8.1e+105) {
tmp = im * ((0.16666666666666666 * pow(re, 3.0)) - re);
} else if ((im <= -4.2e+20) || !(im <= 480.0)) {
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 = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
if (im <= (-6d+135)) then
tmp = t_0
else if (im <= (-8.1d+105)) then
tmp = im * ((0.16666666666666666d0 * (re ** 3.0d0)) - re)
else if ((im <= (-4.2d+20)) .or. (.not. (im <= 480.0d0))) 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 = Math.pow(im, 3.0) * (re * -0.16666666666666666);
double tmp;
if (im <= -6e+135) {
tmp = t_0;
} else if (im <= -8.1e+105) {
tmp = im * ((0.16666666666666666 * Math.pow(re, 3.0)) - re);
} else if ((im <= -4.2e+20) || !(im <= 480.0)) {
tmp = t_0;
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * (re * -0.16666666666666666) tmp = 0 if im <= -6e+135: tmp = t_0 elif im <= -8.1e+105: tmp = im * ((0.16666666666666666 * math.pow(re, 3.0)) - re) elif (im <= -4.2e+20) or not (im <= 480.0): tmp = t_0 else: tmp = im * -math.sin(re) return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)) tmp = 0.0 if (im <= -6e+135) tmp = t_0; elseif (im <= -8.1e+105) tmp = Float64(im * Float64(Float64(0.16666666666666666 * (re ^ 3.0)) - re)); elseif ((im <= -4.2e+20) || !(im <= 480.0)) tmp = t_0; else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * (re * -0.16666666666666666); tmp = 0.0; if (im <= -6e+135) tmp = t_0; elseif (im <= -8.1e+105) tmp = im * ((0.16666666666666666 * (re ^ 3.0)) - re); elseif ((im <= -4.2e+20) || ~((im <= 480.0))) tmp = t_0; else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6e+135], t$95$0, If[LessEqual[im, -8.1e+105], N[(im * N[(N[(0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision] - re), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -4.2e+20], N[Not[LessEqual[im, 480.0]], $MachinePrecision]], t$95$0, N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{if}\;im \leq -6 \cdot 10^{+135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8.1 \cdot 10^{+105}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot {re}^{3} - re\right)\\
\mathbf{elif}\;im \leq -4.2 \cdot 10^{+20} \lor \neg \left(im \leq 480\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -6.0000000000000001e135 or -8.09999999999999998e105 < im < -4.2e20 or 480 < im Initial program 100.0%
Taylor expanded in re around 0 75.7%
Taylor expanded in im around 0 58.3%
Taylor expanded in im around inf 58.3%
*-commutative58.3%
associate-*r*58.3%
*-commutative58.3%
associate-*r*58.3%
Simplified58.3%
if -6.0000000000000001e135 < im < -8.09999999999999998e105Initial program 100.0%
Taylor expanded in im around 0 4.2%
mul-1-neg4.2%
*-commutative4.2%
distribute-rgt-neg-in4.2%
Simplified4.2%
Taylor expanded in re around 0 37.1%
+-commutative37.1%
mul-1-neg37.1%
unsub-neg37.1%
associate-*r*37.1%
distribute-rgt-out--64.4%
Simplified64.4%
if -4.2e20 < im < 480Initial program 34.4%
Taylor expanded in im around 0 95.0%
mul-1-neg95.0%
*-commutative95.0%
distribute-rgt-neg-in95.0%
Simplified95.0%
Final simplification77.7%
(FPCore (re im) :precision binary64 (if (or (<= im -3.2e+20) (not (<= im 820.0))) (* (pow im 3.0) (* re -0.16666666666666666)) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -3.2e+20) || !(im <= 820.0)) {
tmp = pow(im, 3.0) * (re * -0.16666666666666666);
} 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 <= (-3.2d+20)) .or. (.not. (im <= 820.0d0))) then
tmp = (im ** 3.0d0) * (re * (-0.16666666666666666d0))
else
tmp = im * -sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.2e+20) || !(im <= 820.0)) {
tmp = Math.pow(im, 3.0) * (re * -0.16666666666666666);
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.2e+20) or not (im <= 820.0): tmp = math.pow(im, 3.0) * (re * -0.16666666666666666) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.2e+20) || !(im <= 820.0)) tmp = Float64((im ^ 3.0) * Float64(re * -0.16666666666666666)); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.2e+20) || ~((im <= 820.0))) tmp = (im ^ 3.0) * (re * -0.16666666666666666); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.2e+20], N[Not[LessEqual[im, 820.0]], $MachinePrecision]], N[(N[Power[im, 3.0], $MachinePrecision] * N[(re * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.2 \cdot 10^{+20} \lor \neg \left(im \leq 820\right):\\
\;\;\;\;{im}^{3} \cdot \left(re \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -3.2e20 or 820 < im Initial program 100.0%
Taylor expanded in re around 0 71.3%
Taylor expanded in im around 0 55.5%
Taylor expanded in im around inf 55.5%
*-commutative55.5%
associate-*r*55.5%
*-commutative55.5%
associate-*r*55.5%
Simplified55.5%
if -3.2e20 < im < 820Initial program 34.4%
Taylor expanded in im around 0 95.0%
mul-1-neg95.0%
*-commutative95.0%
distribute-rgt-neg-in95.0%
Simplified95.0%
Final simplification76.2%
(FPCore (re im) :precision binary64 (if (or (<= im -2.3e+21) (not (<= im 1.05e+129))) (- (* im re)) (* im (- (sin re)))))
double code(double re, double im) {
double tmp;
if ((im <= -2.3e+21) || !(im <= 1.05e+129)) {
tmp = -(im * re);
} 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 <= (-2.3d+21)) .or. (.not. (im <= 1.05d+129))) then
tmp = -(im * re)
else
tmp = im * -sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -2.3e+21) || !(im <= 1.05e+129)) {
tmp = -(im * re);
} else {
tmp = im * -Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -2.3e+21) or not (im <= 1.05e+129): tmp = -(im * re) else: tmp = im * -math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -2.3e+21) || !(im <= 1.05e+129)) tmp = Float64(-Float64(im * re)); else tmp = Float64(im * Float64(-sin(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -2.3e+21) || ~((im <= 1.05e+129))) tmp = -(im * re); else tmp = im * -sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -2.3e+21], N[Not[LessEqual[im, 1.05e+129]], $MachinePrecision]], (-N[(im * re), $MachinePrecision]), N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.3 \cdot 10^{+21} \lor \neg \left(im \leq 1.05 \cdot 10^{+129}\right):\\
\;\;\;\;-im \cdot re\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\end{array}
\end{array}
if im < -2.3e21 or 1.04999999999999998e129 < im Initial program 100.0%
Taylor expanded in im around 0 4.4%
mul-1-neg4.4%
*-commutative4.4%
distribute-rgt-neg-in4.4%
Simplified4.4%
Taylor expanded in re around 0 17.4%
mul-1-neg17.4%
distribute-rgt-neg-in17.4%
Simplified17.4%
if -2.3e21 < im < 1.04999999999999998e129Initial program 44.0%
Taylor expanded in im around 0 81.5%
mul-1-neg81.5%
*-commutative81.5%
distribute-rgt-neg-in81.5%
Simplified81.5%
Final simplification56.7%
(FPCore (re im) :precision binary64 (if (<= im -2.05e+33) (sqrt (* re (* re 182.25))) (if (<= im 1.06e+130) (* im (- (sin re))) (- (* im re)))))
double code(double re, double im) {
double tmp;
if (im <= -2.05e+33) {
tmp = sqrt((re * (re * 182.25)));
} else if (im <= 1.06e+130) {
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.05d+33)) then
tmp = sqrt((re * (re * 182.25d0)))
else if (im <= 1.06d+130) 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.05e+33) {
tmp = Math.sqrt((re * (re * 182.25)));
} else if (im <= 1.06e+130) {
tmp = im * -Math.sin(re);
} else {
tmp = -(im * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2.05e+33: tmp = math.sqrt((re * (re * 182.25))) elif im <= 1.06e+130: tmp = im * -math.sin(re) else: tmp = -(im * re) return tmp
function code(re, im) tmp = 0.0 if (im <= -2.05e+33) tmp = sqrt(Float64(re * Float64(re * 182.25))); elseif (im <= 1.06e+130) tmp = Float64(im * Float64(-sin(re))); else tmp = Float64(-Float64(im * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2.05e+33) tmp = sqrt((re * (re * 182.25))); elseif (im <= 1.06e+130) tmp = im * -sin(re); else tmp = -(im * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2.05e+33], N[Sqrt[N[(re * N[(re * 182.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 1.06e+130], N[(im * (-N[Sin[re], $MachinePrecision])), $MachinePrecision], (-N[(im * re), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.05 \cdot 10^{+33}:\\
\;\;\;\;\sqrt{re \cdot \left(re \cdot 182.25\right)}\\
\mathbf{elif}\;im \leq 1.06 \cdot 10^{+130}:\\
\;\;\;\;im \cdot \left(-\sin re\right)\\
\mathbf{else}:\\
\;\;\;\;-im \cdot re\\
\end{array}
\end{array}
if im < -2.04999999999999997e33Initial program 100.0%
Taylor expanded in re around 0 69.5%
Applied egg-rr2.3%
log1p-expm1-u23.1%
*-commutative23.1%
associate-*l*23.1%
metadata-eval23.1%
Applied egg-rr23.1%
log1p-expm1-u2.3%
add-sqr-sqrt1.5%
sqrt-unprod13.3%
*-commutative13.3%
*-commutative13.3%
swap-sqr13.3%
metadata-eval13.3%
Applied egg-rr13.3%
associate-*r*13.3%
Simplified13.3%
if -2.04999999999999997e33 < im < 1.06e130Initial program 45.4%
Taylor expanded in im around 0 79.5%
mul-1-neg79.5%
*-commutative79.5%
distribute-rgt-neg-in79.5%
Simplified79.5%
if 1.06e130 < im Initial program 100.0%
Taylor expanded in im around 0 5.3%
mul-1-neg5.3%
*-commutative5.3%
distribute-rgt-neg-in5.3%
Simplified5.3%
Taylor expanded in re around 0 29.7%
mul-1-neg29.7%
distribute-rgt-neg-in29.7%
Simplified29.7%
Final simplification57.3%
(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(-Float64(im * re)) end
function tmp = code(re, im) tmp = -(im * re); end
code[re_, im_] := (-N[(im * re), $MachinePrecision])
\begin{array}{l}
\\
-im \cdot re
\end{array}
Initial program 65.7%
Taylor expanded in im around 0 51.7%
mul-1-neg51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
Simplified51.7%
Taylor expanded in re around 0 36.1%
mul-1-neg36.1%
distribute-rgt-neg-in36.1%
Simplified36.1%
Final simplification36.1%
(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 65.7%
Taylor expanded in im around 0 51.7%
mul-1-neg51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
Simplified51.7%
Applied egg-rr2.7%
Final simplification2.7%
(FPCore (re im) :precision binary64 -9.92290301275212e-8)
double code(double re, double im) {
return -9.92290301275212e-8;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -9.92290301275212d-8
end function
public static double code(double re, double im) {
return -9.92290301275212e-8;
}
def code(re, im): return -9.92290301275212e-8
function code(re, im) return -9.92290301275212e-8 end
function tmp = code(re, im) tmp = -9.92290301275212e-8; end
code[re_, im_] := -9.92290301275212e-8
\begin{array}{l}
\\
-9.92290301275212 \cdot 10^{-8}
\end{array}
Initial program 65.7%
Taylor expanded in im around 0 51.7%
mul-1-neg51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
Simplified51.7%
Applied egg-rr2.8%
Final simplification2.8%
(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 65.7%
Taylor expanded in im around 0 51.7%
mul-1-neg51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
Simplified51.7%
Applied egg-rr15.0%
Final simplification15.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 2023189
(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))))