
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (<= t_0 (- INFINITY))
(* (* 0.5 (cos re)) t_0)
(if (<= t_0 0.02)
(*
(cos re)
(-
(+
(* -0.16666666666666666 (pow im 3.0))
(* -0.008333333333333333 (pow im 5.0)))
im))
(* (cos re) (+ (* (exp im) -0.5) (* 0.5 (/ 1.0 (exp im)))))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (0.5 * cos(re)) * t_0;
} else if (t_0 <= 0.02) {
tmp = cos(re) * (((-0.16666666666666666 * pow(im, 3.0)) + (-0.008333333333333333 * pow(im, 5.0))) - im);
} else {
tmp = cos(re) * ((exp(im) * -0.5) + (0.5 * (1.0 / exp(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) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else if (t_0 <= 0.02) {
tmp = Math.cos(re) * (((-0.16666666666666666 * Math.pow(im, 3.0)) + (-0.008333333333333333 * Math.pow(im, 5.0))) - im);
} else {
tmp = Math.cos(re) * ((Math.exp(im) * -0.5) + (0.5 * (1.0 / Math.exp(im))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if t_0 <= -math.inf: tmp = (0.5 * math.cos(re)) * t_0 elif t_0 <= 0.02: tmp = math.cos(re) * (((-0.16666666666666666 * math.pow(im, 3.0)) + (-0.008333333333333333 * math.pow(im, 5.0))) - im) else: tmp = math.cos(re) * ((math.exp(im) * -0.5) + (0.5 * (1.0 / math.exp(im)))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); elseif (t_0 <= 0.02) tmp = Float64(cos(re) * Float64(Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) + Float64(-0.008333333333333333 * (im ^ 5.0))) - im)); else tmp = Float64(cos(re) * Float64(Float64(exp(im) * -0.5) + Float64(0.5 * Float64(1.0 / exp(im))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if (t_0 <= -Inf) tmp = (0.5 * cos(re)) * t_0; elseif (t_0 <= 0.02) tmp = cos(re) * (((-0.16666666666666666 * (im ^ 3.0)) + (-0.008333333333333333 * (im ^ 5.0))) - im); else tmp = cos(re) * ((exp(im) * -0.5) + (0.5 * (1.0 / exp(im)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$0, 0.02], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] + N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Exp[im], $MachinePrecision] * -0.5), $MachinePrecision] + N[(0.5 * N[(1.0 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{elif}\;t_0 \leq 0.02:\\
\;\;\;\;\cos re \cdot \left(\left(-0.16666666666666666 \cdot {im}^{3} + -0.008333333333333333 \cdot {im}^{5}\right) - im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(e^{im} \cdot -0.5 + 0.5 \cdot \frac{1}{e^{im}}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.0200000000000000004Initial program 8.5%
cos-neg8.5%
*-commutative8.5%
associate-*l*8.5%
sub-neg8.5%
neg-sub08.5%
+-commutative8.5%
distribute-lft-in8.5%
cos-neg8.5%
distribute-lft-in8.5%
distribute-rgt-in8.5%
distribute-lft-neg-out8.5%
distribute-rgt-neg-in8.5%
metadata-eval8.5%
metadata-eval8.5%
fma-def8.5%
metadata-eval8.5%
neg-sub08.5%
exp-diff8.4%
Simplified8.4%
Taylor expanded in im around 0 99.8%
if 0.0200000000000000004 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (<= t_0 (- INFINITY))
(* (* 0.5 (cos re)) t_0)
(if (<= t_0 2e-15)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(* (cos re) (+ (* (exp im) -0.5) (* 0.5 (/ 1.0 (exp im)))))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (0.5 * cos(re)) * t_0;
} else if (t_0 <= 2e-15) {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else {
tmp = cos(re) * ((exp(im) * -0.5) + (0.5 * (1.0 / exp(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) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else if (t_0 <= 2e-15) {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else {
tmp = Math.cos(re) * ((Math.exp(im) * -0.5) + (0.5 * (1.0 / Math.exp(im))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if t_0 <= -math.inf: tmp = (0.5 * math.cos(re)) * t_0 elif t_0 <= 2e-15: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) else: tmp = math.cos(re) * ((math.exp(im) * -0.5) + (0.5 * (1.0 / math.exp(im)))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); elseif (t_0 <= 2e-15) tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); else tmp = Float64(cos(re) * Float64(Float64(exp(im) * -0.5) + Float64(0.5 * Float64(1.0 / exp(im))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if (t_0 <= -Inf) tmp = (0.5 * cos(re)) * t_0; elseif (t_0 <= 2e-15) tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); else tmp = cos(re) * ((exp(im) * -0.5) + (0.5 * (1.0 / exp(im)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$0, 2e-15], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Exp[im], $MachinePrecision] * -0.5), $MachinePrecision] + N[(0.5 * N[(1.0 / N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{-15}:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(e^{im} \cdot -0.5 + 0.5 \cdot \frac{1}{e^{im}}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.0000000000000002e-15Initial program 7.8%
cos-neg7.8%
*-commutative7.8%
associate-*l*7.8%
sub-neg7.8%
neg-sub07.8%
+-commutative7.8%
distribute-lft-in7.8%
cos-neg7.8%
distribute-lft-in7.8%
distribute-rgt-in7.8%
distribute-lft-neg-out7.8%
distribute-rgt-neg-in7.8%
metadata-eval7.8%
metadata-eval7.8%
fma-def7.8%
metadata-eval7.8%
neg-sub07.8%
exp-diff7.8%
Simplified7.8%
Taylor expanded in im around 0 99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
+-commutative99.8%
neg-mul-199.8%
unsub-neg99.8%
Simplified99.8%
if 2.0000000000000002e-15 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
cos-neg99.9%
*-commutative99.9%
associate-*l*99.9%
sub-neg99.9%
neg-sub099.9%
+-commutative99.9%
distribute-lft-in99.9%
cos-neg99.9%
distribute-lft-in99.9%
distribute-rgt-in99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-def99.9%
metadata-eval99.9%
neg-sub099.9%
exp-diff99.9%
Simplified99.9%
Taylor expanded in im around inf 99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 2e-15)))
(* (* 0.5 (cos re)) t_0)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 2e-15)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 2e-15)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 2e-15): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 2e-15)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 2e-15))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 2e-15]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 2 \cdot 10^{-15}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 2.0000000000000002e-15 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
neg-sub099.9%
Simplified99.9%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 2.0000000000000002e-15Initial program 7.8%
cos-neg7.8%
*-commutative7.8%
associate-*l*7.8%
sub-neg7.8%
neg-sub07.8%
+-commutative7.8%
distribute-lft-in7.8%
cos-neg7.8%
distribute-lft-in7.8%
distribute-rgt-in7.8%
distribute-lft-neg-out7.8%
distribute-rgt-neg-in7.8%
metadata-eval7.8%
metadata-eval7.8%
fma-def7.8%
metadata-eval7.8%
neg-sub07.8%
exp-diff7.8%
Simplified7.8%
Taylor expanded in im around 0 99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
+-commutative99.8%
neg-mul-199.8%
unsub-neg99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (+ 0.5 (* (* re re) -0.25))))
(t_1 (* -0.008333333333333333 (* (cos re) (pow im 5.0)))))
(if (<= im -4.5e+61)
t_1
(if (<= im -0.048)
t_0
(if (<= im 0.28)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 4.4e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 + ((re * re) * -0.25));
double t_1 = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_1;
} else if (im <= -0.048) {
tmp = t_0;
} else if (im <= 0.28) {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 4.4e+61) {
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 * re) * (-0.25d0)))
t_1 = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
if (im <= (-4.5d+61)) then
tmp = t_1
else if (im <= (-0.048d0)) then
tmp = t_0
else if (im <= 0.28d0) then
tmp = cos(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else if (im <= 4.4d+61) 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 * re) * -0.25));
double t_1 = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -4.5e+61) {
tmp = t_1;
} else if (im <= -0.048) {
tmp = t_0;
} else if (im <= 0.28) {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 4.4e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 + ((re * re) * -0.25)) t_1 = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) tmp = 0 if im <= -4.5e+61: tmp = t_1 elif im <= -0.048: tmp = t_0 elif im <= 0.28: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 4.4e+61: 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 + Float64(Float64(re * re) * -0.25))) t_1 = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -4.5e+61) tmp = t_1; elseif (im <= -0.048) tmp = t_0; elseif (im <= 0.28) tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 4.4e+61) 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 * re) * -0.25)); t_1 = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -4.5e+61) tmp = t_1; elseif (im <= -0.048) tmp = t_0; elseif (im <= 0.28) tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); elseif (im <= 4.4e+61) 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 + N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+61], t$95$1, If[LessEqual[im, -0.048], t$95$0, If[LessEqual[im, 0.28], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.4e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 + \left(re \cdot re\right) \cdot -0.25\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.048:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.28:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 4.4 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.5e61 or 4.4000000000000001e61 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around inf 100.0%
if -4.5e61 < im < -0.048000000000000001 or 0.28000000000000003 < im < 4.4000000000000001e61Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 4.1%
associate-*r*4.1%
distribute-rgt-out88.1%
+-commutative88.1%
*-commutative88.1%
unpow288.1%
Simplified88.1%
if -0.048000000000000001 < im < 0.28000000000000003Initial program 8.5%
cos-neg8.5%
*-commutative8.5%
associate-*l*8.5%
sub-neg8.5%
neg-sub08.5%
+-commutative8.5%
distribute-lft-in8.5%
cos-neg8.5%
distribute-lft-in8.5%
distribute-rgt-in8.5%
distribute-lft-neg-out8.5%
distribute-rgt-neg-in8.5%
metadata-eval8.5%
metadata-eval8.5%
fma-def8.5%
metadata-eval8.5%
neg-sub08.5%
exp-diff8.4%
Simplified8.4%
Taylor expanded in im around 0 99.6%
associate-*r*99.6%
associate-*r*99.6%
distribute-rgt-out99.6%
*-commutative99.6%
+-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Final simplification98.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.008333333333333333 (* (cos re) (pow im 5.0)))))
(if (<= im -2.8e+78)
t_1
(if (<= im -0.0066)
t_0
(if (<= im 55000000000000.0)
(* im (- (cos re)))
(if (<= im 7.5e+48) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
double tmp;
if (im <= -2.8e+78) {
tmp = t_1;
} else if (im <= -0.0066) {
tmp = t_0;
} else if (im <= 55000000000000.0) {
tmp = im * -cos(re);
} else if (im <= 7.5e+48) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
if (im <= (-2.8d+78)) then
tmp = t_1
else if (im <= (-0.0066d0)) then
tmp = t_0
else if (im <= 55000000000000.0d0) then
tmp = im * -cos(re)
else if (im <= 7.5d+48) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -2.8e+78) {
tmp = t_1;
} else if (im <= -0.0066) {
tmp = t_0;
} else if (im <= 55000000000000.0) {
tmp = im * -Math.cos(re);
} else if (im <= 7.5e+48) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) tmp = 0 if im <= -2.8e+78: tmp = t_1 elif im <= -0.0066: tmp = t_0 elif im <= 55000000000000.0: tmp = im * -math.cos(re) elif im <= 7.5e+48: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -2.8e+78) tmp = t_1; elseif (im <= -0.0066) tmp = t_0; elseif (im <= 55000000000000.0) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 7.5e+48) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -2.8e+78) tmp = t_1; elseif (im <= -0.0066) tmp = t_0; elseif (im <= 55000000000000.0) tmp = im * -cos(re); elseif (im <= 7.5e+48) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.8e+78], t$95$1, If[LessEqual[im, -0.0066], t$95$0, If[LessEqual[im, 55000000000000.0], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 7.5e+48], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -2.8 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0066:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 55000000000000:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 7.5 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.8000000000000001e78 or 7.5000000000000006e48 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 98.1%
Taylor expanded in im around inf 98.1%
if -2.8000000000000001e78 < im < -0.0066 or 5.5e13 < im < 7.5000000000000006e48Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 80.0%
if -0.0066 < im < 5.5e13Initial program 9.2%
cos-neg9.2%
*-commutative9.2%
associate-*l*9.2%
sub-neg9.2%
neg-sub09.2%
+-commutative9.2%
distribute-lft-in9.2%
cos-neg9.2%
distribute-lft-in9.2%
distribute-rgt-in9.2%
distribute-lft-neg-out9.2%
distribute-rgt-neg-in9.2%
metadata-eval9.2%
metadata-eval9.2%
fma-def9.2%
metadata-eval9.2%
neg-sub09.2%
exp-diff9.1%
Simplified9.1%
Taylor expanded in im around 0 98.3%
associate-*r*98.3%
neg-mul-198.3%
Simplified98.3%
Final simplification96.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.008333333333333333 (* (cos re) (pow im 5.0)))))
(if (<= im -2.8e+78)
t_1
(if (<= im -0.048)
t_0
(if (<= im 55000000000000.0)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 7.5e+48) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
double tmp;
if (im <= -2.8e+78) {
tmp = t_1;
} else if (im <= -0.048) {
tmp = t_0;
} else if (im <= 55000000000000.0) {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 7.5e+48) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
if (im <= (-2.8d+78)) then
tmp = t_1
else if (im <= (-0.048d0)) then
tmp = t_0
else if (im <= 55000000000000.0d0) then
tmp = cos(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else if (im <= 7.5d+48) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -2.8e+78) {
tmp = t_1;
} else if (im <= -0.048) {
tmp = t_0;
} else if (im <= 55000000000000.0) {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 7.5e+48) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) tmp = 0 if im <= -2.8e+78: tmp = t_1 elif im <= -0.048: tmp = t_0 elif im <= 55000000000000.0: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 7.5e+48: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -2.8e+78) tmp = t_1; elseif (im <= -0.048) tmp = t_0; elseif (im <= 55000000000000.0) tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 7.5e+48) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -2.8e+78) tmp = t_1; elseif (im <= -0.048) tmp = t_0; elseif (im <= 55000000000000.0) tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); elseif (im <= 7.5e+48) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.8e+78], t$95$1, If[LessEqual[im, -0.048], t$95$0, If[LessEqual[im, 55000000000000.0], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.5e+48], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -2.8 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.048:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 55000000000000:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 7.5 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.8000000000000001e78 or 7.5000000000000006e48 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 98.1%
Taylor expanded in im around inf 98.1%
if -2.8000000000000001e78 < im < -0.048000000000000001 or 5.5e13 < im < 7.5000000000000006e48Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 80.0%
if -0.048000000000000001 < im < 5.5e13Initial program 9.2%
cos-neg9.2%
*-commutative9.2%
associate-*l*9.2%
sub-neg9.2%
neg-sub09.2%
+-commutative9.2%
distribute-lft-in9.2%
cos-neg9.2%
distribute-lft-in9.2%
distribute-rgt-in9.2%
distribute-lft-neg-out9.2%
distribute-rgt-neg-in9.2%
metadata-eval9.2%
metadata-eval9.2%
fma-def9.2%
metadata-eval9.2%
neg-sub09.2%
exp-diff9.1%
Simplified9.1%
Taylor expanded in im around 0 98.9%
associate-*r*98.9%
associate-*r*98.9%
distribute-rgt-out98.9%
*-commutative98.9%
+-commutative98.9%
neg-mul-198.9%
unsub-neg98.9%
Simplified98.9%
Final simplification96.8%
(FPCore (re im) :precision binary64 (if (or (<= im -3.3) (not (<= im 3.4))) (* -0.008333333333333333 (* (cos re) (pow im 5.0))) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.4)) {
tmp = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-3.3d0)) .or. (.not. (im <= 3.4d0))) then
tmp = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.4)) {
tmp = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.3) or not (im <= 3.4): tmp = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.3) || !(im <= 3.4)) tmp = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.3) || ~((im <= 3.4))) tmp = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.3], N[Not[LessEqual[im, 3.4]], $MachinePrecision]], N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.4\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -3.2999999999999998 or 3.39999999999999991 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 81.2%
Taylor expanded in im around inf 81.2%
if -3.2999999999999998 < im < 3.39999999999999991Initial program 9.2%
cos-neg9.2%
*-commutative9.2%
associate-*l*9.2%
sub-neg9.2%
neg-sub09.2%
+-commutative9.2%
distribute-lft-in9.2%
cos-neg9.2%
distribute-lft-in9.2%
distribute-rgt-in9.2%
distribute-lft-neg-out9.2%
distribute-rgt-neg-in9.2%
metadata-eval9.2%
metadata-eval9.2%
fma-def9.2%
metadata-eval9.2%
neg-sub09.2%
exp-diff9.1%
Simplified9.1%
Taylor expanded in im around 0 98.5%
associate-*r*98.5%
neg-mul-198.5%
Simplified98.5%
Final simplification90.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (pow im 3.0)))
(t_1 (+ 1.0 (* -0.5 (* re re)))))
(if (<= im -2.5e+102)
(* t_0 t_1)
(if (<= im -4.4e+37)
(* -0.008333333333333333 (pow im 5.0))
(if (or (<= im -0.07) (not (<= im 480.0)))
(* (- t_0 im) t_1)
(* im (- (cos re))))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * pow(im, 3.0);
double t_1 = 1.0 + (-0.5 * (re * re));
double tmp;
if (im <= -2.5e+102) {
tmp = t_0 * t_1;
} else if (im <= -4.4e+37) {
tmp = -0.008333333333333333 * pow(im, 5.0);
} else if ((im <= -0.07) || !(im <= 480.0)) {
tmp = (t_0 - im) * t_1;
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (im ** 3.0d0)
t_1 = 1.0d0 + ((-0.5d0) * (re * re))
if (im <= (-2.5d+102)) then
tmp = t_0 * t_1
else if (im <= (-4.4d+37)) then
tmp = (-0.008333333333333333d0) * (im ** 5.0d0)
else if ((im <= (-0.07d0)) .or. (.not. (im <= 480.0d0))) then
tmp = (t_0 - im) * t_1
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * Math.pow(im, 3.0);
double t_1 = 1.0 + (-0.5 * (re * re));
double tmp;
if (im <= -2.5e+102) {
tmp = t_0 * t_1;
} else if (im <= -4.4e+37) {
tmp = -0.008333333333333333 * Math.pow(im, 5.0);
} else if ((im <= -0.07) || !(im <= 480.0)) {
tmp = (t_0 - im) * t_1;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * math.pow(im, 3.0) t_1 = 1.0 + (-0.5 * (re * re)) tmp = 0 if im <= -2.5e+102: tmp = t_0 * t_1 elif im <= -4.4e+37: tmp = -0.008333333333333333 * math.pow(im, 5.0) elif (im <= -0.07) or not (im <= 480.0): tmp = (t_0 - im) * t_1 else: tmp = im * -math.cos(re) return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * (im ^ 3.0)) t_1 = Float64(1.0 + Float64(-0.5 * Float64(re * re))) tmp = 0.0 if (im <= -2.5e+102) tmp = Float64(t_0 * t_1); elseif (im <= -4.4e+37) tmp = Float64(-0.008333333333333333 * (im ^ 5.0)); elseif ((im <= -0.07) || !(im <= 480.0)) tmp = Float64(Float64(t_0 - im) * t_1); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (im ^ 3.0); t_1 = 1.0 + (-0.5 * (re * re)); tmp = 0.0; if (im <= -2.5e+102) tmp = t_0 * t_1; elseif (im <= -4.4e+37) tmp = -0.008333333333333333 * (im ^ 5.0); elseif ((im <= -0.07) || ~((im <= 480.0))) tmp = (t_0 - im) * t_1; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.5e+102], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[im, -4.4e+37], N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -0.07], N[Not[LessEqual[im, 480.0]], $MachinePrecision]], N[(N[(t$95$0 - im), $MachinePrecision] * t$95$1), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot {im}^{3}\\
t_1 := 1 + -0.5 \cdot \left(re \cdot re\right)\\
\mathbf{if}\;im \leq -2.5 \cdot 10^{+102}:\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{elif}\;im \leq -4.4 \cdot 10^{+37}:\\
\;\;\;\;-0.008333333333333333 \cdot {im}^{5}\\
\mathbf{elif}\;im \leq -0.07 \lor \neg \left(im \leq 480\right):\\
\;\;\;\;\left(t_0 - im\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -2.5e102Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
+-commutative100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
associate--l+0.0%
associate-*r*0.0%
distribute-lft1-in91.2%
unpow291.2%
Simplified91.2%
Taylor expanded in im around inf 91.2%
associate-*r*91.2%
unpow291.2%
Simplified91.2%
if -2.5e102 < im < -4.4000000000000001e37Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 56.7%
Taylor expanded in im around inf 56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
Taylor expanded in re around 0 49.1%
if -4.4000000000000001e37 < im < -0.070000000000000007 or 480 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 63.9%
associate-*r*63.9%
associate-*r*63.9%
distribute-rgt-out63.9%
*-commutative63.9%
+-commutative63.9%
neg-mul-163.9%
unsub-neg63.9%
Simplified63.9%
Taylor expanded in re around 0 12.5%
associate--l+12.5%
associate-*r*12.5%
distribute-lft1-in59.2%
unpow259.2%
Simplified59.2%
if -0.070000000000000007 < im < 480Initial program 8.5%
cos-neg8.5%
*-commutative8.5%
associate-*l*8.5%
sub-neg8.5%
neg-sub08.5%
+-commutative8.5%
distribute-lft-in8.5%
cos-neg8.5%
distribute-lft-in8.5%
distribute-rgt-in8.5%
distribute-lft-neg-out8.5%
distribute-rgt-neg-in8.5%
metadata-eval8.5%
metadata-eval8.5%
fma-def8.5%
metadata-eval8.5%
neg-sub08.5%
exp-diff8.4%
Simplified8.4%
Taylor expanded in im around 0 99.0%
associate-*r*99.0%
neg-mul-199.0%
Simplified99.0%
Final simplification83.7%
(FPCore (re im)
:precision binary64
(let* ((t_0
(* (* -0.16666666666666666 (pow im 3.0)) (+ 1.0 (* -0.5 (* re re))))))
(if (<= im -2e+103)
t_0
(if (<= im -4.4e+37)
(* -0.008333333333333333 (pow im 5.0))
(if (or (<= im -550.0) (not (<= im 560.0))) t_0 (* im (- (cos re))))))))
double code(double re, double im) {
double t_0 = (-0.16666666666666666 * pow(im, 3.0)) * (1.0 + (-0.5 * (re * re)));
double tmp;
if (im <= -2e+103) {
tmp = t_0;
} else if (im <= -4.4e+37) {
tmp = -0.008333333333333333 * pow(im, 5.0);
} else if ((im <= -550.0) || !(im <= 560.0)) {
tmp = t_0;
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((-0.16666666666666666d0) * (im ** 3.0d0)) * (1.0d0 + ((-0.5d0) * (re * re)))
if (im <= (-2d+103)) then
tmp = t_0
else if (im <= (-4.4d+37)) then
tmp = (-0.008333333333333333d0) * (im ** 5.0d0)
else if ((im <= (-550.0d0)) .or. (.not. (im <= 560.0d0))) then
tmp = t_0
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (-0.16666666666666666 * Math.pow(im, 3.0)) * (1.0 + (-0.5 * (re * re)));
double tmp;
if (im <= -2e+103) {
tmp = t_0;
} else if (im <= -4.4e+37) {
tmp = -0.008333333333333333 * Math.pow(im, 5.0);
} else if ((im <= -550.0) || !(im <= 560.0)) {
tmp = t_0;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): t_0 = (-0.16666666666666666 * math.pow(im, 3.0)) * (1.0 + (-0.5 * (re * re))) tmp = 0 if im <= -2e+103: tmp = t_0 elif im <= -4.4e+37: tmp = -0.008333333333333333 * math.pow(im, 5.0) elif (im <= -550.0) or not (im <= 560.0): tmp = t_0 else: tmp = im * -math.cos(re) return tmp
function code(re, im) t_0 = Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) * Float64(1.0 + Float64(-0.5 * Float64(re * re)))) tmp = 0.0 if (im <= -2e+103) tmp = t_0; elseif (im <= -4.4e+37) tmp = Float64(-0.008333333333333333 * (im ^ 5.0)); elseif ((im <= -550.0) || !(im <= 560.0)) tmp = t_0; else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = (-0.16666666666666666 * (im ^ 3.0)) * (1.0 + (-0.5 * (re * re))); tmp = 0.0; if (im <= -2e+103) tmp = t_0; elseif (im <= -4.4e+37) tmp = -0.008333333333333333 * (im ^ 5.0); elseif ((im <= -550.0) || ~((im <= 560.0))) tmp = t_0; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+103], t$95$0, If[LessEqual[im, -4.4e+37], N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -550.0], N[Not[LessEqual[im, 560.0]], $MachinePrecision]], t$95$0, N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-0.16666666666666666 \cdot {im}^{3}\right) \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\\
\mathbf{if}\;im \leq -2 \cdot 10^{+103}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -4.4 \cdot 10^{+37}:\\
\;\;\;\;-0.008333333333333333 \cdot {im}^{5}\\
\mathbf{elif}\;im \leq -550 \lor \neg \left(im \leq 560\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -2e103 or -4.4000000000000001e37 < im < -550 or 560 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 76.0%
associate-*r*76.0%
associate-*r*76.0%
distribute-rgt-out76.0%
*-commutative76.0%
+-commutative76.0%
neg-mul-176.0%
unsub-neg76.0%
Simplified76.0%
Taylor expanded in re around 0 8.2%
associate--l+8.2%
associate-*r*8.2%
distribute-lft1-in69.9%
unpow269.9%
Simplified69.9%
Taylor expanded in im around inf 69.9%
associate-*r*69.9%
unpow269.9%
Simplified69.9%
if -2e103 < im < -4.4000000000000001e37Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 56.7%
Taylor expanded in im around inf 56.7%
associate-*r*56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
Taylor expanded in re around 0 49.1%
if -550 < im < 560Initial program 9.8%
cos-neg9.8%
*-commutative9.8%
associate-*l*9.8%
sub-neg9.8%
neg-sub09.8%
+-commutative9.8%
distribute-lft-in9.8%
cos-neg9.8%
distribute-lft-in9.8%
distribute-rgt-in9.8%
distribute-lft-neg-out9.8%
distribute-rgt-neg-in9.8%
metadata-eval9.8%
metadata-eval9.8%
fma-def9.8%
metadata-eval9.8%
neg-sub09.8%
exp-diff9.8%
Simplified9.8%
Taylor expanded in im around 0 97.8%
associate-*r*97.8%
neg-mul-197.8%
Simplified97.8%
Final simplification83.7%
(FPCore (re im) :precision binary64 (if (<= (cos re) -0.002) (* im (- -1.0 (* -0.5 (* re re)))) (- im)))
double code(double re, double im) {
double tmp;
if (cos(re) <= -0.002) {
tmp = im * (-1.0 - (-0.5 * (re * re)));
} else {
tmp = -im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (cos(re) <= (-0.002d0)) then
tmp = im * ((-1.0d0) - ((-0.5d0) * (re * re)))
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.cos(re) <= -0.002) {
tmp = im * (-1.0 - (-0.5 * (re * re)));
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= -0.002: tmp = im * (-1.0 - (-0.5 * (re * re))) else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= -0.002) tmp = Float64(im * Float64(-1.0 - Float64(-0.5 * Float64(re * re)))); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= -0.002) tmp = im * (-1.0 - (-0.5 * (re * re))); else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], -0.002], N[(im * N[(-1.0 - N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq -0.002:\\
\;\;\;\;im \cdot \left(-1 - -0.5 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if (cos.f64 re) < -2e-3Initial program 54.5%
cos-neg54.5%
*-commutative54.5%
associate-*l*54.5%
sub-neg54.5%
neg-sub054.5%
+-commutative54.5%
distribute-lft-in54.5%
cos-neg54.5%
distribute-lft-in54.5%
distribute-rgt-in54.5%
distribute-lft-neg-out54.5%
distribute-rgt-neg-in54.5%
metadata-eval54.5%
metadata-eval54.5%
fma-def54.5%
metadata-eval54.5%
neg-sub054.5%
exp-diff54.6%
Simplified54.6%
Taylor expanded in im around 0 83.5%
associate-*r*83.5%
associate-*r*83.5%
distribute-rgt-out83.5%
*-commutative83.5%
+-commutative83.5%
neg-mul-183.5%
unsub-neg83.5%
Simplified83.5%
Taylor expanded in re around 0 14.6%
associate--l+14.6%
associate-*r*14.6%
distribute-lft1-in48.4%
unpow248.4%
Simplified48.4%
Taylor expanded in im around 0 41.7%
mul-1-neg41.7%
Simplified41.7%
if -2e-3 < (cos.f64 re) Initial program 51.1%
cos-neg51.1%
*-commutative51.1%
associate-*l*51.1%
sub-neg51.1%
neg-sub051.1%
+-commutative51.1%
distribute-lft-in51.1%
cos-neg51.1%
distribute-lft-in51.1%
distribute-rgt-in51.1%
distribute-lft-neg-out51.1%
distribute-rgt-neg-in51.1%
metadata-eval51.1%
metadata-eval51.1%
fma-def51.1%
metadata-eval51.1%
neg-sub051.1%
exp-diff51.1%
Simplified51.1%
Taylor expanded in im around 0 91.6%
Taylor expanded in im around inf 91.0%
Taylor expanded in re around 0 74.7%
Taylor expanded in im around 0 39.3%
mul-1-neg39.3%
Simplified39.3%
Final simplification40.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.008333333333333333 (pow im 5.0))))
(if (<= im -2e+36)
t_0
(if (<= im 1.15e+58) (* im (- (cos re))) (- t_0 im)))))
double code(double re, double im) {
double t_0 = -0.008333333333333333 * pow(im, 5.0);
double tmp;
if (im <= -2e+36) {
tmp = t_0;
} else if (im <= 1.15e+58) {
tmp = im * -cos(re);
} else {
tmp = t_0 - 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 = (-0.008333333333333333d0) * (im ** 5.0d0)
if (im <= (-2d+36)) then
tmp = t_0
else if (im <= 1.15d+58) then
tmp = im * -cos(re)
else
tmp = t_0 - im
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.008333333333333333 * Math.pow(im, 5.0);
double tmp;
if (im <= -2e+36) {
tmp = t_0;
} else if (im <= 1.15e+58) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0 - im;
}
return tmp;
}
def code(re, im): t_0 = -0.008333333333333333 * math.pow(im, 5.0) tmp = 0 if im <= -2e+36: tmp = t_0 elif im <= 1.15e+58: tmp = im * -math.cos(re) else: tmp = t_0 - im return tmp
function code(re, im) t_0 = Float64(-0.008333333333333333 * (im ^ 5.0)) tmp = 0.0 if (im <= -2e+36) tmp = t_0; elseif (im <= 1.15e+58) tmp = Float64(im * Float64(-cos(re))); else tmp = Float64(t_0 - im); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.008333333333333333 * (im ^ 5.0); tmp = 0.0; if (im <= -2e+36) tmp = t_0; elseif (im <= 1.15e+58) tmp = im * -cos(re); else tmp = t_0 - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+36], t$95$0, If[LessEqual[im, 1.15e+58], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.008333333333333333 \cdot {im}^{5}\\
\mathbf{if}\;im \leq -2 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 1.15 \cdot 10^{+58}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -2.00000000000000008e36Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 88.0%
Taylor expanded in im around inf 88.0%
associate-*r*88.0%
*-commutative88.0%
associate-*l*88.0%
Simplified88.0%
Taylor expanded in re around 0 60.4%
if -2.00000000000000008e36 < im < 1.15000000000000001e58Initial program 19.8%
cos-neg19.8%
*-commutative19.8%
associate-*l*19.8%
sub-neg19.8%
neg-sub019.8%
+-commutative19.8%
distribute-lft-in19.8%
cos-neg19.8%
distribute-lft-in19.8%
distribute-rgt-in19.8%
distribute-lft-neg-out19.8%
distribute-rgt-neg-in19.8%
metadata-eval19.8%
metadata-eval19.8%
fma-def19.8%
metadata-eval19.8%
neg-sub019.8%
exp-diff19.8%
Simplified19.8%
Taylor expanded in im around 0 87.3%
associate-*r*87.3%
neg-mul-187.3%
Simplified87.3%
if 1.15000000000000001e58 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around inf 100.0%
Taylor expanded in re around 0 73.2%
Final simplification79.3%
(FPCore (re im) :precision binary64 (if (or (<= im -1320.0) (not (<= im 59000.0))) (* im (- -1.0 (* -0.5 (* re re)))) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -1320.0) || !(im <= 59000.0)) {
tmp = im * (-1.0 - (-0.5 * (re * re)));
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1320.0d0)) .or. (.not. (im <= 59000.0d0))) then
tmp = im * ((-1.0d0) - ((-0.5d0) * (re * re)))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1320.0) || !(im <= 59000.0)) {
tmp = im * (-1.0 - (-0.5 * (re * re)));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1320.0) or not (im <= 59000.0): tmp = im * (-1.0 - (-0.5 * (re * re))) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1320.0) || !(im <= 59000.0)) tmp = Float64(im * Float64(-1.0 - Float64(-0.5 * Float64(re * re)))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1320.0) || ~((im <= 59000.0))) tmp = im * (-1.0 - (-0.5 * (re * re))); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1320.0], N[Not[LessEqual[im, 59000.0]], $MachinePrecision]], N[(im * N[(-1.0 - N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1320 \lor \neg \left(im \leq 59000\right):\\
\;\;\;\;im \cdot \left(-1 - -0.5 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -1320 or 59000 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 69.0%
associate-*r*69.0%
associate-*r*69.0%
distribute-rgt-out69.0%
*-commutative69.0%
+-commutative69.0%
neg-mul-169.0%
unsub-neg69.0%
Simplified69.0%
Taylor expanded in re around 0 8.7%
associate--l+8.7%
associate-*r*8.7%
distribute-lft1-in64.1%
unpow264.1%
Simplified64.1%
Taylor expanded in im around 0 26.7%
mul-1-neg26.7%
Simplified26.7%
if -1320 < im < 59000Initial program 10.5%
cos-neg10.5%
*-commutative10.5%
associate-*l*10.5%
sub-neg10.5%
neg-sub010.5%
+-commutative10.5%
distribute-lft-in10.5%
cos-neg10.5%
distribute-lft-in10.5%
distribute-rgt-in10.5%
distribute-lft-neg-out10.5%
distribute-rgt-neg-in10.5%
metadata-eval10.5%
metadata-eval10.5%
fma-def10.5%
metadata-eval10.5%
neg-sub010.5%
exp-diff10.4%
Simplified10.4%
Taylor expanded in im around 0 97.1%
associate-*r*97.1%
neg-mul-197.1%
Simplified97.1%
Final simplification64.4%
(FPCore (re im) :precision binary64 (if (or (<= im -2.35e+36) (not (<= im 1.15e+58))) (* -0.008333333333333333 (pow im 5.0)) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -2.35e+36) || !(im <= 1.15e+58)) {
tmp = -0.008333333333333333 * pow(im, 5.0);
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-2.35d+36)) .or. (.not. (im <= 1.15d+58))) then
tmp = (-0.008333333333333333d0) * (im ** 5.0d0)
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -2.35e+36) || !(im <= 1.15e+58)) {
tmp = -0.008333333333333333 * Math.pow(im, 5.0);
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -2.35e+36) or not (im <= 1.15e+58): tmp = -0.008333333333333333 * math.pow(im, 5.0) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -2.35e+36) || !(im <= 1.15e+58)) tmp = Float64(-0.008333333333333333 * (im ^ 5.0)); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -2.35e+36) || ~((im <= 1.15e+58))) tmp = -0.008333333333333333 * (im ^ 5.0); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -2.35e+36], N[Not[LessEqual[im, 1.15e+58]], $MachinePrecision]], N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.35 \cdot 10^{+36} \lor \neg \left(im \leq 1.15 \cdot 10^{+58}\right):\\
\;\;\;\;-0.008333333333333333 \cdot {im}^{5}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -2.34999999999999994e36 or 1.15000000000000001e58 < im Initial program 100.0%
cos-neg100.0%
*-commutative100.0%
associate-*l*100.0%
sub-neg100.0%
neg-sub0100.0%
+-commutative100.0%
distribute-lft-in100.0%
cos-neg100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
neg-sub0100.0%
exp-diff100.0%
Simplified100.0%
Taylor expanded in im around 0 94.5%
Taylor expanded in im around inf 94.5%
associate-*r*94.5%
*-commutative94.5%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in re around 0 67.4%
if -2.34999999999999994e36 < im < 1.15000000000000001e58Initial program 19.8%
cos-neg19.8%
*-commutative19.8%
associate-*l*19.8%
sub-neg19.8%
neg-sub019.8%
+-commutative19.8%
distribute-lft-in19.8%
cos-neg19.8%
distribute-lft-in19.8%
distribute-rgt-in19.8%
distribute-lft-neg-out19.8%
distribute-rgt-neg-in19.8%
metadata-eval19.8%
metadata-eval19.8%
fma-def19.8%
metadata-eval19.8%
neg-sub019.8%
exp-diff19.8%
Simplified19.8%
Taylor expanded in im around 0 87.3%
associate-*r*87.3%
neg-mul-187.3%
Simplified87.3%
Final simplification79.3%
(FPCore (re im) :precision binary64 (if (<= re 1.38e+153) (- im) (+ 27.0 (* re (* re -13.5)))))
double code(double re, double im) {
double tmp;
if (re <= 1.38e+153) {
tmp = -im;
} else {
tmp = 27.0 + (re * (re * -13.5));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 1.38d+153) then
tmp = -im
else
tmp = 27.0d0 + (re * (re * (-13.5d0)))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 1.38e+153) {
tmp = -im;
} else {
tmp = 27.0 + (re * (re * -13.5));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 1.38e+153: tmp = -im else: tmp = 27.0 + (re * (re * -13.5)) return tmp
function code(re, im) tmp = 0.0 if (re <= 1.38e+153) tmp = Float64(-im); else tmp = Float64(27.0 + Float64(re * Float64(re * -13.5))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 1.38e+153) tmp = -im; else tmp = 27.0 + (re * (re * -13.5)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 1.38e+153], (-im), N[(27.0 + N[(re * N[(re * -13.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 1.38 \cdot 10^{+153}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;27 + re \cdot \left(re \cdot -13.5\right)\\
\end{array}
\end{array}
if re < 1.38e153Initial program 53.1%
cos-neg53.1%
*-commutative53.1%
associate-*l*53.1%
sub-neg53.1%
neg-sub053.1%
+-commutative53.1%
distribute-lft-in53.1%
cos-neg53.1%
distribute-lft-in53.1%
distribute-rgt-in53.1%
distribute-lft-neg-out53.1%
distribute-rgt-neg-in53.1%
metadata-eval53.1%
metadata-eval53.1%
fma-def53.1%
metadata-eval53.1%
neg-sub053.1%
exp-diff53.1%
Simplified53.1%
Taylor expanded in im around 0 91.0%
Taylor expanded in im around inf 90.4%
Taylor expanded in re around 0 60.1%
Taylor expanded in im around 0 32.5%
mul-1-neg32.5%
Simplified32.5%
if 1.38e153 < re Initial program 46.5%
cos-neg46.5%
*-commutative46.5%
associate-*l*46.5%
sub-neg46.5%
neg-sub046.5%
+-commutative46.5%
distribute-lft-in46.5%
cos-neg46.5%
distribute-lft-in46.5%
distribute-rgt-in46.5%
distribute-lft-neg-out46.5%
distribute-rgt-neg-in46.5%
metadata-eval46.5%
metadata-eval46.5%
fma-def46.5%
metadata-eval46.5%
neg-sub046.5%
exp-diff46.4%
Simplified46.4%
Applied egg-rr2.8%
Taylor expanded in re around 0 16.1%
*-commutative16.1%
unpow216.1%
Simplified16.1%
Taylor expanded in re around 0 16.1%
*-commutative16.1%
unpow216.1%
associate-*r*16.1%
Simplified16.1%
Final simplification29.9%
(FPCore (re im) :precision binary64 (- im))
double code(double re, double im) {
return -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -im
end function
public static double code(double re, double im) {
return -im;
}
def code(re, im): return -im
function code(re, im) return Float64(-im) end
function tmp = code(re, im) tmp = -im; end
code[re_, im_] := (-im)
\begin{array}{l}
\\
-im
\end{array}
Initial program 52.1%
cos-neg52.1%
*-commutative52.1%
associate-*l*52.1%
sub-neg52.1%
neg-sub052.1%
+-commutative52.1%
distribute-lft-in52.1%
cos-neg52.1%
distribute-lft-in52.1%
distribute-rgt-in52.1%
distribute-lft-neg-out52.1%
distribute-rgt-neg-in52.1%
metadata-eval52.1%
metadata-eval52.1%
fma-def52.1%
metadata-eval52.1%
neg-sub052.1%
exp-diff52.1%
Simplified52.1%
Taylor expanded in im around 0 90.9%
Taylor expanded in im around inf 90.3%
Taylor expanded in re around 0 54.5%
Taylor expanded in im around 0 29.0%
mul-1-neg29.0%
Simplified29.0%
Final simplification29.0%
(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 52.1%
cos-neg52.1%
*-commutative52.1%
associate-*l*52.1%
sub-neg52.1%
neg-sub052.1%
+-commutative52.1%
distribute-lft-in52.1%
cos-neg52.1%
distribute-lft-in52.1%
distribute-rgt-in52.1%
distribute-lft-neg-out52.1%
distribute-rgt-neg-in52.1%
metadata-eval52.1%
metadata-eval52.1%
fma-def52.1%
metadata-eval52.1%
neg-sub052.1%
exp-diff52.1%
Simplified52.1%
Applied egg-rr3.0%
Taylor expanded in re around 0 3.0%
Final simplification3.0%
(FPCore (re im)
:precision binary64
(if (< (fabs im) 1.0)
(-
(*
(cos re)
(+
(+ im (* (* (* 0.16666666666666666 im) im) im))
(* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im)))))
double code(double re, double im) {
double tmp;
if (fabs(im) < 1.0) {
tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (abs(im) < 1.0d0) then
tmp = -(cos(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
else
tmp = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.abs(im) < 1.0) {
tmp = -(Math.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
} else {
tmp = (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if math.fabs(im) < 1.0: tmp = -(math.cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))) else: tmp = (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if (abs(im) < 1.0) tmp = Float64(-Float64(cos(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im)))); else tmp = Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (abs(im) < 1.0) tmp = -(cos(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im))); else tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Cos[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left|im\right| < 1:\\
\;\;\;\;-\cos re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)\\
\end{array}
\end{array}
herbie shell --seed 2023283
(FPCore (re im)
:name "math.sin on complex, imaginary part"
:precision binary64
:herbie-target
(if (< (fabs im) 1.0) (- (* (cos re) (+ (+ im (* (* (* 0.16666666666666666 im) im) im)) (* (* (* (* (* 0.008333333333333333 im) im) im) im) im)))) (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))