
(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 20 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 1e-6)))
(* (* 0.5 (cos re)) t_0)
(+
(* -0.008333333333333333 (* (cos re) (pow im 5.0)))
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 1e-6)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = (-0.008333333333333333 * (cos(re) * pow(im, 5.0))) + (cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 1e-6)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = (-0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0))) + (Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 1e-6): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = (-0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0))) + (math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 1e-6)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) + Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 1e-6))) tmp = (0.5 * cos(re)) * t_0; else tmp = (-0.008333333333333333 * (cos(re) * (im ^ 5.0))) + (cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 1e-6]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $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 10^{-6}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;-0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right) + \cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 9.99999999999999955e-7 < (-.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)) < 9.99999999999999955e-7Initial program 8.4%
sub0-neg8.4%
Simplified8.4%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
*-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
Simplified99.8%
Taylor expanded in re around inf 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 1e-6)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(* -0.16666666666666666 (pow im 3.0))
(- (* -0.008333333333333333 (pow im 5.0)) im))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 1e-6)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) + ((-0.008333333333333333 * pow(im, 5.0)) - im));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 1e-6)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) + ((-0.008333333333333333 * Math.pow(im, 5.0)) - im));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 1e-6): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) + ((-0.008333333333333333 * math.pow(im, 5.0)) - im)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 1e-6)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) + Float64(Float64(-0.008333333333333333 * (im ^ 5.0)) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 1e-6))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) + ((-0.008333333333333333 * (im ^ 5.0)) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 1e-6]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.008333333333333333 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision] - im), $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 10^{-6}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} + \left(-0.008333333333333333 \cdot {im}^{5} - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 9.99999999999999955e-7 < (-.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)) < 9.99999999999999955e-7Initial program 8.4%
sub0-neg8.4%
Simplified8.4%
Taylor expanded in im around 0 99.8%
*-commutative99.8%
associate-*l*99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
associate-*l*99.8%
distribute-lft-out--99.8%
distribute-lft-out99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.005) (not (<= t_0 1e-6)))
(* (* 0.5 (cos re)) t_0)
(- (* (pow im 3.0) (* (cos re) -0.16666666666666666)) (* im (cos re))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -0.005) || !(t_0 <= 1e-6)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = (pow(im, 3.0) * (cos(re) * -0.16666666666666666)) - (im * cos(re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-0.005d0)) .or. (.not. (t_0 <= 1d-6))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = ((im ** 3.0d0) * (cos(re) * (-0.16666666666666666d0))) - (im * cos(re))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -0.005) || !(t_0 <= 1e-6)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = (Math.pow(im, 3.0) * (Math.cos(re) * -0.16666666666666666)) - (im * Math.cos(re));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -0.005) or not (t_0 <= 1e-6): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = (math.pow(im, 3.0) * (math.cos(re) * -0.16666666666666666)) - (im * math.cos(re)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -0.005) || !(t_0 <= 1e-6)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(Float64((im ^ 3.0) * Float64(cos(re) * -0.16666666666666666)) - Float64(im * cos(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -0.005) || ~((t_0 <= 1e-6))) tmp = (0.5 * cos(re)) * t_0; else tmp = ((im ^ 3.0) * (cos(re) * -0.16666666666666666)) - (im * cos(re)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.005], N[Not[LessEqual[t$95$0, 1e-6]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - N[(im * N[Cos[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.005 \lor \neg \left(t_0 \leq 10^{-6}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot \left(\cos re \cdot -0.16666666666666666\right) - im \cdot \cos re\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -0.0050000000000000001 or 9.99999999999999955e-7 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
if -0.0050000000000000001 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 9.99999999999999955e-7Initial program 7.7%
sub0-neg7.7%
Simplified7.7%
Taylor expanded in im around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.005) (not (<= t_0 1e-6)))
(* (* 0.5 (cos re)) t_0)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -0.005) || !(t_0 <= 1e-6)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.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 = exp(-im) - exp(im)
if ((t_0 <= (-0.005d0)) .or. (.not. (t_0 <= 1d-6))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - 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.005) || !(t_0 <= 1e-6)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -0.005) or not (t_0 <= 1e-6): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -0.005) || !(t_0 <= 1e-6)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -0.005) || ~((t_0 <= 1e-6))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.005], N[Not[LessEqual[t$95$0, 1e-6]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.005 \lor \neg \left(t_0 \leq 10^{-6}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -0.0050000000000000001 or 9.99999999999999955e-7 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
if -0.0050000000000000001 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 9.99999999999999955e-7Initial program 7.7%
sub0-neg7.7%
Simplified7.7%
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 (* -0.008333333333333333 (* (cos re) (pow im 5.0)))))
(if (<= im -2.3e+64)
t_1
(if (<= im -18.0)
(* t_0 (+ 0.5 (* re (* re -0.25))))
(if (<= im 0.07)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 4.5e+61) (* 0.5 t_0) t_1))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
double tmp;
if (im <= -2.3e+64) {
tmp = t_1;
} else if (im <= -18.0) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if (im <= 0.07) {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 4.5e+61) {
tmp = 0.5 * t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
if (im <= (-2.3d+64)) then
tmp = t_1
else if (im <= (-18.0d0)) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= 0.07d0) then
tmp = cos(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else if (im <= 4.5d+61) then
tmp = 0.5d0 * t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -2.3e+64) {
tmp = t_1;
} else if (im <= -18.0) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if (im <= 0.07) {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 4.5e+61) {
tmp = 0.5 * t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) tmp = 0 if im <= -2.3e+64: tmp = t_1 elif im <= -18.0: tmp = t_0 * (0.5 + (re * (re * -0.25))) elif im <= 0.07: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 4.5e+61: tmp = 0.5 * t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -2.3e+64) tmp = t_1; elseif (im <= -18.0) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= 0.07) tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 4.5e+61) tmp = Float64(0.5 * t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -2.3e+64) tmp = t_1; elseif (im <= -18.0) tmp = t_0 * (0.5 + (re * (re * -0.25))); elseif (im <= 0.07) tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); elseif (im <= 4.5e+61) tmp = 0.5 * t_0; 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[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.3e+64], t$95$1, If[LessEqual[im, -18.0], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 0.07], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.5e+61], N[(0.5 * t$95$0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -2.3 \cdot 10^{+64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -18:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 0.07:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.3e64 or 4.5e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -2.3e64 < im < -18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out89.5%
*-commutative89.5%
unpow289.5%
associate-*l*89.5%
Simplified89.5%
if -18 < im < 0.070000000000000007Initial program 9.7%
sub0-neg9.7%
Simplified9.7%
Taylor expanded in im around 0 98.5%
mul-1-neg98.5%
unsub-neg98.5%
*-commutative98.5%
associate-*l*98.5%
distribute-lft-out--98.5%
Simplified98.5%
if 0.070000000000000007 < im < 4.5e61Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 100.0%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.008333333333333333 (* (cos re) (pow im 5.0)))))
(if (<= im -1.7e+93)
t_1
(if (<= im -2000000000000.0)
t_0
(if (<= im 3e-5) (* (cos re) (- im)) (if (<= im 4.5e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
double tmp;
if (im <= -1.7e+93) {
tmp = t_1;
} else if (im <= -2000000000000.0) {
tmp = t_0;
} else if (im <= 3e-5) {
tmp = cos(re) * -im;
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
if (im <= (-1.7d+93)) then
tmp = t_1
else if (im <= (-2000000000000.0d0)) then
tmp = t_0
else if (im <= 3d-5) then
tmp = cos(re) * -im
else if (im <= 4.5d+61) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -1.7e+93) {
tmp = t_1;
} else if (im <= -2000000000000.0) {
tmp = t_0;
} else if (im <= 3e-5) {
tmp = Math.cos(re) * -im;
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) tmp = 0 if im <= -1.7e+93: tmp = t_1 elif im <= -2000000000000.0: tmp = t_0 elif im <= 3e-5: tmp = math.cos(re) * -im elif im <= 4.5e+61: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -1.7e+93) tmp = t_1; elseif (im <= -2000000000000.0) tmp = t_0; elseif (im <= 3e-5) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -1.7e+93) tmp = t_1; elseif (im <= -2000000000000.0) tmp = t_0; elseif (im <= 3e-5) tmp = cos(re) * -im; elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.7e+93], t$95$1, If[LessEqual[im, -2000000000000.0], t$95$0, If[LessEqual[im, 3e-5], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 4.5e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -1.7 \cdot 10^{+93}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2000000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3 \cdot 10^{-5}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.7e93 or 4.5e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.7e93 < im < -2e12 or 3.00000000000000008e-5 < im < 4.5e61Initial program 98.7%
sub0-neg98.7%
Simplified98.7%
Taylor expanded in re around 0 85.3%
if -2e12 < im < 3.00000000000000008e-5Initial program 9.4%
sub0-neg9.4%
Simplified9.4%
Taylor expanded in im around 0 97.1%
mul-1-neg97.1%
*-commutative97.1%
distribute-lft-neg-in97.1%
Simplified97.1%
Final simplification96.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.008333333333333333 (* (cos re) (pow im 5.0)))))
(if (<= im -1.7e+93)
t_1
(if (<= im -2000000000000.0)
t_0
(if (<= im 0.28)
(* (cos re) (- (* -0.16666666666666666 (pow im 3.0)) im))
(if (<= im 4.5e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
double tmp;
if (im <= -1.7e+93) {
tmp = t_1;
} else if (im <= -2000000000000.0) {
tmp = t_0;
} else if (im <= 0.28) {
tmp = cos(re) * ((-0.16666666666666666 * pow(im, 3.0)) - im);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
if (im <= (-1.7d+93)) then
tmp = t_1
else if (im <= (-2000000000000.0d0)) then
tmp = t_0
else if (im <= 0.28d0) then
tmp = cos(re) * (((-0.16666666666666666d0) * (im ** 3.0d0)) - im)
else if (im <= 4.5d+61) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
double tmp;
if (im <= -1.7e+93) {
tmp = t_1;
} else if (im <= -2000000000000.0) {
tmp = t_0;
} else if (im <= 0.28) {
tmp = Math.cos(re) * ((-0.16666666666666666 * Math.pow(im, 3.0)) - im);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) tmp = 0 if im <= -1.7e+93: tmp = t_1 elif im <= -2000000000000.0: tmp = t_0 elif im <= 0.28: tmp = math.cos(re) * ((-0.16666666666666666 * math.pow(im, 3.0)) - im) elif im <= 4.5e+61: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))) tmp = 0.0 if (im <= -1.7e+93) tmp = t_1; elseif (im <= -2000000000000.0) tmp = t_0; elseif (im <= 0.28) tmp = Float64(cos(re) * Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im)); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); tmp = 0.0; if (im <= -1.7e+93) tmp = t_1; elseif (im <= -2000000000000.0) tmp = t_0; elseif (im <= 0.28) tmp = cos(re) * ((-0.16666666666666666 * (im ^ 3.0)) - im); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.7e+93], t$95$1, If[LessEqual[im, -2000000000000.0], t$95$0, If[LessEqual[im, 0.28], N[(N[Cos[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.5e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -1.7 \cdot 10^{+93}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2000000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.28:\\
\;\;\;\;\cos re \cdot \left(-0.16666666666666666 \cdot {im}^{3} - im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.7e93 or 4.5e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.7e93 < im < -2e12 or 0.28000000000000003 < im < 4.5e61Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 87.5%
if -2e12 < im < 0.28000000000000003Initial program 11.1%
sub0-neg11.1%
Simplified11.1%
Taylor expanded in im around 0 97.1%
mul-1-neg97.1%
unsub-neg97.1%
*-commutative97.1%
associate-*l*97.1%
distribute-lft-out--97.1%
Simplified97.1%
Final simplification96.9%
(FPCore (re im) :precision binary64 (if (or (<= im -3.3) (not (<= im 3.3))) (* -0.008333333333333333 (* (cos re) (pow im 5.0))) (* (cos re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.3)) {
tmp = -0.008333333333333333 * (cos(re) * pow(im, 5.0));
} else {
tmp = cos(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 <= (-3.3d0)) .or. (.not. (im <= 3.3d0))) then
tmp = (-0.008333333333333333d0) * (cos(re) * (im ** 5.0d0))
else
tmp = cos(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.3) || !(im <= 3.3)) {
tmp = -0.008333333333333333 * (Math.cos(re) * Math.pow(im, 5.0));
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.3) or not (im <= 3.3): tmp = -0.008333333333333333 * (math.cos(re) * math.pow(im, 5.0)) else: tmp = math.cos(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.3) || !(im <= 3.3)) tmp = Float64(-0.008333333333333333 * Float64(cos(re) * (im ^ 5.0))); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.3) || ~((im <= 3.3))) tmp = -0.008333333333333333 * (cos(re) * (im ^ 5.0)); else tmp = cos(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.3], N[Not[LessEqual[im, 3.3]], $MachinePrecision]], N[(-0.008333333333333333 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.3 \lor \neg \left(im \leq 3.3\right):\\
\;\;\;\;-0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -3.2999999999999998 or 3.2999999999999998 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 76.2%
associate-+r+76.2%
+-commutative76.2%
associate-*r*76.2%
*-commutative76.2%
fma-def76.2%
*-commutative76.2%
mul-1-neg76.2%
unsub-neg76.2%
*-commutative76.2%
associate-*l*76.2%
distribute-lft-out--76.2%
Simplified76.2%
Taylor expanded in im around inf 76.2%
if -3.2999999999999998 < im < 3.2999999999999998Initial program 9.0%
sub0-neg9.0%
Simplified9.0%
Taylor expanded in im around 0 98.2%
mul-1-neg98.2%
*-commutative98.2%
distribute-lft-neg-in98.2%
Simplified98.2%
Final simplification87.6%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(- (* -0.16666666666666666 (pow im 3.0)) im)
(+ 1.0 (* (* re re) -0.5)))))
(if (<= im -9.6e+23)
t_0
(if (<= im 600.0)
(* (cos re) (- im))
(if (<= im 1.65e+78)
(- (* (pow re 4.0) (* im -0.041666666666666664)) im)
t_0)))))
double code(double re, double im) {
double t_0 = ((-0.16666666666666666 * pow(im, 3.0)) - im) * (1.0 + ((re * re) * -0.5));
double tmp;
if (im <= -9.6e+23) {
tmp = t_0;
} else if (im <= 600.0) {
tmp = cos(re) * -im;
} else if (im <= 1.65e+78) {
tmp = (pow(re, 4.0) * (im * -0.041666666666666664)) - 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 = (((-0.16666666666666666d0) * (im ** 3.0d0)) - im) * (1.0d0 + ((re * re) * (-0.5d0)))
if (im <= (-9.6d+23)) then
tmp = t_0
else if (im <= 600.0d0) then
tmp = cos(re) * -im
else if (im <= 1.65d+78) then
tmp = ((re ** 4.0d0) * (im * (-0.041666666666666664d0))) - im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = ((-0.16666666666666666 * Math.pow(im, 3.0)) - im) * (1.0 + ((re * re) * -0.5));
double tmp;
if (im <= -9.6e+23) {
tmp = t_0;
} else if (im <= 600.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.65e+78) {
tmp = (Math.pow(re, 4.0) * (im * -0.041666666666666664)) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = ((-0.16666666666666666 * math.pow(im, 3.0)) - im) * (1.0 + ((re * re) * -0.5)) tmp = 0 if im <= -9.6e+23: tmp = t_0 elif im <= 600.0: tmp = math.cos(re) * -im elif im <= 1.65e+78: tmp = (math.pow(re, 4.0) * (im * -0.041666666666666664)) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(Float64(-0.16666666666666666 * (im ^ 3.0)) - im) * Float64(1.0 + Float64(Float64(re * re) * -0.5))) tmp = 0.0 if (im <= -9.6e+23) tmp = t_0; elseif (im <= 600.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.65e+78) tmp = Float64(Float64((re ^ 4.0) * Float64(im * -0.041666666666666664)) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((-0.16666666666666666 * (im ^ 3.0)) - im) * (1.0 + ((re * re) * -0.5)); tmp = 0.0; if (im <= -9.6e+23) tmp = t_0; elseif (im <= 600.0) tmp = cos(re) * -im; elseif (im <= 1.65e+78) tmp = ((re ^ 4.0) * (im * -0.041666666666666664)) - im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision] * N[(1.0 + N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -9.6e+23], t$95$0, If[LessEqual[im, 600.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.65e+78], N[(N[(N[Power[re, 4.0], $MachinePrecision] * N[(im * -0.041666666666666664), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(-0.16666666666666666 \cdot {im}^{3} - im\right) \cdot \left(1 + \left(re \cdot re\right) \cdot -0.5\right)\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 600:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.65 \cdot 10^{+78}:\\
\;\;\;\;{re}^{4} \cdot \left(im \cdot -0.041666666666666664\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -9.6e23 or 1.65e78 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 79.9%
mul-1-neg79.9%
unsub-neg79.9%
*-commutative79.9%
associate-*l*79.9%
distribute-lft-out--79.9%
Simplified79.9%
Taylor expanded in re around 0 63.0%
*-commutative63.0%
unpow263.0%
Simplified63.0%
if -9.6e23 < im < 600Initial program 13.0%
sub0-neg13.0%
Simplified13.0%
Taylor expanded in im around 0 94.2%
mul-1-neg94.2%
*-commutative94.2%
distribute-lft-neg-in94.2%
Simplified94.2%
if 600 < im < 1.65e78Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
mul-1-neg3.4%
*-commutative3.4%
distribute-lft-neg-in3.4%
Simplified3.4%
Taylor expanded in re around 0 16.5%
neg-mul-116.5%
associate-+r+16.5%
+-commutative16.5%
associate-+r+16.5%
sub-neg16.5%
associate-*r*16.5%
associate-*r*16.5%
distribute-rgt-out16.5%
*-commutative16.5%
unpow216.5%
associate-*l*16.5%
*-commutative16.5%
Simplified16.5%
Taylor expanded in re around inf 37.9%
*-commutative37.9%
associate-*l*37.9%
Simplified37.9%
Final simplification78.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (pow im 3.0))))
(if (<= im -3.4e+52)
t_0
(if (<= im 510.0)
(* (cos re) (- im))
(if (<= im 6.8e+85)
(- (* (pow re 4.0) (* im -0.041666666666666664)) im)
(- t_0 im))))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * pow(im, 3.0);
double tmp;
if (im <= -3.4e+52) {
tmp = t_0;
} else if (im <= 510.0) {
tmp = cos(re) * -im;
} else if (im <= 6.8e+85) {
tmp = (pow(re, 4.0) * (im * -0.041666666666666664)) - im;
} else {
tmp = t_0 - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (im ** 3.0d0)
if (im <= (-3.4d+52)) then
tmp = t_0
else if (im <= 510.0d0) then
tmp = cos(re) * -im
else if (im <= 6.8d+85) then
tmp = ((re ** 4.0d0) * (im * (-0.041666666666666664d0))) - im
else
tmp = t_0 - im
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * Math.pow(im, 3.0);
double tmp;
if (im <= -3.4e+52) {
tmp = t_0;
} else if (im <= 510.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 6.8e+85) {
tmp = (Math.pow(re, 4.0) * (im * -0.041666666666666664)) - im;
} else {
tmp = t_0 - im;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * math.pow(im, 3.0) tmp = 0 if im <= -3.4e+52: tmp = t_0 elif im <= 510.0: tmp = math.cos(re) * -im elif im <= 6.8e+85: tmp = (math.pow(re, 4.0) * (im * -0.041666666666666664)) - im else: tmp = t_0 - im return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * (im ^ 3.0)) tmp = 0.0 if (im <= -3.4e+52) tmp = t_0; elseif (im <= 510.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 6.8e+85) tmp = Float64(Float64((re ^ 4.0) * Float64(im * -0.041666666666666664)) - im); else tmp = Float64(t_0 - im); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (im ^ 3.0); tmp = 0.0; if (im <= -3.4e+52) tmp = t_0; elseif (im <= 510.0) tmp = cos(re) * -im; elseif (im <= 6.8e+85) tmp = ((re ^ 4.0) * (im * -0.041666666666666664)) - im; else tmp = t_0 - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.4e+52], t$95$0, If[LessEqual[im, 510.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 6.8e+85], N[(N[(N[Power[re, 4.0], $MachinePrecision] * N[(im * -0.041666666666666664), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot {im}^{3}\\
\mathbf{if}\;im \leq -3.4 \cdot 10^{+52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 510:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 6.8 \cdot 10^{+85}:\\
\;\;\;\;{re}^{4} \cdot \left(im \cdot -0.041666666666666664\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -3.4e52Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
mul-1-neg88.1%
unsub-neg88.1%
*-commutative88.1%
associate-*l*88.1%
distribute-lft-out--88.1%
Simplified88.1%
Taylor expanded in re around 0 69.8%
Taylor expanded in im around inf 69.8%
if -3.4e52 < im < 510Initial program 19.4%
sub0-neg19.4%
Simplified19.4%
Taylor expanded in im around 0 87.5%
mul-1-neg87.5%
*-commutative87.5%
distribute-lft-neg-in87.5%
Simplified87.5%
if 510 < im < 6.8000000000000007e85Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
mul-1-neg3.4%
*-commutative3.4%
distribute-lft-neg-in3.4%
Simplified3.4%
Taylor expanded in re around 0 16.5%
neg-mul-116.5%
associate-+r+16.5%
+-commutative16.5%
associate-+r+16.5%
sub-neg16.5%
associate-*r*16.5%
associate-*r*16.5%
distribute-rgt-out16.5%
*-commutative16.5%
unpow216.5%
associate-*l*16.5%
*-commutative16.5%
Simplified16.5%
Taylor expanded in re around inf 37.9%
*-commutative37.9%
associate-*l*37.9%
Simplified37.9%
if 6.8000000000000007e85 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 90.1%
mul-1-neg90.1%
unsub-neg90.1%
*-commutative90.1%
associate-*l*90.1%
distribute-lft-out--90.1%
Simplified90.1%
Taylor expanded in re around 0 51.8%
Final simplification75.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* -0.16666666666666666 (pow im 3.0))))
(if (<= im -8.2e+52)
t_0
(if (<= im 6.9e-18) (* (cos re) (- im)) (- t_0 im)))))
double code(double re, double im) {
double t_0 = -0.16666666666666666 * pow(im, 3.0);
double tmp;
if (im <= -8.2e+52) {
tmp = t_0;
} else if (im <= 6.9e-18) {
tmp = cos(re) * -im;
} else {
tmp = t_0 - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.16666666666666666d0) * (im ** 3.0d0)
if (im <= (-8.2d+52)) then
tmp = t_0
else if (im <= 6.9d-18) then
tmp = cos(re) * -im
else
tmp = t_0 - im
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -0.16666666666666666 * Math.pow(im, 3.0);
double tmp;
if (im <= -8.2e+52) {
tmp = t_0;
} else if (im <= 6.9e-18) {
tmp = Math.cos(re) * -im;
} else {
tmp = t_0 - im;
}
return tmp;
}
def code(re, im): t_0 = -0.16666666666666666 * math.pow(im, 3.0) tmp = 0 if im <= -8.2e+52: tmp = t_0 elif im <= 6.9e-18: tmp = math.cos(re) * -im else: tmp = t_0 - im return tmp
function code(re, im) t_0 = Float64(-0.16666666666666666 * (im ^ 3.0)) tmp = 0.0 if (im <= -8.2e+52) tmp = t_0; elseif (im <= 6.9e-18) tmp = Float64(cos(re) * Float64(-im)); else tmp = Float64(t_0 - im); end return tmp end
function tmp_2 = code(re, im) t_0 = -0.16666666666666666 * (im ^ 3.0); tmp = 0.0; if (im <= -8.2e+52) tmp = t_0; elseif (im <= 6.9e-18) tmp = cos(re) * -im; else tmp = t_0 - im; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -8.2e+52], t$95$0, If[LessEqual[im, 6.9e-18], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], N[(t$95$0 - im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.16666666666666666 \cdot {im}^{3}\\
\mathbf{if}\;im \leq -8.2 \cdot 10^{+52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 6.9 \cdot 10^{-18}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\end{array}
if im < -8.1999999999999999e52Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.1%
mul-1-neg88.1%
unsub-neg88.1%
*-commutative88.1%
associate-*l*88.1%
distribute-lft-out--88.1%
Simplified88.1%
Taylor expanded in re around 0 69.8%
Taylor expanded in im around inf 69.8%
if -8.1999999999999999e52 < im < 6.9000000000000003e-18Initial program 18.1%
sub0-neg18.1%
Simplified18.1%
Taylor expanded in im around 0 88.1%
mul-1-neg88.1%
*-commutative88.1%
distribute-lft-neg-in88.1%
Simplified88.1%
if 6.9000000000000003e-18 < im Initial program 97.4%
sub0-neg97.4%
Simplified97.4%
Taylor expanded in im around 0 68.5%
mul-1-neg68.5%
unsub-neg68.5%
*-commutative68.5%
associate-*l*68.5%
distribute-lft-out--68.5%
Simplified68.5%
Taylor expanded in re around 0 41.7%
Final simplification74.2%
(FPCore (re im) :precision binary64 (if (or (<= im -2000000000000.0) (not (<= im 3.4))) (* -0.16666666666666666 (pow im 3.0)) (- im)))
double code(double re, double im) {
double tmp;
if ((im <= -2000000000000.0) || !(im <= 3.4)) {
tmp = -0.16666666666666666 * pow(im, 3.0);
} 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 <= (-2000000000000.0d0)) .or. (.not. (im <= 3.4d0))) then
tmp = (-0.16666666666666666d0) * (im ** 3.0d0)
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -2000000000000.0) || !(im <= 3.4)) {
tmp = -0.16666666666666666 * Math.pow(im, 3.0);
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -2000000000000.0) or not (im <= 3.4): tmp = -0.16666666666666666 * math.pow(im, 3.0) else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -2000000000000.0) || !(im <= 3.4)) tmp = Float64(-0.16666666666666666 * (im ^ 3.0)); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -2000000000000.0) || ~((im <= 3.4))) tmp = -0.16666666666666666 * (im ^ 3.0); else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -2000000000000.0], N[Not[LessEqual[im, 3.4]], $MachinePrecision]], N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2000000000000 \lor \neg \left(im \leq 3.4\right):\\
\;\;\;\;-0.16666666666666666 \cdot {im}^{3}\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if im < -2e12 or 3.39999999999999991 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 69.1%
mul-1-neg69.1%
unsub-neg69.1%
*-commutative69.1%
associate-*l*69.1%
distribute-lft-out--69.1%
Simplified69.1%
Taylor expanded in re around 0 48.8%
Taylor expanded in im around inf 48.8%
if -2e12 < im < 3.39999999999999991Initial program 11.1%
sub0-neg11.1%
Simplified11.1%
Taylor expanded in im around 0 96.2%
mul-1-neg96.2%
*-commutative96.2%
distribute-lft-neg-in96.2%
Simplified96.2%
Taylor expanded in re around 0 50.5%
neg-mul-150.5%
Simplified50.5%
Final simplification49.7%
(FPCore (re im) :precision binary64 (if (or (<= im -2.5e+54) (not (<= im 1600000000000.0))) (* -0.16666666666666666 (pow im 3.0)) (* (cos re) (- im))))
double code(double re, double im) {
double tmp;
if ((im <= -2.5e+54) || !(im <= 1600000000000.0)) {
tmp = -0.16666666666666666 * pow(im, 3.0);
} else {
tmp = cos(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 <= (-2.5d+54)) .or. (.not. (im <= 1600000000000.0d0))) then
tmp = (-0.16666666666666666d0) * (im ** 3.0d0)
else
tmp = cos(re) * -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -2.5e+54) || !(im <= 1600000000000.0)) {
tmp = -0.16666666666666666 * Math.pow(im, 3.0);
} else {
tmp = Math.cos(re) * -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -2.5e+54) or not (im <= 1600000000000.0): tmp = -0.16666666666666666 * math.pow(im, 3.0) else: tmp = math.cos(re) * -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -2.5e+54) || !(im <= 1600000000000.0)) tmp = Float64(-0.16666666666666666 * (im ^ 3.0)); else tmp = Float64(cos(re) * Float64(-im)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -2.5e+54) || ~((im <= 1600000000000.0))) tmp = -0.16666666666666666 * (im ^ 3.0); else tmp = cos(re) * -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -2.5e+54], N[Not[LessEqual[im, 1600000000000.0]], $MachinePrecision]], N[(-0.16666666666666666 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.5 \cdot 10^{+54} \lor \neg \left(im \leq 1600000000000\right):\\
\;\;\;\;-0.16666666666666666 \cdot {im}^{3}\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\end{array}
\end{array}
if im < -2.50000000000000003e54 or 1.6e12 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 77.7%
mul-1-neg77.7%
unsub-neg77.7%
*-commutative77.7%
associate-*l*77.7%
distribute-lft-out--77.7%
Simplified77.7%
Taylor expanded in re around 0 54.8%
Taylor expanded in im around inf 54.8%
if -2.50000000000000003e54 < im < 1.6e12Initial program 19.4%
sub0-neg19.4%
Simplified19.4%
Taylor expanded in im around 0 87.5%
mul-1-neg87.5%
*-commutative87.5%
distribute-lft-neg-in87.5%
Simplified87.5%
Final simplification74.0%
(FPCore (re im) :precision binary64 (if (<= im -5.5e+155) (/ (* im im) (- (* im (* re (* re -0.5))) im)) (if (<= im 9e+76) (- im) (* im (+ (* 0.5 (* re re)) -1.0)))))
double code(double re, double im) {
double tmp;
if (im <= -5.5e+155) {
tmp = (im * im) / ((im * (re * (re * -0.5))) - im);
} else if (im <= 9e+76) {
tmp = -im;
} else {
tmp = 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) :: tmp
if (im <= (-5.5d+155)) then
tmp = (im * im) / ((im * (re * (re * (-0.5d0)))) - im)
else if (im <= 9d+76) then
tmp = -im
else
tmp = im * ((0.5d0 * (re * re)) + (-1.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -5.5e+155) {
tmp = (im * im) / ((im * (re * (re * -0.5))) - im);
} else if (im <= 9e+76) {
tmp = -im;
} else {
tmp = im * ((0.5 * (re * re)) + -1.0);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -5.5e+155: tmp = (im * im) / ((im * (re * (re * -0.5))) - im) elif im <= 9e+76: tmp = -im else: tmp = im * ((0.5 * (re * re)) + -1.0) return tmp
function code(re, im) tmp = 0.0 if (im <= -5.5e+155) tmp = Float64(Float64(im * im) / Float64(Float64(im * Float64(re * Float64(re * -0.5))) - im)); elseif (im <= 9e+76) tmp = Float64(-im); else tmp = Float64(im * Float64(Float64(0.5 * Float64(re * re)) + -1.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -5.5e+155) tmp = (im * im) / ((im * (re * (re * -0.5))) - im); elseif (im <= 9e+76) tmp = -im; else tmp = im * ((0.5 * (re * re)) + -1.0); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -5.5e+155], N[(N[(im * im), $MachinePrecision] / N[(N[(im * N[(re * N[(re * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9e+76], (-im), N[(im * N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.5 \cdot 10^{+155}:\\
\;\;\;\;\frac{im \cdot im}{im \cdot \left(re \cdot \left(re \cdot -0.5\right)\right) - im}\\
\mathbf{elif}\;im \leq 9 \cdot 10^{+76}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right) + -1\right)\\
\end{array}
\end{array}
if im < -5.5000000000000001e155Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.5%
mul-1-neg7.5%
*-commutative7.5%
distribute-lft-neg-in7.5%
Simplified7.5%
Taylor expanded in re around 0 26.8%
neg-mul-126.8%
+-commutative26.8%
unsub-neg26.8%
*-commutative26.8%
associate-*l*26.8%
unpow226.8%
*-commutative26.8%
associate-*l*26.8%
*-commutative26.8%
Simplified26.8%
flip--47.2%
frac-2neg47.2%
Applied egg-rr0.0%
Simplified0.0%
Taylor expanded in re around 0 61.1%
unpow261.1%
Simplified61.1%
if -5.5000000000000001e155 < im < 8.9999999999999995e76Initial program 33.9%
sub0-neg33.9%
Simplified33.9%
Taylor expanded in im around 0 72.4%
mul-1-neg72.4%
*-commutative72.4%
distribute-lft-neg-in72.4%
Simplified72.4%
Taylor expanded in re around 0 38.3%
neg-mul-138.3%
Simplified38.3%
if 8.9999999999999995e76 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.1%
mul-1-neg6.1%
*-commutative6.1%
distribute-lft-neg-in6.1%
Simplified6.1%
Taylor expanded in re around 0 35.0%
neg-mul-135.0%
+-commutative35.0%
unsub-neg35.0%
*-commutative35.0%
associate-*l*35.0%
unpow235.0%
*-commutative35.0%
associate-*l*35.0%
*-commutative35.0%
Simplified35.0%
flip--27.2%
frac-2neg27.2%
Applied egg-rr5.6%
Simplified5.6%
Taylor expanded in re around 0 35.0%
neg-mul-135.0%
+-commutative35.0%
associate-*r*35.0%
neg-mul-135.0%
distribute-rgt-out35.0%
*-commutative35.0%
unpow235.0%
Simplified35.0%
Final simplification41.1%
(FPCore (re im) :precision binary64 (if (or (<= im -17.0) (not (<= im 4.1e+89))) (* im (* 0.5 (* re re))) (- im)))
double code(double re, double im) {
double tmp;
if ((im <= -17.0) || !(im <= 4.1e+89)) {
tmp = im * (0.5 * (re * re));
} else {
tmp = -im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-17.0d0)) .or. (.not. (im <= 4.1d+89))) then
tmp = im * (0.5d0 * (re * re))
else
tmp = -im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -17.0) || !(im <= 4.1e+89)) {
tmp = im * (0.5 * (re * re));
} else {
tmp = -im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -17.0) or not (im <= 4.1e+89): tmp = im * (0.5 * (re * re)) else: tmp = -im return tmp
function code(re, im) tmp = 0.0 if ((im <= -17.0) || !(im <= 4.1e+89)) tmp = Float64(im * Float64(0.5 * Float64(re * re))); else tmp = Float64(-im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -17.0) || ~((im <= 4.1e+89))) tmp = im * (0.5 * (re * re)); else tmp = -im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -17.0], N[Not[LessEqual[im, 4.1e+89]], $MachinePrecision]], N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-im)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -17 \lor \neg \left(im \leq 4.1 \cdot 10^{+89}\right):\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\end{array}
if im < -17 or 4.09999999999999985e89 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-lft-neg-in5.9%
Simplified5.9%
Taylor expanded in re around 0 24.9%
neg-mul-124.9%
+-commutative24.9%
unsub-neg24.9%
*-commutative24.9%
associate-*l*24.9%
unpow224.9%
*-commutative24.9%
associate-*l*24.9%
*-commutative24.9%
Simplified24.9%
flip--27.9%
frac-2neg27.9%
Applied egg-rr4.6%
Simplified4.6%
Taylor expanded in re around inf 22.6%
*-commutative22.6%
*-commutative22.6%
associate-*l*22.6%
unpow222.6%
Simplified22.6%
if -17 < im < 4.09999999999999985e89Initial program 18.8%
sub0-neg18.8%
Simplified18.8%
Taylor expanded in im around 0 88.0%
mul-1-neg88.0%
*-commutative88.0%
distribute-lft-neg-in88.0%
Simplified88.0%
Taylor expanded in re around 0 46.4%
neg-mul-146.4%
Simplified46.4%
Final simplification36.5%
(FPCore (re im) :precision binary64 (* im (+ (* 0.5 (* re re)) -1.0)))
double code(double re, double im) {
return im * ((0.5 * (re * re)) + -1.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im * ((0.5d0 * (re * re)) + (-1.0d0))
end function
public static double code(double re, double im) {
return im * ((0.5 * (re * re)) + -1.0);
}
def code(re, im): return im * ((0.5 * (re * re)) + -1.0)
function code(re, im) return Float64(im * Float64(Float64(0.5 * Float64(re * re)) + -1.0)) end
function tmp = code(re, im) tmp = im * ((0.5 * (re * re)) + -1.0); end
code[re_, im_] := N[(im * N[(N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
im \cdot \left(0.5 \cdot \left(re \cdot re\right) + -1\right)
\end{array}
Initial program 52.7%
sub0-neg52.7%
Simplified52.7%
Taylor expanded in im around 0 53.7%
mul-1-neg53.7%
*-commutative53.7%
distribute-lft-neg-in53.7%
Simplified53.7%
Taylor expanded in re around 0 34.5%
neg-mul-134.5%
+-commutative34.5%
unsub-neg34.5%
*-commutative34.5%
associate-*l*34.5%
unpow234.5%
*-commutative34.5%
associate-*l*34.5%
*-commutative34.5%
Simplified34.5%
flip--22.9%
frac-2neg22.9%
Applied egg-rr13.0%
Simplified12.9%
Taylor expanded in re around 0 34.5%
neg-mul-134.5%
+-commutative34.5%
associate-*r*34.5%
neg-mul-134.5%
distribute-rgt-out34.5%
*-commutative34.5%
unpow234.5%
Simplified34.5%
Final simplification34.5%
(FPCore (re im) :precision binary64 (- (* re (* re (* im 0.5))) im))
double code(double re, double im) {
return (re * (re * (im * 0.5))) - im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (re * (re * (im * 0.5d0))) - im
end function
public static double code(double re, double im) {
return (re * (re * (im * 0.5))) - im;
}
def code(re, im): return (re * (re * (im * 0.5))) - im
function code(re, im) return Float64(Float64(re * Float64(re * Float64(im * 0.5))) - im) end
function tmp = code(re, im) tmp = (re * (re * (im * 0.5))) - im; end
code[re_, im_] := N[(N[(re * N[(re * N[(im * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]
\begin{array}{l}
\\
re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right) - im
\end{array}
Initial program 52.7%
sub0-neg52.7%
Simplified52.7%
Taylor expanded in im around 0 53.7%
mul-1-neg53.7%
*-commutative53.7%
distribute-lft-neg-in53.7%
Simplified53.7%
Taylor expanded in re around 0 34.5%
neg-mul-134.5%
+-commutative34.5%
unsub-neg34.5%
*-commutative34.5%
associate-*l*34.5%
unpow234.5%
*-commutative34.5%
associate-*l*34.5%
*-commutative34.5%
Simplified34.5%
Final simplification34.5%
(FPCore (re im) :precision binary64 (if (<= im 2.6e+94) (- im) (* re (* re 0.75))))
double code(double re, double im) {
double tmp;
if (im <= 2.6e+94) {
tmp = -im;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= 2.6d+94) then
tmp = -im
else
tmp = re * (re * 0.75d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 2.6e+94) {
tmp = -im;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 2.6e+94: tmp = -im else: tmp = re * (re * 0.75) return tmp
function code(re, im) tmp = 0.0 if (im <= 2.6e+94) tmp = Float64(-im); else tmp = Float64(re * Float64(re * 0.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 2.6e+94) tmp = -im; else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 2.6e+94], (-im), N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 2.6 \cdot 10^{+94}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if im < 2.5999999999999999e94Initial program 45.3%
sub0-neg45.3%
Simplified45.3%
Taylor expanded in im around 0 61.2%
mul-1-neg61.2%
*-commutative61.2%
distribute-lft-neg-in61.2%
Simplified61.2%
Taylor expanded in re around 0 32.8%
neg-mul-132.8%
Simplified32.8%
if 2.5999999999999999e94 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out71.4%
*-commutative71.4%
unpow271.4%
associate-*l*71.4%
Simplified71.4%
Applied egg-rr27.5%
Taylor expanded in re around inf 27.0%
*-commutative27.0%
unpow227.0%
associate-*l*27.0%
Simplified27.0%
Final simplification32.0%
(FPCore (re im) :precision binary64 (- im))
double code(double re, double im) {
return -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -im
end function
public static double code(double re, double im) {
return -im;
}
def code(re, im): return -im
function code(re, im) return Float64(-im) end
function tmp = code(re, im) tmp = -im; end
code[re_, im_] := (-im)
\begin{array}{l}
\\
-im
\end{array}
Initial program 52.7%
sub0-neg52.7%
Simplified52.7%
Taylor expanded in im around 0 53.7%
mul-1-neg53.7%
*-commutative53.7%
distribute-lft-neg-in53.7%
Simplified53.7%
Taylor expanded in re around 0 28.8%
neg-mul-128.8%
Simplified28.8%
Final simplification28.8%
(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 52.7%
sub0-neg52.7%
Simplified52.7%
Taylor expanded in re around 0 2.9%
+-commutative2.9%
*-commutative2.9%
associate-*r*2.9%
distribute-rgt-out38.5%
*-commutative38.5%
unpow238.5%
associate-*l*38.5%
Simplified38.5%
Applied egg-rr7.3%
Taylor expanded in re around 0 2.8%
Final simplification2.8%
(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 2023187
(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))))