
(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 12 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.05)))
(* t_0 (* 0.5 (sin re)))
(*
(sin re)
(+
(- (* (pow im 5.0) -0.008333333333333333) im)
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 3.0) -0.16666666666666666)))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.05)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * (((pow(im, 5.0) * -0.008333333333333333) - im) + ((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 3.0) * -0.16666666666666666)));
}
return tmp;
}
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.05)) {
tmp = t_0 * (0.5 * Math.sin(re));
} else {
tmp = Math.sin(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) - im) + ((Math.pow(im, 7.0) * -0.0001984126984126984) + (Math.pow(im, 3.0) * -0.16666666666666666)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.05): tmp = t_0 * (0.5 * math.sin(re)) else: tmp = math.sin(re) * (((math.pow(im, 5.0) * -0.008333333333333333) - im) + ((math.pow(im, 7.0) * -0.0001984126984126984) + (math.pow(im, 3.0) * -0.16666666666666666))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.05)) tmp = Float64(t_0 * Float64(0.5 * sin(re))); else tmp = Float64(sin(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im) + Float64(Float64((im ^ 7.0) * -0.0001984126984126984) + Float64((im ^ 3.0) * -0.16666666666666666)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.05))) tmp = t_0 * (0.5 * sin(re)); else tmp = sin(re) * ((((im ^ 5.0) * -0.008333333333333333) - im) + (((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 3.0) * -0.16666666666666666))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.05]], $MachinePrecision]], N[(t$95$0 * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision] + N[(N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.05\right):\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \sin re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + {im}^{3} \cdot -0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -inf.0 or 0.050000000000000003 < (-.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)) < 0.050000000000000003Initial program 30.3%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
+-commutative99.8%
mul-1-neg99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
*-commutative99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e-6)))
(* 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 <= -((double) INFINITY)) || !(t_0 <= 5e-6)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = (pow(im, 3.0) * (sin(re) * -0.16666666666666666)) - (im * sin(re));
}
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 <= 5e-6)) {
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 <= -math.inf) or not (t_0 <= 5e-6): 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 <= Float64(-Inf)) || !(t_0 <= 5e-6)) 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 <= -Inf) || ~((t_0 <= 5e-6))) 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, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-6]], $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 -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{-6}\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)) < -inf.0 or 5.00000000000000041e-6 < (-.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)) < 5.00000000000000041e-6Initial program 29.8%
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 (- INFINITY)) (not (<= t_0 5e-6)))
(* 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 <= -((double) INFINITY)) || !(t_0 <= 5e-6)) {
tmp = t_0 * (0.5 * sin(re));
} else {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - 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 <= 5e-6)) {
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 <= -math.inf) or not (t_0 <= 5e-6): 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 <= Float64(-Inf)) || !(t_0 <= 5e-6)) 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 <= -Inf) || ~((t_0 <= 5e-6))) 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, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-6]], $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 -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{-6}\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)) < -inf.0 or 5.00000000000000041e-6 < (-.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)) < 5.00000000000000041e-6Initial program 29.8%
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 (if (or (<= im -8.5e+34) (not (<= im 1.1e+44))) (* -0.0001984126984126984 (* (sin re) (pow im 7.0))) (log1p (expm1 (* (- im) (sin re))))))
double code(double re, double im) {
double tmp;
if ((im <= -8.5e+34) || !(im <= 1.1e+44)) {
tmp = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
} else {
tmp = log1p(expm1((-im * sin(re))));
}
return tmp;
}
public static double code(double re, double im) {
double tmp;
if ((im <= -8.5e+34) || !(im <= 1.1e+44)) {
tmp = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
} else {
tmp = Math.log1p(Math.expm1((-im * Math.sin(re))));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -8.5e+34) or not (im <= 1.1e+44): tmp = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) else: tmp = math.log1p(math.expm1((-im * math.sin(re)))) return tmp
function code(re, im) tmp = 0.0 if ((im <= -8.5e+34) || !(im <= 1.1e+44)) tmp = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))); else tmp = log1p(expm1(Float64(Float64(-im) * sin(re)))); end return tmp end
code[re_, im_] := If[Or[LessEqual[im, -8.5e+34], N[Not[LessEqual[im, 1.1e+44]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -8.5 \cdot 10^{+34} \lor \neg \left(im \leq 1.1 \cdot 10^{+44}\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(-im\right) \cdot \sin re\right)\right)\\
\end{array}
\end{array}
if im < -8.5000000000000003e34 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 99.1%
associate-+r+99.1%
+-commutative99.1%
+-commutative99.1%
mul-1-neg99.1%
*-commutative99.1%
distribute-lft-neg-in99.1%
*-commutative99.1%
associate-*r*99.1%
distribute-rgt-out99.1%
*-commutative99.1%
associate-*l*99.1%
*-commutative99.1%
associate-*l*99.1%
distribute-lft-out99.1%
Simplified99.1%
Taylor expanded in im around inf 99.1%
if -8.5000000000000003e34 < im < 1.09999999999999998e44Initial program 41.7%
Taylor expanded in im around 0 83.5%
mul-1-neg83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
Simplified83.5%
log1p-expm1-u93.0%
distribute-rgt-neg-out93.0%
*-commutative93.0%
Applied egg-rr93.0%
Final simplification95.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (* 0.5 re)))
(t_1 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -2.1e+55)
t_1
(if (<= im -0.014)
t_0
(if (<= im 0.225)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 * re);
double t_1 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.014) {
tmp = t_0;
} else if (im <= 0.225) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (exp(-im) - exp(im)) * (0.5d0 * re)
t_1 = (-0.0001984126984126984d0) * (sin(re) * (im ** 7.0d0))
if (im <= (-2.1d+55)) then
tmp = t_1
else if (im <= (-0.014d0)) then
tmp = t_0
else if (im <= 0.225d0) then
tmp = sin(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.exp(-im) - Math.exp(im)) * (0.5 * re);
double t_1 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.014) {
tmp = t_0;
} else if (im <= 0.225) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 * re) t_1 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -2.1e+55: tmp = t_1 elif im <= -0.014: tmp = t_0 elif im <= 0.225: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 * re)) t_1 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.014) tmp = t_0; elseif (im <= 0.225) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) - exp(im)) * (0.5 * re); t_1 = -0.0001984126984126984 * (sin(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.014) tmp = t_0; elseif (im <= 0.225) tmp = sin(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.1e+55], t$95$1, If[LessEqual[im, -0.014], t$95$0, If[LessEqual[im, 0.225], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 \cdot re\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -2.1 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.014:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.225:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.1000000000000001e55 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
+-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -2.1000000000000001e55 < im < -0.0140000000000000003 or 0.225000000000000006 < im < 1.09999999999999998e44Initial program 99.8%
Taylor expanded in re around 0 79.8%
if -0.0140000000000000003 < im < 0.225000000000000006Initial program 29.8%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification97.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -9e+26)
t_0
(if (<= im -10500000000.0)
(log1p (expm1 (* 0.5 (* re -3.0))))
(if (<= im 600.0)
(* (- im) (sin re))
(if (<= im 1.1e+44) (log1p (expm1 (* im (- re)))) t_0))))))
double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -9e+26) {
tmp = t_0;
} else if (im <= -10500000000.0) {
tmp = log1p(expm1((0.5 * (re * -3.0))));
} else if (im <= 600.0) {
tmp = -im * sin(re);
} else if (im <= 1.1e+44) {
tmp = log1p(expm1((im * -re)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -9e+26) {
tmp = t_0;
} else if (im <= -10500000000.0) {
tmp = Math.log1p(Math.expm1((0.5 * (re * -3.0))));
} else if (im <= 600.0) {
tmp = -im * Math.sin(re);
} else if (im <= 1.1e+44) {
tmp = Math.log1p(Math.expm1((im * -re)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -9e+26: tmp = t_0 elif im <= -10500000000.0: tmp = math.log1p(math.expm1((0.5 * (re * -3.0)))) elif im <= 600.0: tmp = -im * math.sin(re) elif im <= 1.1e+44: tmp = math.log1p(math.expm1((im * -re))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -9e+26) tmp = t_0; elseif (im <= -10500000000.0) tmp = log1p(expm1(Float64(0.5 * Float64(re * -3.0)))); elseif (im <= 600.0) tmp = Float64(Float64(-im) * sin(re)); elseif (im <= 1.1e+44) tmp = log1p(expm1(Float64(im * Float64(-re)))); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -9e+26], t$95$0, If[LessEqual[im, -10500000000.0], N[Log[1 + N[(Exp[N[(0.5 * N[(re * -3.0), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 600.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[Log[1 + N[(Exp[N[(im * (-re)), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -9 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -10500000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.5 \cdot \left(re \cdot -3\right)\right)\right)\\
\mathbf{elif}\;im \leq 600:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(-re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -8.99999999999999957e26 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 96.4%
associate-+r+96.4%
+-commutative96.4%
+-commutative96.4%
mul-1-neg96.4%
*-commutative96.4%
distribute-lft-neg-in96.4%
*-commutative96.4%
associate-*r*96.4%
distribute-rgt-out96.4%
*-commutative96.4%
associate-*l*96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out96.4%
Simplified96.4%
Taylor expanded in im around inf 96.4%
if -8.99999999999999957e26 < im < -1.05e10Initial program 100.0%
Taylor expanded in re around 0 25.0%
Applied egg-rr4.3%
log1p-expm1-u75.2%
associate-*l*75.2%
Applied egg-rr75.2%
if -1.05e10 < im < 600Initial program 32.9%
Taylor expanded in im around 0 95.6%
mul-1-neg95.6%
*-commutative95.6%
distribute-rgt-neg-in95.6%
Simplified95.6%
if 600 < im < 1.09999999999999998e44Initial program 100.0%
Taylor expanded in im around 0 3.0%
mul-1-neg3.0%
*-commutative3.0%
distribute-rgt-neg-in3.0%
Simplified3.0%
log1p-expm1-u56.7%
distribute-rgt-neg-out56.7%
*-commutative56.7%
Applied egg-rr56.7%
Taylor expanded in re around 0 56.7%
Final simplification93.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.0001984126984126984 (* (sin re) (pow im 7.0)))))
(if (<= im -9e+26)
t_0
(if (<= im -10500000000.0)
(log1p (expm1 (* 0.5 (* re -3.0))))
(if (<= im 92000.0)
(* (sin re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) (log1p (expm1 (* im (- re)))) t_0))))))
double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (sin(re) * pow(im, 7.0));
double tmp;
if (im <= -9e+26) {
tmp = t_0;
} else if (im <= -10500000000.0) {
tmp = log1p(expm1((0.5 * (re * -3.0))));
} else if (im <= 92000.0) {
tmp = sin(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = log1p(expm1((im * -re)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (Math.sin(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -9e+26) {
tmp = t_0;
} else if (im <= -10500000000.0) {
tmp = Math.log1p(Math.expm1((0.5 * (re * -3.0))));
} else if (im <= 92000.0) {
tmp = Math.sin(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = Math.log1p(Math.expm1((im * -re)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.0001984126984126984 * (math.sin(re) * math.pow(im, 7.0)) tmp = 0 if im <= -9e+26: tmp = t_0 elif im <= -10500000000.0: tmp = math.log1p(math.expm1((0.5 * (re * -3.0)))) elif im <= 92000.0: tmp = math.sin(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = math.log1p(math.expm1((im * -re))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.0001984126984126984 * Float64(sin(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -9e+26) tmp = t_0; elseif (im <= -10500000000.0) tmp = log1p(expm1(Float64(0.5 * Float64(re * -3.0)))); elseif (im <= 92000.0) tmp = Float64(sin(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = log1p(expm1(Float64(im * Float64(-re)))); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(N[Sin[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -9e+26], t$95$0, If[LessEqual[im, -10500000000.0], N[Log[1 + N[(Exp[N[(0.5 * N[(re * -3.0), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 92000.0], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[Log[1 + N[(Exp[N[(im * (-re)), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(\sin re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -9 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -10500000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.5 \cdot \left(re \cdot -3\right)\right)\right)\\
\mathbf{elif}\;im \leq 92000:\\
\;\;\;\;\sin re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(-re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -8.99999999999999957e26 or 1.09999999999999998e44 < im Initial program 100.0%
Taylor expanded in im around 0 96.4%
associate-+r+96.4%
+-commutative96.4%
+-commutative96.4%
mul-1-neg96.4%
*-commutative96.4%
distribute-lft-neg-in96.4%
*-commutative96.4%
associate-*r*96.4%
distribute-rgt-out96.4%
*-commutative96.4%
associate-*l*96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out96.4%
Simplified96.4%
Taylor expanded in im around inf 96.4%
if -8.99999999999999957e26 < im < -1.05e10Initial program 100.0%
Taylor expanded in re around 0 25.0%
Applied egg-rr4.3%
log1p-expm1-u75.2%
associate-*l*75.2%
Applied egg-rr75.2%
if -1.05e10 < im < 92000Initial program 33.4%
Taylor expanded in im around 0 95.2%
mul-1-neg95.2%
unsub-neg95.2%
*-commutative95.2%
associate-*l*95.2%
distribute-lft-out--95.2%
Simplified95.2%
if 92000 < im < 1.09999999999999998e44Initial program 100.0%
Taylor expanded in im around 0 3.1%
mul-1-neg3.1%
*-commutative3.1%
distribute-rgt-neg-in3.1%
Simplified3.1%
log1p-expm1-u63.5%
distribute-rgt-neg-out63.5%
*-commutative63.5%
Applied egg-rr63.5%
Taylor expanded in re around 0 63.5%
Final simplification94.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.0001984126984126984 (* re (pow im 7.0)))))
(if (<= im -9e+26)
t_0
(if (<= im -10500000000.0)
(log1p (expm1 (* 0.5 (* re -3.0))))
(if (<= im 700.0) (* (- im) (sin re)) t_0)))))
double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (re * pow(im, 7.0));
double tmp;
if (im <= -9e+26) {
tmp = t_0;
} else if (im <= -10500000000.0) {
tmp = log1p(expm1((0.5 * (re * -3.0))));
} else if (im <= 700.0) {
tmp = -im * sin(re);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = -0.0001984126984126984 * (re * Math.pow(im, 7.0));
double tmp;
if (im <= -9e+26) {
tmp = t_0;
} else if (im <= -10500000000.0) {
tmp = Math.log1p(Math.expm1((0.5 * (re * -3.0))));
} else if (im <= 700.0) {
tmp = -im * Math.sin(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = -0.0001984126984126984 * (re * math.pow(im, 7.0)) tmp = 0 if im <= -9e+26: tmp = t_0 elif im <= -10500000000.0: tmp = math.log1p(math.expm1((0.5 * (re * -3.0)))) elif im <= 700.0: tmp = -im * math.sin(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(-0.0001984126984126984 * Float64(re * (im ^ 7.0))) tmp = 0.0 if (im <= -9e+26) tmp = t_0; elseif (im <= -10500000000.0) tmp = log1p(expm1(Float64(0.5 * Float64(re * -3.0)))); elseif (im <= 700.0) tmp = Float64(Float64(-im) * sin(re)); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(-0.0001984126984126984 * N[(re * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -9e+26], t$95$0, If[LessEqual[im, -10500000000.0], N[Log[1 + N[(Exp[N[(0.5 * N[(re * -3.0), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 700.0], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.0001984126984126984 \cdot \left(re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -9 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -10500000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(0.5 \cdot \left(re \cdot -3\right)\right)\right)\\
\mathbf{elif}\;im \leq 700:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -8.99999999999999957e26 or 700 < im Initial program 100.0%
Taylor expanded in im around 0 89.3%
associate-+r+89.3%
+-commutative89.3%
+-commutative89.3%
mul-1-neg89.3%
*-commutative89.3%
distribute-lft-neg-in89.3%
*-commutative89.3%
associate-*r*89.3%
distribute-rgt-out89.3%
*-commutative89.3%
associate-*l*89.3%
*-commutative89.3%
associate-*l*89.3%
distribute-lft-out89.3%
Simplified89.3%
Taylor expanded in im around inf 89.3%
Taylor expanded in re around 0 66.5%
if -8.99999999999999957e26 < im < -1.05e10Initial program 100.0%
Taylor expanded in re around 0 25.0%
Applied egg-rr4.3%
log1p-expm1-u75.2%
associate-*l*75.2%
Applied egg-rr75.2%
if -1.05e10 < im < 700Initial program 32.9%
Taylor expanded in im around 0 95.6%
mul-1-neg95.6%
*-commutative95.6%
distribute-rgt-neg-in95.6%
Simplified95.6%
Final simplification81.9%
(FPCore (re im) :precision binary64 (if (or (<= im -8e+25) (not (<= im 360.0))) (* -0.0001984126984126984 (* re (pow im 7.0))) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -8e+25) || !(im <= 360.0)) {
tmp = -0.0001984126984126984 * (re * pow(im, 7.0));
} else {
tmp = -im * sin(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-8d+25)) .or. (.not. (im <= 360.0d0))) then
tmp = (-0.0001984126984126984d0) * (re * (im ** 7.0d0))
else
tmp = -im * sin(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -8e+25) || !(im <= 360.0)) {
tmp = -0.0001984126984126984 * (re * Math.pow(im, 7.0));
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -8e+25) or not (im <= 360.0): tmp = -0.0001984126984126984 * (re * math.pow(im, 7.0)) else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -8e+25) || !(im <= 360.0)) tmp = Float64(-0.0001984126984126984 * Float64(re * (im ^ 7.0))); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -8e+25) || ~((im <= 360.0))) tmp = -0.0001984126984126984 * (re * (im ^ 7.0)); else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -8e+25], N[Not[LessEqual[im, 360.0]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(re * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -8 \cdot 10^{+25} \lor \neg \left(im \leq 360\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -8.00000000000000072e25 or 360 < im Initial program 100.0%
Taylor expanded in im around 0 89.3%
associate-+r+89.3%
+-commutative89.3%
+-commutative89.3%
mul-1-neg89.3%
*-commutative89.3%
distribute-lft-neg-in89.3%
*-commutative89.3%
associate-*r*89.3%
distribute-rgt-out89.3%
*-commutative89.3%
associate-*l*89.3%
*-commutative89.3%
associate-*l*89.3%
distribute-lft-out89.3%
Simplified89.3%
Taylor expanded in im around inf 89.3%
Taylor expanded in re around 0 66.5%
if -8.00000000000000072e25 < im < 360Initial program 36.7%
Taylor expanded in im around 0 90.3%
mul-1-neg90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
Simplified90.3%
Final simplification79.6%
(FPCore (re im) :precision binary64 (if (or (<= im -5.4e+31) (not (<= im 160000.0))) (* im (- re)) (* (- im) (sin re))))
double code(double re, double im) {
double tmp;
if ((im <= -5.4e+31) || !(im <= 160000.0)) {
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 <= (-5.4d+31)) .or. (.not. (im <= 160000.0d0))) 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 <= -5.4e+31) || !(im <= 160000.0)) {
tmp = im * -re;
} else {
tmp = -im * Math.sin(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -5.4e+31) or not (im <= 160000.0): tmp = im * -re else: tmp = -im * math.sin(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -5.4e+31) || !(im <= 160000.0)) tmp = Float64(im * Float64(-re)); else tmp = Float64(Float64(-im) * sin(re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -5.4e+31) || ~((im <= 160000.0))) tmp = im * -re; else tmp = -im * sin(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -5.4e+31], N[Not[LessEqual[im, 160000.0]], $MachinePrecision]], N[(im * (-re)), $MachinePrecision], N[((-im) * N[Sin[re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.4 \cdot 10^{+31} \lor \neg \left(im \leq 160000\right):\\
\;\;\;\;im \cdot \left(-re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-im\right) \cdot \sin re\\
\end{array}
\end{array}
if im < -5.39999999999999971e31 or 1.6e5 < im Initial program 100.0%
Taylor expanded in im around 0 4.6%
mul-1-neg4.6%
*-commutative4.6%
distribute-rgt-neg-in4.6%
Simplified4.6%
Taylor expanded in re around 0 15.1%
mul-1-neg15.1%
*-commutative15.1%
distribute-rgt-neg-in15.1%
Simplified15.1%
if -5.39999999999999971e31 < im < 1.6e5Initial program 37.6%
Taylor expanded in im around 0 89.1%
mul-1-neg89.1%
*-commutative89.1%
distribute-rgt-neg-in89.1%
Simplified89.1%
Final simplification56.4%
(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 65.1%
Taylor expanded in im around 0 51.8%
mul-1-neg51.8%
*-commutative51.8%
distribute-rgt-neg-in51.8%
Simplified51.8%
Taylor expanded in re around 0 32.6%
mul-1-neg32.6%
*-commutative32.6%
distribute-rgt-neg-in32.6%
Simplified32.6%
Final simplification32.6%
(FPCore (re im) :precision binary64 (* re -1.5))
double code(double re, double im) {
return re * -1.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re * (-1.5d0)
end function
public static double code(double re, double im) {
return re * -1.5;
}
def code(re, im): return re * -1.5
function code(re, im) return Float64(re * -1.5) end
function tmp = code(re, im) tmp = re * -1.5; end
code[re_, im_] := N[(re * -1.5), $MachinePrecision]
\begin{array}{l}
\\
re \cdot -1.5
\end{array}
Initial program 65.1%
Taylor expanded in re around 0 51.0%
Applied egg-rr3.2%
Taylor expanded in re around 0 3.2%
*-commutative3.2%
Simplified3.2%
Final simplification3.2%
(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 2023171
(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))))