
(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 18 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 (or (<= t_0 (- INFINITY)) (not (<= t_0 0.05)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(- (* (pow im 3.0) -0.16666666666666666) im)
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 5.0) -0.008333333333333333)))))))
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 = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 3.0) * -0.16666666666666666) - im) + ((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 5.0) * -0.008333333333333333)));
}
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 = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * (((Math.pow(im, 3.0) * -0.16666666666666666) - im) + ((Math.pow(im, 7.0) * -0.0001984126984126984) + (Math.pow(im, 5.0) * -0.008333333333333333)));
}
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 = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * (((math.pow(im, 3.0) * -0.16666666666666666) - im) + ((math.pow(im, 7.0) * -0.0001984126984126984) + (math.pow(im, 5.0) * -0.008333333333333333))) 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(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) + Float64(Float64((im ^ 7.0) * -0.0001984126984126984) + Float64((im ^ 5.0) * -0.008333333333333333)))); 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 = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 3.0) * -0.16666666666666666) - im) + (((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 5.0) * -0.008333333333333333))); 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[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] + N[(N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $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):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{3} \cdot -0.16666666666666666 - im\right) + \left({im}^{7} \cdot -0.0001984126984126984 + {im}^{5} \cdot -0.008333333333333333\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 0.050000000000000003 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.050000000000000003Initial program 8.2%
sub0-neg8.2%
Simplified8.2%
Taylor expanded in im around 0 99.8%
associate-+r+99.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 (* 0.5 (cos re))) (t_1 (- (exp (- im)) (exp im))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.05)))
(* t_0 t_1)
(*
t_0
(+
(* im -2.0)
(+
(* (pow im 5.0) -0.016666666666666666)
(* (pow im 3.0) -0.3333333333333333)))))))
double code(double re, double im) {
double t_0 = 0.5 * cos(re);
double t_1 = exp(-im) - exp(im);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.05)) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * ((im * -2.0) + ((pow(im, 5.0) * -0.016666666666666666) + (pow(im, 3.0) * -0.3333333333333333)));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = 0.5 * Math.cos(re);
double t_1 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.05)) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * ((im * -2.0) + ((Math.pow(im, 5.0) * -0.016666666666666666) + (Math.pow(im, 3.0) * -0.3333333333333333)));
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.cos(re) t_1 = math.exp(-im) - math.exp(im) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.05): tmp = t_0 * t_1 else: tmp = t_0 * ((im * -2.0) + ((math.pow(im, 5.0) * -0.016666666666666666) + (math.pow(im, 3.0) * -0.3333333333333333))) return tmp
function code(re, im) t_0 = Float64(0.5 * cos(re)) t_1 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.05)) tmp = Float64(t_0 * t_1); else tmp = Float64(t_0 * Float64(Float64(im * -2.0) + Float64(Float64((im ^ 5.0) * -0.016666666666666666) + Float64((im ^ 3.0) * -0.3333333333333333)))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * cos(re); t_1 = exp(-im) - exp(im); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.05))) tmp = t_0 * t_1; else tmp = t_0 * ((im * -2.0) + (((im ^ 5.0) * -0.016666666666666666) + ((im ^ 3.0) * -0.3333333333333333))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.05]], $MachinePrecision]], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$0 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \cos re\\
t_1 := e^{-im} - e^{im}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.05\right):\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(im \cdot -2 + \left({im}^{5} \cdot -0.016666666666666666 + {im}^{3} \cdot -0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 0.050000000000000003 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.050000000000000003Initial program 8.2%
sub0-neg8.2%
Simplified8.2%
Taylor expanded in im around 0 99.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)))
(* (* 0.5 (cos re)) t_0)
(* (cos 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 = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(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 = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(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 = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(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(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(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 = (0.5 * cos(re)) * t_0; else tmp = cos(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[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[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):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 5.00000000000000041e-6 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 5.00000000000000041e-6Initial program 7.5%
sub0-neg7.5%
Simplified7.5%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im)))
(t_1 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -2.1e+55)
t_1
(if (<= im -0.0132)
(* 0.5 t_0)
(if (<= im 0.15)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) (* t_0 (+ 0.5 (* re (* re -0.25)))) t_1))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.0132) {
tmp = 0.5 * t_0;
} else if (im <= 0.15) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} 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)
t_1 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-2.1d+55)) then
tmp = t_1
else if (im <= (-0.0132d0)) then
tmp = 0.5d0 * t_0
else if (im <= 0.15d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
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);
double t_1 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.0132) {
tmp = 0.5 * t_0;
} else if (im <= 0.15) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -2.1e+55: tmp = t_1 elif im <= -0.0132: tmp = 0.5 * t_0 elif im <= 0.15: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 * (0.5 + (re * (re * -0.25))) else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.0132) tmp = Float64(0.5 * t_0); elseif (im <= 0.15) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.0132) tmp = 0.5 * t_0; elseif (im <= 0.15) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0 * (0.5 + (re * (re * -0.25))); else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.1e+55], t$95$1, If[LessEqual[im, -0.0132], N[(0.5 * t$95$0), $MachinePrecision], If[LessEqual[im, 0.15], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -2.1 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0132:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{elif}\;im \leq 0.15:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.1000000000000001e55 or 1.09999999999999998e44 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.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%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -2.1000000000000001e55 < im < -0.0132Initial program 99.7%
sub0-neg99.7%
Simplified99.7%
Taylor expanded in re around 0 80.6%
if -0.0132 < im < 0.149999999999999994Initial program 7.5%
sub0-neg7.5%
Simplified7.5%
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%
if 0.149999999999999994 < im < 1.09999999999999998e44Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out88.9%
+-commutative88.9%
*-commutative88.9%
unpow288.9%
associate-*l*88.9%
Simplified88.9%
Final simplification97.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -2.1e+55)
t_1
(if (<= im -0.0048)
t_0
(if (<= im 5.5e-5) (* im (- (cos re))) (if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.0048) {
tmp = t_0;
} else if (im <= 5.5e-5) {
tmp = im * -cos(re);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-2.1d+55)) then
tmp = t_1
else if (im <= (-0.0048d0)) then
tmp = t_0
else if (im <= 5.5d-5) then
tmp = im * -cos(re)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.0048) {
tmp = t_0;
} else if (im <= 5.5e-5) {
tmp = im * -Math.cos(re);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -2.1e+55: tmp = t_1 elif im <= -0.0048: tmp = t_0 elif im <= 5.5e-5: tmp = im * -math.cos(re) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.0048) tmp = t_0; elseif (im <= 5.5e-5) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.0048) tmp = t_0; elseif (im <= 5.5e-5) tmp = im * -cos(re); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.1e+55], t$95$1, If[LessEqual[im, -0.0048], t$95$0, If[LessEqual[im, 5.5e-5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -2.1 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0048:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 5.5 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\cos re\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%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.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%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -2.1000000000000001e55 < im < -0.00479999999999999958 or 5.5000000000000002e-5 < im < 1.09999999999999998e44Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in re around 0 76.4%
if -0.00479999999999999958 < im < 5.5000000000000002e-5Initial program 7.5%
sub0-neg7.5%
Simplified7.5%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
*-commutative99.7%
distribute-lft-neg-in99.7%
Simplified99.7%
Final simplification97.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -2.1e+55)
t_1
(if (<= im -0.014)
t_0
(if (<= im 0.21)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.014) {
tmp = t_0;
} else if (im <= 0.21) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-2.1d+55)) then
tmp = t_1
else if (im <= (-0.014d0)) then
tmp = t_0
else if (im <= 0.21d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -2.1e+55) {
tmp = t_1;
} else if (im <= -0.014) {
tmp = t_0;
} else if (im <= 0.21) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -2.1e+55: tmp = t_1 elif im <= -0.014: tmp = t_0 elif im <= 0.21: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.014) tmp = t_0; elseif (im <= 0.21) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -2.1e+55) tmp = t_1; elseif (im <= -0.014) tmp = t_0; elseif (im <= 0.21) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.1e+55], t$95$1, If[LessEqual[im, -0.014], t$95$0, If[LessEqual[im, 0.21], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\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.21:\\
\;\;\;\;\cos 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%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.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%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -2.1000000000000001e55 < im < -0.0140000000000000003 or 0.209999999999999992 < im < 1.09999999999999998e44Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in re around 0 76.4%
if -0.0140000000000000003 < im < 0.209999999999999992Initial program 7.5%
sub0-neg7.5%
Simplified7.5%
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.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im)))))
(if (<= im -0.00068)
t_0
(if (<= im 0.0004)
(* im (- (cos re)))
(if (<= im 2.55e+92)
t_0
(*
(- (* (pow im 3.0) -0.16666666666666666) im)
(+ (* -0.5 (* re re)) 1.0)))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double tmp;
if (im <= -0.00068) {
tmp = t_0;
} else if (im <= 0.0004) {
tmp = im * -cos(re);
} else if (im <= 2.55e+92) {
tmp = t_0;
} else {
tmp = ((pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
if (im <= (-0.00068d0)) then
tmp = t_0
else if (im <= 0.0004d0) then
tmp = im * -cos(re)
else if (im <= 2.55d+92) then
tmp = t_0
else
tmp = (((im ** 3.0d0) * (-0.16666666666666666d0)) - im) * (((-0.5d0) * (re * re)) + 1.0d0)
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 tmp;
if (im <= -0.00068) {
tmp = t_0;
} else if (im <= 0.0004) {
tmp = im * -Math.cos(re);
} else if (im <= 2.55e+92) {
tmp = t_0;
} else {
tmp = ((Math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) tmp = 0 if im <= -0.00068: tmp = t_0 elif im <= 0.0004: tmp = im * -math.cos(re) elif im <= 2.55e+92: tmp = t_0 else: tmp = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0) return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) tmp = 0.0 if (im <= -0.00068) tmp = t_0; elseif (im <= 0.0004) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 2.55e+92) tmp = t_0; else tmp = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(Float64(-0.5 * Float64(re * re)) + 1.0)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); tmp = 0.0; if (im <= -0.00068) tmp = t_0; elseif (im <= 0.0004) tmp = im * -cos(re); elseif (im <= 2.55e+92) tmp = t_0; else tmp = (((im ^ 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0); 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]}, If[LessEqual[im, -0.00068], t$95$0, If[LessEqual[im, 0.0004], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 2.55e+92], t$95$0, N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;im \leq -0.00068:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0004:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 2.55 \cdot 10^{+92}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\end{array}
\end{array}
if im < -6.8e-4 or 4.00000000000000019e-4 < im < 2.5500000000000001e92Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in re around 0 71.7%
if -6.8e-4 < im < 4.00000000000000019e-4Initial program 7.5%
sub0-neg7.5%
Simplified7.5%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
*-commutative99.7%
distribute-lft-neg-in99.7%
Simplified99.7%
if 2.5500000000000001e92 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 92.6%
mul-1-neg92.6%
unsub-neg92.6%
*-commutative92.6%
associate-*l*92.6%
distribute-lft-out--92.6%
Simplified92.6%
Taylor expanded in re around 0 5.4%
*-commutative5.4%
associate-+r-5.4%
associate-*r*5.4%
*-commutative5.4%
*-lft-identity5.4%
distribute-rgt-out81.1%
*-commutative81.1%
unpow281.1%
Simplified81.1%
Final simplification86.9%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(- (* (pow im 3.0) -0.16666666666666666) im)
(+ (* -0.5 (* re re)) 1.0))))
(if (<= im -7.8e+67)
t_0
(if (<= im -58000.0)
(log1p (expm1 (* (* re re) 0.75)))
(if (<= im 2900000.0) (* im (- (cos re))) t_0)))))
double code(double re, double im) {
double t_0 = ((pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
double tmp;
if (im <= -7.8e+67) {
tmp = t_0;
} else if (im <= -58000.0) {
tmp = log1p(expm1(((re * re) * 0.75)));
} else if (im <= 2900000.0) {
tmp = im * -cos(re);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = ((Math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
double tmp;
if (im <= -7.8e+67) {
tmp = t_0;
} else if (im <= -58000.0) {
tmp = Math.log1p(Math.expm1(((re * re) * 0.75)));
} else if (im <= 2900000.0) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0) tmp = 0 if im <= -7.8e+67: tmp = t_0 elif im <= -58000.0: tmp = math.log1p(math.expm1(((re * re) * 0.75))) elif im <= 2900000.0: tmp = im * -math.cos(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(Float64(-0.5 * Float64(re * re)) + 1.0)) tmp = 0.0 if (im <= -7.8e+67) tmp = t_0; elseif (im <= -58000.0) tmp = log1p(expm1(Float64(Float64(re * re) * 0.75))); elseif (im <= 2900000.0) tmp = Float64(im * Float64(-cos(re))); else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -7.8e+67], t$95$0, If[LessEqual[im, -58000.0], N[Log[1 + N[(Exp[N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 2900000.0], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\mathbf{if}\;im \leq -7.8 \cdot 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -58000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(re \cdot re\right) \cdot 0.75\right)\right)\\
\mathbf{elif}\;im \leq 2900000:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -7.80000000000000013e67 or 2.9e6 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 77.0%
mul-1-neg77.0%
unsub-neg77.0%
*-commutative77.0%
associate-*l*77.0%
distribute-lft-out--77.0%
Simplified77.0%
Taylor expanded in re around 0 8.6%
*-commutative8.6%
associate-+r-8.6%
associate-*r*8.6%
*-commutative8.6%
*-lft-identity8.6%
distribute-rgt-out68.4%
*-commutative68.4%
unpow268.4%
Simplified68.4%
if -7.80000000000000013e67 < im < -58000Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out54.5%
+-commutative54.5%
*-commutative54.5%
unpow254.5%
associate-*l*54.5%
Simplified54.5%
Applied egg-rr32.8%
Taylor expanded in re around inf 33.1%
*-commutative33.1%
unpow233.1%
Simplified33.1%
log1p-expm1-u46.0%
Applied egg-rr46.0%
if -58000 < im < 2.9e6Initial program 11.0%
sub0-neg11.0%
Simplified11.0%
Taylor expanded in im around 0 96.3%
mul-1-neg96.3%
*-commutative96.3%
distribute-lft-neg-in96.3%
Simplified96.3%
Final simplification80.9%
(FPCore (re im) :precision binary64 (if (or (<= im -0.0092) (not (<= im 2900000.0))) (* (- (* (pow im 3.0) -0.16666666666666666) im) (+ (* -0.5 (* re re)) 1.0)) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -0.0092) || !(im <= 2900000.0)) {
tmp = ((pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.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 <= (-0.0092d0)) .or. (.not. (im <= 2900000.0d0))) then
tmp = (((im ** 3.0d0) * (-0.16666666666666666d0)) - im) * (((-0.5d0) * (re * re)) + 1.0d0)
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -0.0092) || !(im <= 2900000.0)) {
tmp = ((Math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0);
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -0.0092) or not (im <= 2900000.0): tmp = ((math.pow(im, 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -0.0092) || !(im <= 2900000.0)) tmp = Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) * Float64(Float64(-0.5 * Float64(re * re)) + 1.0)); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -0.0092) || ~((im <= 2900000.0))) tmp = (((im ^ 3.0) * -0.16666666666666666) - im) * ((-0.5 * (re * re)) + 1.0); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -0.0092], N[Not[LessEqual[im, 2900000.0]], $MachinePrecision]], N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision] * N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.0092 \lor \neg \left(im \leq 2900000\right):\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -0.0091999999999999998 or 2.9e6 < im Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in im around 0 63.1%
mul-1-neg63.1%
unsub-neg63.1%
*-commutative63.1%
associate-*l*63.1%
distribute-lft-out--63.1%
Simplified63.1%
Taylor expanded in re around 0 10.9%
*-commutative10.9%
associate-+r-10.9%
associate-*r*10.9%
*-commutative10.9%
*-lft-identity10.9%
distribute-rgt-out58.9%
*-commutative58.9%
unpow258.9%
Simplified58.9%
if -0.0091999999999999998 < im < 2.9e6Initial program 8.9%
sub0-neg8.9%
Simplified8.9%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-lft-neg-in98.2%
Simplified98.2%
Final simplification78.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666)))
(if (<= im -2.7e+68)
t_0
(if (<= im -58000.0)
(* re (* re 0.75))
(if (<= im 4.05e+46) (* im (- (cos re))) (- t_0 im))))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -2.7e+68) {
tmp = t_0;
} else if (im <= -58000.0) {
tmp = re * (re * 0.75);
} else if (im <= 4.05e+46) {
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 = (im ** 3.0d0) * (-0.16666666666666666d0)
if (im <= (-2.7d+68)) then
tmp = t_0
else if (im <= (-58000.0d0)) then
tmp = re * (re * 0.75d0)
else if (im <= 4.05d+46) 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 = Math.pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -2.7e+68) {
tmp = t_0;
} else if (im <= -58000.0) {
tmp = re * (re * 0.75);
} else if (im <= 4.05e+46) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0 - im;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 tmp = 0 if im <= -2.7e+68: tmp = t_0 elif im <= -58000.0: tmp = re * (re * 0.75) elif im <= 4.05e+46: tmp = im * -math.cos(re) else: tmp = t_0 - im return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) tmp = 0.0 if (im <= -2.7e+68) tmp = t_0; elseif (im <= -58000.0) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 4.05e+46) tmp = Float64(im * Float64(-cos(re))); else tmp = Float64(t_0 - im); end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; tmp = 0.0; if (im <= -2.7e+68) tmp = t_0; elseif (im <= -58000.0) tmp = re * (re * 0.75); elseif (im <= 4.05e+46) tmp = im * -cos(re); else tmp = t_0 - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, If[LessEqual[im, -2.7e+68], t$95$0, If[LessEqual[im, -58000.0], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.05e+46], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -2.7 \cdot 10^{+68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -58000:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 4.05 \cdot 10^{+46}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -2.69999999999999991e68Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*l*85.4%
distribute-lft-out--85.4%
Simplified85.4%
Taylor expanded in re around 0 63.2%
fma-neg63.2%
Simplified63.2%
Taylor expanded in im around inf 63.2%
if -2.69999999999999991e68 < im < -58000Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out54.5%
+-commutative54.5%
*-commutative54.5%
unpow254.5%
associate-*l*54.5%
Simplified54.5%
Applied egg-rr32.8%
Taylor expanded in re around inf 33.1%
*-commutative33.1%
unpow233.1%
associate-*l*33.1%
Simplified33.1%
if -58000 < im < 4.05000000000000024e46Initial program 16.0%
sub0-neg16.0%
Simplified16.0%
Taylor expanded in im around 0 91.0%
mul-1-neg91.0%
*-commutative91.0%
distribute-lft-neg-in91.0%
Simplified91.0%
if 4.05000000000000024e46 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 80.5%
mul-1-neg80.5%
unsub-neg80.5%
*-commutative80.5%
associate-*l*80.5%
distribute-lft-out--80.5%
Simplified80.5%
Taylor expanded in re around 0 56.9%
Final simplification74.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666)))
(if (<= im -4.5e+67)
t_0
(if (<= im -84000.0)
(* re (* re 0.75))
(if (<= im 1.7e-10) (- im) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -4.5e+67) {
tmp = t_0;
} else if (im <= -84000.0) {
tmp = re * (re * 0.75);
} else if (im <= 1.7e-10) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 3.0d0) * (-0.16666666666666666d0)
if (im <= (-4.5d+67)) then
tmp = t_0
else if (im <= (-84000.0d0)) then
tmp = re * (re * 0.75d0)
else if (im <= 1.7d-10) then
tmp = -im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -4.5e+67) {
tmp = t_0;
} else if (im <= -84000.0) {
tmp = re * (re * 0.75);
} else if (im <= 1.7e-10) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 tmp = 0 if im <= -4.5e+67: tmp = t_0 elif im <= -84000.0: tmp = re * (re * 0.75) elif im <= 1.7e-10: tmp = -im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) tmp = 0.0 if (im <= -4.5e+67) tmp = t_0; elseif (im <= -84000.0) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 1.7e-10) tmp = Float64(-im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; tmp = 0.0; if (im <= -4.5e+67) tmp = t_0; elseif (im <= -84000.0) tmp = re * (re * 0.75); elseif (im <= 1.7e-10) tmp = -im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, If[LessEqual[im, -4.5e+67], t$95$0, If[LessEqual[im, -84000.0], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.7e-10], (-im), t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -84000:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{-10}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.4999999999999998e67 or 1.70000000000000007e-10 < im Initial program 99.6%
sub0-neg99.6%
Simplified99.6%
Taylor expanded in im around 0 75.8%
mul-1-neg75.8%
unsub-neg75.8%
*-commutative75.8%
associate-*l*75.8%
distribute-lft-out--75.8%
Simplified75.8%
Taylor expanded in re around 0 54.2%
fma-neg54.2%
Simplified54.2%
Taylor expanded in im around inf 54.2%
if -4.4999999999999998e67 < im < -84000Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out54.5%
+-commutative54.5%
*-commutative54.5%
unpow254.5%
associate-*l*54.5%
Simplified54.5%
Applied egg-rr32.8%
Taylor expanded in re around inf 33.1%
*-commutative33.1%
unpow233.1%
associate-*l*33.1%
Simplified33.1%
if -84000 < im < 1.70000000000000007e-10Initial program 9.2%
sub0-neg9.2%
Simplified9.2%
Taylor expanded in im around 0 97.7%
mul-1-neg97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
Simplified97.7%
Taylor expanded in re around 0 55.0%
neg-mul-155.0%
Simplified55.0%
Final simplification52.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 3.0) -0.16666666666666666)))
(if (<= im -4.5e+67)
t_0
(if (<= im -59000.0)
(* re (* re 0.75))
(if (<= im 4.2e+46) (* im (- (cos re))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -4.5e+67) {
tmp = t_0;
} else if (im <= -59000.0) {
tmp = re * (re * 0.75);
} else if (im <= 4.2e+46) {
tmp = im * -cos(re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 3.0d0) * (-0.16666666666666666d0)
if (im <= (-4.5d+67)) then
tmp = t_0
else if (im <= (-59000.0d0)) then
tmp = re * (re * 0.75d0)
else if (im <= 4.2d+46) then
tmp = im * -cos(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 3.0) * -0.16666666666666666;
double tmp;
if (im <= -4.5e+67) {
tmp = t_0;
} else if (im <= -59000.0) {
tmp = re * (re * 0.75);
} else if (im <= 4.2e+46) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 3.0) * -0.16666666666666666 tmp = 0 if im <= -4.5e+67: tmp = t_0 elif im <= -59000.0: tmp = re * (re * 0.75) elif im <= 4.2e+46: tmp = im * -math.cos(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 3.0) * -0.16666666666666666) tmp = 0.0 if (im <= -4.5e+67) tmp = t_0; elseif (im <= -59000.0) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 4.2e+46) tmp = Float64(im * Float64(-cos(re))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 3.0) * -0.16666666666666666; tmp = 0.0; if (im <= -4.5e+67) tmp = t_0; elseif (im <= -59000.0) tmp = re * (re * 0.75); elseif (im <= 4.2e+46) tmp = im * -cos(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]}, If[LessEqual[im, -4.5e+67], t$95$0, If[LessEqual[im, -59000.0], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.2e+46], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -59000:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+46}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.4999999999999998e67 or 4.2e46 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
*-commutative83.2%
associate-*l*83.2%
distribute-lft-out--83.2%
Simplified83.2%
Taylor expanded in re around 0 60.3%
fma-neg60.3%
Simplified60.3%
Taylor expanded in im around inf 60.3%
if -4.4999999999999998e67 < im < -59000Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out54.5%
+-commutative54.5%
*-commutative54.5%
unpow254.5%
associate-*l*54.5%
Simplified54.5%
Applied egg-rr32.8%
Taylor expanded in re around inf 33.1%
*-commutative33.1%
unpow233.1%
associate-*l*33.1%
Simplified33.1%
if -59000 < im < 4.2e46Initial program 16.0%
sub0-neg16.0%
Simplified16.0%
Taylor expanded in im around 0 91.0%
mul-1-neg91.0%
*-commutative91.0%
distribute-lft-neg-in91.0%
Simplified91.0%
Final simplification74.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* im (* 0.5 (* re re))) im)))
(if (<= im -2.9e+55)
t_0
(if (<= im -58000.0)
(* re (* re 0.75))
(if (<= im 2200000.0) (- im) t_0)))))
double code(double re, double im) {
double t_0 = (im * (0.5 * (re * re))) - im;
double tmp;
if (im <= -2.9e+55) {
tmp = t_0;
} else if (im <= -58000.0) {
tmp = re * (re * 0.75);
} else if (im <= 2200000.0) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im * (0.5d0 * (re * re))) - im
if (im <= (-2.9d+55)) then
tmp = t_0
else if (im <= (-58000.0d0)) then
tmp = re * (re * 0.75d0)
else if (im <= 2200000.0d0) then
tmp = -im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * (0.5 * (re * re))) - im;
double tmp;
if (im <= -2.9e+55) {
tmp = t_0;
} else if (im <= -58000.0) {
tmp = re * (re * 0.75);
} else if (im <= 2200000.0) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * (0.5 * (re * re))) - im tmp = 0 if im <= -2.9e+55: tmp = t_0 elif im <= -58000.0: tmp = re * (re * 0.75) elif im <= 2200000.0: tmp = -im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im) tmp = 0.0 if (im <= -2.9e+55) tmp = t_0; elseif (im <= -58000.0) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 2200000.0) tmp = Float64(-im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im * (0.5 * (re * re))) - im; tmp = 0.0; if (im <= -2.9e+55) tmp = t_0; elseif (im <= -58000.0) tmp = re * (re * 0.75); elseif (im <= 2200000.0) tmp = -im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -2.9e+55], t$95$0, If[LessEqual[im, -58000.0], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2200000.0], (-im), t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{if}\;im \leq -2.9 \cdot 10^{+55}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -58000:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 2200000:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.8999999999999999e55 or 2.2e6 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.6%
mul-1-neg5.6%
*-commutative5.6%
distribute-lft-neg-in5.6%
Simplified5.6%
add-sqr-sqrt2.9%
pow22.9%
*-commutative2.9%
Applied egg-rr2.9%
Taylor expanded in re around 0 0.0%
fma-def0.0%
unpow20.0%
rem-square-sqrt0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt27.7%
metadata-eval27.7%
fma-def27.7%
mul-1-neg27.7%
+-commutative27.7%
unsub-neg27.7%
*-commutative27.7%
*-commutative27.7%
associate-*l*27.7%
unpow227.7%
Simplified27.7%
if -2.8999999999999999e55 < im < -58000Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out55.6%
+-commutative55.6%
*-commutative55.6%
unpow255.6%
associate-*l*55.6%
Simplified55.6%
Applied egg-rr34.2%
Taylor expanded in re around inf 34.6%
*-commutative34.6%
unpow234.6%
associate-*l*34.6%
Simplified34.6%
if -58000 < im < 2.2e6Initial program 11.0%
sub0-neg11.0%
Simplified11.0%
Taylor expanded in im around 0 96.3%
mul-1-neg96.3%
*-commutative96.3%
distribute-lft-neg-in96.3%
Simplified96.3%
Taylor expanded in re around 0 53.8%
neg-mul-153.8%
Simplified53.8%
Final simplification41.6%
(FPCore (re im) :precision binary64 (if (<= im -80000.0) (* re (* re 0.75)) (if (<= im 2400000.0) (- im) (* (+ 0.5 (* re (* re -0.25))) -3.0))))
double code(double re, double im) {
double tmp;
if (im <= -80000.0) {
tmp = re * (re * 0.75);
} else if (im <= 2400000.0) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-80000.0d0)) then
tmp = re * (re * 0.75d0)
else if (im <= 2400000.0d0) then
tmp = -im
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * (-3.0d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -80000.0) {
tmp = re * (re * 0.75);
} else if (im <= 2400000.0) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -80000.0: tmp = re * (re * 0.75) elif im <= 2400000.0: tmp = -im else: tmp = (0.5 + (re * (re * -0.25))) * -3.0 return tmp
function code(re, im) tmp = 0.0 if (im <= -80000.0) tmp = Float64(re * Float64(re * 0.75)); elseif (im <= 2400000.0) tmp = Float64(-im); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * -3.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -80000.0) tmp = re * (re * 0.75); elseif (im <= 2400000.0) tmp = -im; else tmp = (0.5 + (re * (re * -0.25))) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -80000.0], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2400000.0], (-im), N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -80000:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;im \leq 2400000:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\\
\end{array}
\end{array}
if im < -8e4Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out72.6%
+-commutative72.6%
*-commutative72.6%
unpow272.6%
associate-*l*72.6%
Simplified72.6%
Applied egg-rr17.4%
Taylor expanded in re around inf 18.0%
*-commutative18.0%
unpow218.0%
associate-*l*18.0%
Simplified18.0%
if -8e4 < im < 2.4e6Initial program 11.0%
sub0-neg11.0%
Simplified11.0%
Taylor expanded in im around 0 96.3%
mul-1-neg96.3%
*-commutative96.3%
distribute-lft-neg-in96.3%
Simplified96.3%
Taylor expanded in re around 0 53.8%
neg-mul-153.8%
Simplified53.8%
if 2.4e6 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out82.4%
+-commutative82.4%
*-commutative82.4%
unpow282.4%
associate-*l*82.4%
Simplified82.4%
Applied egg-rr18.0%
Final simplification36.4%
(FPCore (re im) :precision binary64 (if (<= re -4.5e+152) (* re (* re 0.75)) (if (<= re 8.6e+154) (- im) (* (+ 0.5 (* re (* re -0.25))) 27.0))))
double code(double re, double im) {
double tmp;
if (re <= -4.5e+152) {
tmp = re * (re * 0.75);
} else if (re <= 8.6e+154) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= (-4.5d+152)) then
tmp = re * (re * 0.75d0)
else if (re <= 8.6d+154) then
tmp = -im
else
tmp = (0.5d0 + (re * (re * (-0.25d0)))) * 27.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= -4.5e+152) {
tmp = re * (re * 0.75);
} else if (re <= 8.6e+154) {
tmp = -im;
} else {
tmp = (0.5 + (re * (re * -0.25))) * 27.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= -4.5e+152: tmp = re * (re * 0.75) elif re <= 8.6e+154: tmp = -im else: tmp = (0.5 + (re * (re * -0.25))) * 27.0 return tmp
function code(re, im) tmp = 0.0 if (re <= -4.5e+152) tmp = Float64(re * Float64(re * 0.75)); elseif (re <= 8.6e+154) tmp = Float64(-im); else tmp = Float64(Float64(0.5 + Float64(re * Float64(re * -0.25))) * 27.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= -4.5e+152) tmp = re * (re * 0.75); elseif (re <= 8.6e+154) tmp = -im; else tmp = (0.5 + (re * (re * -0.25))) * 27.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, -4.5e+152], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 8.6e+154], (-im), N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -4.5 \cdot 10^{+152}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{elif}\;re \leq 8.6 \cdot 10^{+154}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot 27\\
\end{array}
\end{array}
if re < -4.5000000000000001e152Initial program 52.9%
sub0-neg52.9%
Simplified52.9%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out24.2%
+-commutative24.2%
*-commutative24.2%
unpow224.2%
associate-*l*24.2%
Simplified24.2%
Applied egg-rr35.4%
Taylor expanded in re around inf 35.4%
*-commutative35.4%
unpow235.4%
associate-*l*35.4%
Simplified35.4%
if -4.5000000000000001e152 < re < 8.5999999999999995e154Initial program 52.7%
sub0-neg52.7%
Simplified52.7%
Taylor expanded in im around 0 53.6%
mul-1-neg53.6%
*-commutative53.6%
distribute-lft-neg-in53.6%
Simplified53.6%
Taylor expanded in re around 0 37.4%
neg-mul-137.4%
Simplified37.4%
if 8.5999999999999995e154 < re Initial program 62.3%
sub0-neg62.3%
Simplified62.3%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out30.6%
+-commutative30.6%
*-commutative30.6%
unpow230.6%
associate-*l*30.6%
Simplified30.6%
Applied egg-rr34.1%
Final simplification36.7%
(FPCore (re im) :precision binary64 (if (or (<= im -58000.0) (not (<= im 5400000.0))) (* re (* re 0.75)) (- im)))
double code(double re, double im) {
double tmp;
if ((im <= -58000.0) || !(im <= 5400000.0)) {
tmp = re * (re * 0.75);
} 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 ((im <= (-58000.0d0)) .or. (.not. (im <= 5400000.0d0))) then
tmp = re * (re * 0.75d0)
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -58000.0) || !(im <= 5400000.0)) {
tmp = re * (re * 0.75);
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -58000.0) or not (im <= 5400000.0): tmp = re * (re * 0.75) else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -58000.0) || !(im <= 5400000.0)) tmp = Float64(re * Float64(re * 0.75)); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -58000.0) || ~((im <= 5400000.0))) tmp = re * (re * 0.75); else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -58000.0], N[Not[LessEqual[im, 5400000.0]], $MachinePrecision]], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -58000 \lor \neg \left(im \leq 5400000\right):\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if im < -58000 or 5.4e6 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out76.6%
+-commutative76.6%
*-commutative76.6%
unpow276.6%
associate-*l*76.6%
Simplified76.6%
Applied egg-rr17.7%
Taylor expanded in re around inf 17.6%
*-commutative17.6%
unpow217.6%
associate-*l*17.6%
Simplified17.6%
if -58000 < im < 5.4e6Initial program 11.0%
sub0-neg11.0%
Simplified11.0%
Taylor expanded in im around 0 96.3%
mul-1-neg96.3%
*-commutative96.3%
distribute-lft-neg-in96.3%
Simplified96.3%
Taylor expanded in re around 0 53.8%
neg-mul-153.8%
Simplified53.8%
Final simplification36.3%
(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 54.1%
sub0-neg54.1%
Simplified54.1%
Taylor expanded in im around 0 52.2%
mul-1-neg52.2%
*-commutative52.2%
distribute-lft-neg-in52.2%
Simplified52.2%
Taylor expanded in re around 0 29.6%
neg-mul-129.6%
Simplified29.6%
Final simplification29.6%
(FPCore (re im) :precision binary64 -1.5)
double code(double re, double im) {
return -1.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -1.5d0
end function
public static double code(double re, double im) {
return -1.5;
}
def code(re, im): return -1.5
function code(re, im) return -1.5 end
function tmp = code(re, im) tmp = -1.5; end
code[re_, im_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 54.1%
sub0-neg54.1%
Simplified54.1%
Taylor expanded in re around 0 3.0%
*-commutative3.0%
associate-*r*3.0%
distribute-rgt-out41.3%
+-commutative41.3%
*-commutative41.3%
unpow241.3%
associate-*l*41.3%
Simplified41.3%
Applied egg-rr10.0%
Taylor expanded in re around 0 2.7%
Final simplification2.7%
(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 2023171
(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))))