
(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 (or (<= t_0 -0.2) (not (<= t_0 1e-7)))
(* (* 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 <= -0.2) || !(t_0 <= 1e-7)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-0.2d0)) .or. (.not. (t_0 <= 1d-7))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -0.2) || !(t_0 <= 1e-7)) {
tmp = (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 <= -0.2) or not (t_0 <= 1e-7): 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 <= -0.2) || !(t_0 <= 1e-7)) 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 <= -0.2) || ~((t_0 <= 1e-7))) 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, -0.2], N[Not[LessEqual[t$95$0, 1e-7]], $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 -0.2 \lor \neg \left(t_0 \leq 10^{-7}\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)) < -0.20000000000000001 or 9.9999999999999995e-8 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 9.9999999999999995e-8Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-*l*99.9%
distribute-lft-out--99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im)))
(t_1 (* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))))
(if (<= im -6.8e+95)
t_1
(if (<= im -0.0225)
(* 0.5 t_0)
(if (or (<= im 0.043) (not (<= im 5.8e+102)))
t_1
(* t_0 (+ 0.5 (* re (* re -0.25)))))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -6.8e+95) {
tmp = t_1;
} else if (im <= -0.0225) {
tmp = 0.5 * t_0;
} else if ((im <= 0.043) || !(im <= 5.8e+102)) {
tmp = t_1;
} else {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
}
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 = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
if (im <= (-6.8d+95)) then
tmp = t_1
else if (im <= (-0.0225d0)) then
tmp = 0.5d0 * t_0
else if ((im <= 0.043d0) .or. (.not. (im <= 5.8d+102))) then
tmp = t_1
else
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
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.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double tmp;
if (im <= -6.8e+95) {
tmp = t_1;
} else if (im <= -0.0225) {
tmp = 0.5 * t_0;
} else if ((im <= 0.043) || !(im <= 5.8e+102)) {
tmp = t_1;
} else {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) tmp = 0 if im <= -6.8e+95: tmp = t_1 elif im <= -0.0225: tmp = 0.5 * t_0 elif (im <= 0.043) or not (im <= 5.8e+102): tmp = t_1 else: tmp = t_0 * (0.5 + (re * (re * -0.25))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) tmp = 0.0 if (im <= -6.8e+95) tmp = t_1; elseif (im <= -0.0225) tmp = Float64(0.5 * t_0); elseif ((im <= 0.043) || !(im <= 5.8e+102)) tmp = t_1; else tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); tmp = 0.0; if (im <= -6.8e+95) tmp = t_1; elseif (im <= -0.0225) tmp = 0.5 * t_0; elseif ((im <= 0.043) || ~((im <= 5.8e+102))) tmp = t_1; else tmp = t_0 * (0.5 + (re * (re * -0.25))); 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[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.8e+95], t$95$1, If[LessEqual[im, -0.0225], N[(0.5 * t$95$0), $MachinePrecision], If[Or[LessEqual[im, 0.043], N[Not[LessEqual[im, 5.8e+102]], $MachinePrecision]], t$95$1, N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := \cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{if}\;im \leq -6.8 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0225:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{elif}\;im \leq 0.043 \lor \neg \left(im \leq 5.8 \cdot 10^{+102}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\end{array}
\end{array}
if im < -6.80000000000000043e95 or -0.022499999999999999 < im < 0.042999999999999997 or 5.8000000000000005e102 < im Initial program 46.4%
sub0-neg46.4%
Simplified46.4%
Taylor expanded in im around 0 99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
associate-*l*99.5%
distribute-lft-out--99.5%
Simplified99.5%
if -6.80000000000000043e95 < im < -0.022499999999999999Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in re around 0 83.9%
if 0.042999999999999997 < im < 5.8000000000000005e102Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in re around 0 7.5%
*-commutative7.5%
associate-*r*7.5%
distribute-rgt-out92.1%
+-commutative92.1%
*-commutative92.1%
unpow292.1%
associate-*l*92.1%
Simplified92.1%
Final simplification97.6%
(FPCore (re im)
:precision binary64
(if (or (<= im -6.8e+95)
(not (or (<= im -0.04) (and (not (<= im 0.016)) (<= im 5.8e+102)))))
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(* 0.5 (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if ((im <= -6.8e+95) || !((im <= -0.04) || (!(im <= 0.016) && (im <= 5.8e+102)))) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (exp(-im) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-6.8d+95)) .or. (.not. (im <= (-0.04d0)) .or. (.not. (im <= 0.016d0)) .and. (im <= 5.8d+102))) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = 0.5d0 * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -6.8e+95) || !((im <= -0.04) || (!(im <= 0.016) && (im <= 5.8e+102)))) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -6.8e+95) or not ((im <= -0.04) or (not (im <= 0.016) and (im <= 5.8e+102))): tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = 0.5 * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -6.8e+95) || !((im <= -0.04) || (!(im <= 0.016) && (im <= 5.8e+102)))) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -6.8e+95) || ~(((im <= -0.04) || (~((im <= 0.016)) && (im <= 5.8e+102))))) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = 0.5 * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -6.8e+95], N[Not[Or[LessEqual[im, -0.04], And[N[Not[LessEqual[im, 0.016]], $MachinePrecision], LessEqual[im, 5.8e+102]]]], $MachinePrecision]], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.8 \cdot 10^{+95} \lor \neg \left(im \leq -0.04 \lor \neg \left(im \leq 0.016\right) \land im \leq 5.8 \cdot 10^{+102}\right):\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
if im < -6.80000000000000043e95 or -0.0400000000000000008 < im < 0.016 or 5.8000000000000005e102 < im Initial program 46.4%
sub0-neg46.4%
Simplified46.4%
Taylor expanded in im around 0 99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
associate-*l*99.5%
distribute-lft-out--99.5%
Simplified99.5%
if -6.80000000000000043e95 < im < -0.0400000000000000008 or 0.016 < im < 5.8000000000000005e102Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in re around 0 76.2%
Final simplification96.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im)))))
(if (<= im -0.0004)
t_0
(if (<= im 4.7e-5)
(* im (- (cos re)))
(if (<= im 1.8e+150)
t_0
(/
(* (cos re) (- 5.960464477539063e-8 (* im im)))
(+ im 0.000244140625)))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double tmp;
if (im <= -0.0004) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = im * -cos(re);
} else if (im <= 1.8e+150) {
tmp = t_0;
} else {
tmp = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
}
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.0004d0)) then
tmp = t_0
else if (im <= 4.7d-5) then
tmp = im * -cos(re)
else if (im <= 1.8d+150) then
tmp = t_0
else
tmp = (cos(re) * (5.960464477539063d-8 - (im * im))) / (im + 0.000244140625d0)
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.0004) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = im * -Math.cos(re);
} else if (im <= 1.8e+150) {
tmp = t_0;
} else {
tmp = (Math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) tmp = 0 if im <= -0.0004: tmp = t_0 elif im <= 4.7e-5: tmp = im * -math.cos(re) elif im <= 1.8e+150: tmp = t_0 else: tmp = (math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625) return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) tmp = 0.0 if (im <= -0.0004) tmp = t_0; elseif (im <= 4.7e-5) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.8e+150) tmp = t_0; else tmp = Float64(Float64(cos(re) * Float64(5.960464477539063e-8 - Float64(im * im))) / Float64(im + 0.000244140625)); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); tmp = 0.0; if (im <= -0.0004) tmp = t_0; elseif (im <= 4.7e-5) tmp = im * -cos(re); elseif (im <= 1.8e+150) tmp = t_0; else tmp = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625); 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.0004], t$95$0, If[LessEqual[im, 4.7e-5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.8e+150], t$95$0, N[(N[(N[Cos[re], $MachinePrecision] * N[(5.960464477539063e-8 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + 0.000244140625), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;im \leq -0.0004:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos re \cdot \left(5.960464477539063 \cdot 10^{-8} - im \cdot im\right)}{im + 0.000244140625}\\
\end{array}
\end{array}
if im < -4.00000000000000019e-4 or 4.69999999999999972e-5 < im < 1.79999999999999993e150Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in re around 0 77.8%
if -4.00000000000000019e-4 < im < 4.69999999999999972e-5Initial program 7.4%
sub0-neg7.4%
Simplified7.4%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-lft-neg-in99.9%
Simplified99.9%
if 1.79999999999999993e150 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Applied egg-rr6.5%
*-commutative6.5%
flip--96.8%
associate-*l/96.8%
metadata-eval96.8%
+-commutative96.8%
Applied egg-rr96.8%
Final simplification90.9%
(FPCore (re im)
:precision binary64
(if (<= im -4e+49)
(sqrt (* (pow im 6.0) 0.027777777777777776))
(if (<= im 4.7e-5)
(* im (- (cos re)))
(if (<= im 1.35e+154)
(*
(+ (* -0.5 (* re re)) 1.0)
(- (* (pow im 3.0) -0.16666666666666666) im))
(/
(* (cos re) (- 5.960464477539063e-8 (* im im)))
(+ im 0.000244140625))))))
double code(double re, double im) {
double tmp;
if (im <= -4e+49) {
tmp = sqrt((pow(im, 6.0) * 0.027777777777777776));
} else if (im <= 4.7e-5) {
tmp = im * -cos(re);
} else if (im <= 1.35e+154) {
tmp = ((-0.5 * (re * re)) + 1.0) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-4d+49)) then
tmp = sqrt(((im ** 6.0d0) * 0.027777777777777776d0))
else if (im <= 4.7d-5) then
tmp = im * -cos(re)
else if (im <= 1.35d+154) then
tmp = (((-0.5d0) * (re * re)) + 1.0d0) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else
tmp = (cos(re) * (5.960464477539063d-8 - (im * im))) / (im + 0.000244140625d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -4e+49) {
tmp = Math.sqrt((Math.pow(im, 6.0) * 0.027777777777777776));
} else if (im <= 4.7e-5) {
tmp = im * -Math.cos(re);
} else if (im <= 1.35e+154) {
tmp = ((-0.5 * (re * re)) + 1.0) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else {
tmp = (Math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -4e+49: tmp = math.sqrt((math.pow(im, 6.0) * 0.027777777777777776)) elif im <= 4.7e-5: tmp = im * -math.cos(re) elif im <= 1.35e+154: tmp = ((-0.5 * (re * re)) + 1.0) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) else: tmp = (math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625) return tmp
function code(re, im) tmp = 0.0 if (im <= -4e+49) tmp = sqrt(Float64((im ^ 6.0) * 0.027777777777777776)); elseif (im <= 4.7e-5) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.35e+154) tmp = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.0) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); else tmp = Float64(Float64(cos(re) * Float64(5.960464477539063e-8 - Float64(im * im))) / Float64(im + 0.000244140625)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -4e+49) tmp = sqrt(((im ^ 6.0) * 0.027777777777777776)); elseif (im <= 4.7e-5) tmp = im * -cos(re); elseif (im <= 1.35e+154) tmp = ((-0.5 * (re * re)) + 1.0) * (((im ^ 3.0) * -0.16666666666666666) - im); else tmp = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -4e+49], N[Sqrt[N[(N[Power[im, 6.0], $MachinePrecision] * 0.027777777777777776), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 4.7e-5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.35e+154], N[(N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[re], $MachinePrecision] * N[(5.960464477539063e-8 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + 0.000244140625), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4 \cdot 10^{+49}:\\
\;\;\;\;\sqrt{{im}^{6} \cdot 0.027777777777777776}\\
\mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos re \cdot \left(5.960464477539063 \cdot 10^{-8} - im \cdot im\right)}{im + 0.000244140625}\\
\end{array}
\end{array}
if im < -3.99999999999999979e49Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 80.9%
mul-1-neg80.9%
unsub-neg80.9%
*-commutative80.9%
associate-*l*80.9%
distribute-lft-out--80.9%
Simplified80.9%
Taylor expanded in re around 0 64.0%
Taylor expanded in im around inf 64.0%
add-sqr-sqrt64.0%
sqrt-unprod79.6%
*-commutative79.6%
*-commutative79.6%
swap-sqr79.6%
pow-prod-up79.6%
metadata-eval79.6%
metadata-eval79.6%
Applied egg-rr79.6%
if -3.99999999999999979e49 < im < 4.69999999999999972e-5Initial program 17.2%
sub0-neg17.2%
Simplified17.2%
Taylor expanded in im around 0 89.8%
mul-1-neg89.8%
*-commutative89.8%
distribute-lft-neg-in89.8%
Simplified89.8%
if 4.69999999999999972e-5 < im < 1.35000000000000003e154Initial program 99.3%
sub0-neg99.3%
Simplified99.3%
Taylor expanded in im around 0 62.5%
mul-1-neg62.5%
unsub-neg62.5%
*-commutative62.5%
associate-*l*62.5%
distribute-lft-out--62.5%
Simplified62.5%
Taylor expanded in re around 0 18.0%
associate--l+18.0%
associate-*r*18.0%
distribute-lft1-in58.7%
unpow258.7%
Simplified58.7%
if 1.35000000000000003e154 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Applied egg-rr6.6%
*-commutative6.6%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
Final simplification84.9%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(+ (* -0.5 (* re re)) 1.0)
(- (* (pow im 3.0) -0.16666666666666666) im)))
(t_1
(/
(* (cos re) (- 5.960464477539063e-8 (* im im)))
(+ im 0.000244140625))))
(if (<= im -4.5e+163)
t_1
(if (<= im -0.03)
t_0
(if (<= im 4.7e-5)
(* im (- (cos re)))
(if (<= im 1.35e+154) t_0 t_1))))))
double code(double re, double im) {
double t_0 = ((-0.5 * (re * re)) + 1.0) * ((pow(im, 3.0) * -0.16666666666666666) - im);
double t_1 = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
double tmp;
if (im <= -4.5e+163) {
tmp = t_1;
} else if (im <= -0.03) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = im * -cos(re);
} else if (im <= 1.35e+154) {
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) * (re * re)) + 1.0d0) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
t_1 = (cos(re) * (5.960464477539063d-8 - (im * im))) / (im + 0.000244140625d0)
if (im <= (-4.5d+163)) then
tmp = t_1
else if (im <= (-0.03d0)) then
tmp = t_0
else if (im <= 4.7d-5) then
tmp = im * -cos(re)
else if (im <= 1.35d+154) 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 * (re * re)) + 1.0) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
double t_1 = (Math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
double tmp;
if (im <= -4.5e+163) {
tmp = t_1;
} else if (im <= -0.03) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = im * -Math.cos(re);
} else if (im <= 1.35e+154) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = ((-0.5 * (re * re)) + 1.0) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) t_1 = (math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625) tmp = 0 if im <= -4.5e+163: tmp = t_1 elif im <= -0.03: tmp = t_0 elif im <= 4.7e-5: tmp = im * -math.cos(re) elif im <= 1.35e+154: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.0) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)) t_1 = Float64(Float64(cos(re) * Float64(5.960464477539063e-8 - Float64(im * im))) / Float64(im + 0.000244140625)) tmp = 0.0 if (im <= -4.5e+163) tmp = t_1; elseif (im <= -0.03) tmp = t_0; elseif (im <= 4.7e-5) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = ((-0.5 * (re * re)) + 1.0) * (((im ^ 3.0) * -0.16666666666666666) - im); t_1 = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625); tmp = 0.0; if (im <= -4.5e+163) tmp = t_1; elseif (im <= -0.03) tmp = t_0; elseif (im <= 4.7e-5) tmp = im * -cos(re); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Cos[re], $MachinePrecision] * N[(5.960464477539063e-8 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + 0.000244140625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+163], t$95$1, If[LessEqual[im, -0.03], t$95$0, If[LessEqual[im, 4.7e-5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
t_1 := \frac{\cos re \cdot \left(5.960464477539063 \cdot 10^{-8} - im \cdot im\right)}{im + 0.000244140625}\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.03:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.49999999999999988e163 or 1.35000000000000003e154 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Applied egg-rr6.5%
*-commutative6.5%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
if -4.49999999999999988e163 < im < -0.029999999999999999 or 4.69999999999999972e-5 < im < 1.35000000000000003e154Initial program 99.7%
sub0-neg99.7%
Simplified99.7%
Taylor expanded in im around 0 53.5%
mul-1-neg53.5%
unsub-neg53.5%
*-commutative53.5%
associate-*l*53.5%
distribute-lft-out--53.5%
Simplified53.5%
Taylor expanded in re around 0 15.1%
associate--l+15.1%
associate-*r*15.1%
distribute-lft1-in48.5%
unpow248.5%
Simplified48.5%
if -0.029999999999999999 < im < 4.69999999999999972e-5Initial program 7.4%
sub0-neg7.4%
Simplified7.4%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-lft-neg-in99.9%
Simplified99.9%
Final simplification84.2%
(FPCore (re im)
:precision binary64
(let* ((t_0
(* (+ (* -0.5 (* re re)) 1.0) (* (pow im 3.0) -0.16666666666666666)))
(t_1
(/
(* (cos re) (- 5.960464477539063e-8 (* im im)))
(+ im 0.000244140625))))
(if (<= im -4.5e+163)
t_1
(if (<= im -3.2e+18)
t_0
(if (<= im 520.0)
(* im (- (cos re)))
(if (<= im 1.35e+154) t_0 t_1))))))
double code(double re, double im) {
double t_0 = ((-0.5 * (re * re)) + 1.0) * (pow(im, 3.0) * -0.16666666666666666);
double t_1 = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
double tmp;
if (im <= -4.5e+163) {
tmp = t_1;
} else if (im <= -3.2e+18) {
tmp = t_0;
} else if (im <= 520.0) {
tmp = im * -cos(re);
} else if (im <= 1.35e+154) {
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) * (re * re)) + 1.0d0) * ((im ** 3.0d0) * (-0.16666666666666666d0))
t_1 = (cos(re) * (5.960464477539063d-8 - (im * im))) / (im + 0.000244140625d0)
if (im <= (-4.5d+163)) then
tmp = t_1
else if (im <= (-3.2d+18)) then
tmp = t_0
else if (im <= 520.0d0) then
tmp = im * -cos(re)
else if (im <= 1.35d+154) 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 * (re * re)) + 1.0) * (Math.pow(im, 3.0) * -0.16666666666666666);
double t_1 = (Math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
double tmp;
if (im <= -4.5e+163) {
tmp = t_1;
} else if (im <= -3.2e+18) {
tmp = t_0;
} else if (im <= 520.0) {
tmp = im * -Math.cos(re);
} else if (im <= 1.35e+154) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = ((-0.5 * (re * re)) + 1.0) * (math.pow(im, 3.0) * -0.16666666666666666) t_1 = (math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625) tmp = 0 if im <= -4.5e+163: tmp = t_1 elif im <= -3.2e+18: tmp = t_0 elif im <= 520.0: tmp = im * -math.cos(re) elif im <= 1.35e+154: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(Float64(-0.5 * Float64(re * re)) + 1.0) * Float64((im ^ 3.0) * -0.16666666666666666)) t_1 = Float64(Float64(cos(re) * Float64(5.960464477539063e-8 - Float64(im * im))) / Float64(im + 0.000244140625)) tmp = 0.0 if (im <= -4.5e+163) tmp = t_1; elseif (im <= -3.2e+18) tmp = t_0; elseif (im <= 520.0) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = ((-0.5 * (re * re)) + 1.0) * ((im ^ 3.0) * -0.16666666666666666); t_1 = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625); tmp = 0.0; if (im <= -4.5e+163) tmp = t_1; elseif (im <= -3.2e+18) tmp = t_0; elseif (im <= 520.0) tmp = im * -cos(re); elseif (im <= 1.35e+154) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(-0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Cos[re], $MachinePrecision] * N[(5.960464477539063e-8 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + 0.000244140625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.5e+163], t$95$1, If[LessEqual[im, -3.2e+18], t$95$0, If[LessEqual[im, 520.0], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.35e+154], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-0.5 \cdot \left(re \cdot re\right) + 1\right) \cdot \left({im}^{3} \cdot -0.16666666666666666\right)\\
t_1 := \frac{\cos re \cdot \left(5.960464477539063 \cdot 10^{-8} - im \cdot im\right)}{im + 0.000244140625}\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+163}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -3.2 \cdot 10^{+18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 520:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -4.49999999999999988e163 or 1.35000000000000003e154 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Applied egg-rr6.5%
*-commutative6.5%
flip--100.0%
associate-*l/100.0%
metadata-eval100.0%
+-commutative100.0%
Applied egg-rr100.0%
if -4.49999999999999988e163 < im < -3.2e18 or 520 < im < 1.35000000000000003e154Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 55.1%
mul-1-neg55.1%
unsub-neg55.1%
*-commutative55.1%
associate-*l*55.1%
distribute-lft-out--55.1%
Simplified55.1%
Taylor expanded in re around 0 13.6%
associate--l+13.6%
associate-*r*13.6%
distribute-lft1-in49.7%
unpow249.7%
Simplified49.7%
Taylor expanded in im around inf 49.7%
if -3.2e18 < im < 520Initial program 11.4%
sub0-neg11.4%
Simplified11.4%
Taylor expanded in im around 0 96.4%
mul-1-neg96.4%
*-commutative96.4%
distribute-lft-neg-in96.4%
Simplified96.4%
Final simplification84.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -0.000225)
t_0
(if (<= im 4.7e-5)
(* im (- (cos re)))
(if (<= im 1.8e+150)
t_0
(/
(* (cos re) (- 5.960464477539063e-8 (* im im)))
(+ im 0.000244140625)))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -0.000225) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = im * -cos(re);
} else if (im <= 1.8e+150) {
tmp = t_0;
} else {
tmp = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
}
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)) - im
if (im <= (-0.000225d0)) then
tmp = t_0
else if (im <= 4.7d-5) then
tmp = im * -cos(re)
else if (im <= 1.8d+150) then
tmp = t_0
else
tmp = (cos(re) * (5.960464477539063d-8 - (im * im))) / (im + 0.000244140625d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -0.000225) {
tmp = t_0;
} else if (im <= 4.7e-5) {
tmp = im * -Math.cos(re);
} else if (im <= 1.8e+150) {
tmp = t_0;
} else {
tmp = (Math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625);
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -0.000225: tmp = t_0 elif im <= 4.7e-5: tmp = im * -math.cos(re) elif im <= 1.8e+150: tmp = t_0 else: tmp = (math.cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625) return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -0.000225) tmp = t_0; elseif (im <= 4.7e-5) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.8e+150) tmp = t_0; else tmp = Float64(Float64(cos(re) * Float64(5.960464477539063e-8 - Float64(im * im))) / Float64(im + 0.000244140625)); end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -0.000225) tmp = t_0; elseif (im <= 4.7e-5) tmp = im * -cos(re); elseif (im <= 1.8e+150) tmp = t_0; else tmp = (cos(re) * (5.960464477539063e-8 - (im * im))) / (im + 0.000244140625); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -0.000225], t$95$0, If[LessEqual[im, 4.7e-5], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.8e+150], t$95$0, N[(N[(N[Cos[re], $MachinePrecision] * N[(5.960464477539063e-8 - N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im + 0.000244140625), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -0.000225:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.7 \cdot 10^{-5}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+150}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos re \cdot \left(5.960464477539063 \cdot 10^{-8} - im \cdot im\right)}{im + 0.000244140625}\\
\end{array}
\end{array}
if im < -2.2499999999999999e-4 or 4.69999999999999972e-5 < im < 1.79999999999999993e150Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in im around 0 63.7%
mul-1-neg63.7%
unsub-neg63.7%
*-commutative63.7%
associate-*l*63.7%
distribute-lft-out--63.7%
Simplified63.7%
Taylor expanded in re around 0 51.3%
if -2.2499999999999999e-4 < im < 4.69999999999999972e-5Initial program 7.4%
sub0-neg7.4%
Simplified7.4%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-lft-neg-in99.9%
Simplified99.9%
if 1.79999999999999993e150 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Applied egg-rr6.5%
*-commutative6.5%
flip--96.8%
associate-*l/96.8%
metadata-eval96.8%
+-commutative96.8%
Applied egg-rr96.8%
Final simplification80.5%
(FPCore (re im) :precision binary64 (if (<= (cos re) -0.02) (- (* (* im re) (* 0.5 re)) im) (- im)))
double code(double re, double im) {
double tmp;
if (cos(re) <= -0.02) {
tmp = ((im * re) * (0.5 * re)) - im;
} 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.02d0)) then
tmp = ((im * re) * (0.5d0 * re)) - im
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (Math.cos(re) <= -0.02) {
tmp = ((im * re) * (0.5 * re)) - im;
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if math.cos(re) <= -0.02: tmp = ((im * re) * (0.5 * re)) - im else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if (cos(re) <= -0.02) tmp = Float64(Float64(Float64(im * re) * Float64(0.5 * re)) - im); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (cos(re) <= -0.02) tmp = ((im * re) * (0.5 * re)) - im; else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[Cos[re], $MachinePrecision], -0.02], N[(N[(N[(im * re), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos re \leq -0.02:\\
\;\;\;\;\left(im \cdot re\right) \cdot \left(0.5 \cdot re\right) - im\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if (cos.f64 re) < -0.0200000000000000004Initial program 62.9%
sub0-neg62.9%
Simplified62.9%
Taylor expanded in im around 0 43.1%
mul-1-neg43.1%
*-commutative43.1%
distribute-lft-neg-in43.1%
Simplified43.1%
Taylor expanded in re around 0 46.8%
neg-mul-146.8%
+-commutative46.8%
unsub-neg46.8%
*-commutative46.8%
associate-*l*46.8%
unpow246.8%
Simplified46.8%
Taylor expanded in re around 0 46.8%
unpow246.8%
associate-*r*46.8%
*-commutative46.8%
*-commutative46.8%
associate-*l*46.8%
associate-*r*46.8%
Simplified46.8%
if -0.0200000000000000004 < (cos.f64 re) Initial program 52.1%
sub0-neg52.1%
Simplified52.1%
Taylor expanded in im around 0 86.8%
mul-1-neg86.8%
unsub-neg86.8%
*-commutative86.8%
associate-*l*86.8%
distribute-lft-out--86.8%
Simplified86.8%
Taylor expanded in re around 0 73.3%
Taylor expanded in im around 0 40.9%
neg-mul-140.9%
Simplified40.9%
Final simplification42.1%
(FPCore (re im) :precision binary64 (if (or (<= im -0.00165) (not (<= im 2.3e-5))) (- (* (pow im 3.0) -0.16666666666666666) im) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -0.00165) || !(im <= 2.3e-5)) {
tmp = (pow(im, 3.0) * -0.16666666666666666) - im;
} 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.00165d0)) .or. (.not. (im <= 2.3d-5))) then
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -0.00165) || !(im <= 2.3e-5)) {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -0.00165) or not (im <= 2.3e-5): tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -0.00165) || !(im <= 2.3e-5)) tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -0.00165) || ~((im <= 2.3e-5))) tmp = ((im ^ 3.0) * -0.16666666666666666) - im; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -0.00165], N[Not[LessEqual[im, 2.3e-5]], $MachinePrecision]], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -0.00165 \lor \neg \left(im \leq 2.3 \cdot 10^{-5}\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -0.00165 or 2.3e-5 < im Initial program 99.8%
sub0-neg99.8%
Simplified99.8%
Taylor expanded in im around 0 72.1%
mul-1-neg72.1%
unsub-neg72.1%
*-commutative72.1%
associate-*l*72.1%
distribute-lft-out--72.1%
Simplified72.1%
Taylor expanded in re around 0 55.6%
if -0.00165 < im < 2.3e-5Initial program 7.4%
sub0-neg7.4%
Simplified7.4%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-lft-neg-in99.9%
Simplified99.9%
Final simplification77.4%
(FPCore (re im) :precision binary64 (if (or (<= im -9e+101) (not (<= im 2.8e+70))) (* (pow im 3.0) -0.16666666666666666) (- (* (* im re) (* 0.5 re)) im)))
double code(double re, double im) {
double tmp;
if ((im <= -9e+101) || !(im <= 2.8e+70)) {
tmp = pow(im, 3.0) * -0.16666666666666666;
} else {
tmp = ((im * re) * (0.5 * re)) - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-9d+101)) .or. (.not. (im <= 2.8d+70))) then
tmp = (im ** 3.0d0) * (-0.16666666666666666d0)
else
tmp = ((im * re) * (0.5d0 * re)) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -9e+101) || !(im <= 2.8e+70)) {
tmp = Math.pow(im, 3.0) * -0.16666666666666666;
} else {
tmp = ((im * re) * (0.5 * re)) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -9e+101) or not (im <= 2.8e+70): tmp = math.pow(im, 3.0) * -0.16666666666666666 else: tmp = ((im * re) * (0.5 * re)) - im return tmp
function code(re, im) tmp = 0.0 if ((im <= -9e+101) || !(im <= 2.8e+70)) tmp = Float64((im ^ 3.0) * -0.16666666666666666); else tmp = Float64(Float64(Float64(im * re) * Float64(0.5 * re)) - im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -9e+101) || ~((im <= 2.8e+70))) tmp = (im ^ 3.0) * -0.16666666666666666; else tmp = ((im * re) * (0.5 * re)) - im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -9e+101], N[Not[LessEqual[im, 2.8e+70]], $MachinePrecision]], N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision], N[(N[(N[(im * re), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -9 \cdot 10^{+101} \lor \neg \left(im \leq 2.8 \cdot 10^{+70}\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot re\right) \cdot \left(0.5 \cdot re\right) - im\\
\end{array}
\end{array}
if im < -9.0000000000000004e101 or 2.7999999999999999e70 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.0%
mul-1-neg98.0%
unsub-neg98.0%
*-commutative98.0%
associate-*l*98.0%
distribute-lft-out--98.0%
Simplified98.0%
Taylor expanded in re around 0 75.1%
Taylor expanded in im around inf 75.1%
if -9.0000000000000004e101 < im < 2.7999999999999999e70Initial program 28.7%
sub0-neg28.7%
Simplified28.7%
Taylor expanded in im around 0 78.2%
mul-1-neg78.2%
*-commutative78.2%
distribute-lft-neg-in78.2%
Simplified78.2%
Taylor expanded in re around 0 49.2%
neg-mul-149.2%
+-commutative49.2%
unsub-neg49.2%
*-commutative49.2%
associate-*l*49.2%
unpow249.2%
Simplified49.2%
Taylor expanded in re around 0 49.2%
unpow249.2%
associate-*r*49.2%
*-commutative49.2%
*-commutative49.2%
associate-*l*49.2%
associate-*r*49.2%
Simplified49.2%
Final simplification58.5%
(FPCore (re im) :precision binary64 (if (or (<= im -1.2e+50) (not (<= im 1.7e+62))) (* (pow im 3.0) -0.16666666666666666) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -1.2e+50) || !(im <= 1.7e+62)) {
tmp = pow(im, 3.0) * -0.16666666666666666;
} 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 <= (-1.2d+50)) .or. (.not. (im <= 1.7d+62))) then
tmp = (im ** 3.0d0) * (-0.16666666666666666d0)
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.2e+50) || !(im <= 1.7e+62)) {
tmp = Math.pow(im, 3.0) * -0.16666666666666666;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.2e+50) or not (im <= 1.7e+62): tmp = math.pow(im, 3.0) * -0.16666666666666666 else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.2e+50) || !(im <= 1.7e+62)) tmp = Float64((im ^ 3.0) * -0.16666666666666666); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.2e+50) || ~((im <= 1.7e+62))) tmp = (im ^ 3.0) * -0.16666666666666666; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.2e+50], N[Not[LessEqual[im, 1.7e+62]], $MachinePrecision]], N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.2 \cdot 10^{+50} \lor \neg \left(im \leq 1.7 \cdot 10^{+62}\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -1.2000000000000001e50 or 1.70000000000000007e62 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.2%
mul-1-neg88.2%
unsub-neg88.2%
*-commutative88.2%
associate-*l*88.2%
distribute-lft-out--88.2%
Simplified88.2%
Taylor expanded in re around 0 67.6%
Taylor expanded in im around inf 67.6%
if -1.2000000000000001e50 < im < 1.70000000000000007e62Initial program 23.6%
sub0-neg23.6%
Simplified23.6%
Taylor expanded in im around 0 83.6%
mul-1-neg83.6%
*-commutative83.6%
distribute-lft-neg-in83.6%
Simplified83.6%
Final simplification77.2%
(FPCore (re im)
:precision binary64
(if (<= re 5.2e+153)
(- im)
(if (<= re 2.3e+201)
(* (* re re) -6.75)
(* (+ 0.5 (* re (* re -0.25))) -3.0))))
double code(double re, double im) {
double tmp;
if (re <= 5.2e+153) {
tmp = -im;
} else if (re <= 2.3e+201) {
tmp = (re * re) * -6.75;
} 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 (re <= 5.2d+153) then
tmp = -im
else if (re <= 2.3d+201) then
tmp = (re * re) * (-6.75d0)
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 (re <= 5.2e+153) {
tmp = -im;
} else if (re <= 2.3e+201) {
tmp = (re * re) * -6.75;
} else {
tmp = (0.5 + (re * (re * -0.25))) * -3.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.2e+153: tmp = -im elif re <= 2.3e+201: tmp = (re * re) * -6.75 else: tmp = (0.5 + (re * (re * -0.25))) * -3.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 5.2e+153) tmp = Float64(-im); elseif (re <= 2.3e+201) tmp = Float64(Float64(re * re) * -6.75); 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 (re <= 5.2e+153) tmp = -im; elseif (re <= 2.3e+201) tmp = (re * re) * -6.75; else tmp = (0.5 + (re * (re * -0.25))) * -3.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.2e+153], (-im), If[LessEqual[re, 2.3e+201], N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision], N[(N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5.2 \cdot 10^{+153}:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 2.3 \cdot 10^{+201}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\\
\end{array}
\end{array}
if re < 5.1999999999999998e153Initial program 52.3%
sub0-neg52.3%
Simplified52.3%
Taylor expanded in im around 0 87.1%
mul-1-neg87.1%
unsub-neg87.1%
*-commutative87.1%
associate-*l*87.1%
distribute-lft-out--87.1%
Simplified87.1%
Taylor expanded in re around 0 64.1%
Taylor expanded in im around 0 37.0%
neg-mul-137.0%
Simplified37.0%
if 5.1999999999999998e153 < re < 2.3000000000000001e201Initial program 88.2%
sub0-neg88.2%
Simplified88.2%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out33.4%
+-commutative33.4%
*-commutative33.4%
unpow233.4%
associate-*l*33.4%
Simplified33.4%
Applied egg-rr83.8%
Taylor expanded in re around inf 83.8%
unpow283.8%
Simplified83.8%
if 2.3000000000000001e201 < re Initial program 63.7%
sub0-neg63.7%
Simplified63.7%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out33.4%
+-commutative33.4%
*-commutative33.4%
unpow233.4%
associate-*l*33.4%
Simplified33.4%
Applied egg-rr45.2%
Final simplification39.0%
(FPCore (re im) :precision binary64 (if (<= re 5.8e+153) (- im) (* (* re re) -6.75)))
double code(double re, double im) {
double tmp;
if (re <= 5.8e+153) {
tmp = -im;
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 5.8d+153) then
tmp = -im
else
tmp = (re * re) * (-6.75d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5.8e+153) {
tmp = -im;
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5.8e+153: tmp = -im else: tmp = (re * re) * -6.75 return tmp
function code(re, im) tmp = 0.0 if (re <= 5.8e+153) tmp = Float64(-im); else tmp = Float64(Float64(re * re) * -6.75); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5.8e+153) tmp = -im; else tmp = (re * re) * -6.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5.8e+153], (-im), N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5.8 \cdot 10^{+153}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\end{array}
\end{array}
if re < 5.80000000000000004e153Initial program 52.3%
sub0-neg52.3%
Simplified52.3%
Taylor expanded in im around 0 87.1%
mul-1-neg87.1%
unsub-neg87.1%
*-commutative87.1%
associate-*l*87.1%
distribute-lft-out--87.1%
Simplified87.1%
Taylor expanded in re around 0 64.1%
Taylor expanded in im around 0 37.0%
neg-mul-137.0%
Simplified37.0%
if 5.80000000000000004e153 < re Initial program 68.2%
sub0-neg68.2%
Simplified68.2%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out33.4%
+-commutative33.4%
*-commutative33.4%
unpow233.4%
associate-*l*33.4%
Simplified33.4%
Applied egg-rr27.9%
Taylor expanded in re around inf 27.9%
unpow227.9%
Simplified27.9%
Final simplification35.8%
(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.3%
sub0-neg54.3%
Simplified54.3%
Taylor expanded in im around 0 85.8%
mul-1-neg85.8%
unsub-neg85.8%
*-commutative85.8%
associate-*l*85.8%
distribute-lft-out--85.8%
Simplified85.8%
Taylor expanded in re around 0 58.8%
Taylor expanded in im around 0 33.0%
neg-mul-133.0%
Simplified33.0%
Final simplification33.0%
(FPCore (re im) :precision binary64 13.5)
double code(double re, double im) {
return 13.5;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 13.5d0
end function
public static double code(double re, double im) {
return 13.5;
}
def code(re, im): return 13.5
function code(re, im) return 13.5 end
function tmp = code(re, im) tmp = 13.5; end
code[re_, im_] := 13.5
\begin{array}{l}
\\
13.5
\end{array}
Initial program 54.3%
sub0-neg54.3%
Simplified54.3%
Taylor expanded in re around 0 3.7%
*-commutative3.7%
associate-*r*3.7%
distribute-rgt-out39.3%
+-commutative39.3%
*-commutative39.3%
unpow239.3%
associate-*l*39.3%
Simplified39.3%
Applied egg-rr8.2%
Taylor expanded in re around 0 3.1%
Final simplification3.1%
(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 2023189
(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))))