
(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 21 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 -1.0) (not (<= t_0 0.04)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(-
(+
(* (pow im 3.0) -0.16666666666666666)
(* (pow im 5.0) -0.008333333333333333))
im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1.0) || !(t_0 <= 0.04)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 3.0) * -0.16666666666666666) + (pow(im, 5.0) * -0.008333333333333333)) - 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 <= (-1.0d0)) .or. (.not. (t_0 <= 0.04d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * ((((im ** 3.0d0) * (-0.16666666666666666d0)) + ((im ** 5.0d0) * (-0.008333333333333333d0))) - 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 <= -1.0) || !(t_0 <= 0.04)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * (((Math.pow(im, 3.0) * -0.16666666666666666) + (Math.pow(im, 5.0) * -0.008333333333333333)) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1.0) or not (t_0 <= 0.04): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * (((math.pow(im, 3.0) * -0.16666666666666666) + (math.pow(im, 5.0) * -0.008333333333333333)) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1.0) || !(t_0 <= 0.04)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64((im ^ 5.0) * -0.008333333333333333)) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1.0) || ~((t_0 <= 0.04))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 3.0) * -0.16666666666666666) + ((im ^ 5.0) * -0.008333333333333333)) - 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, -1.0], N[Not[LessEqual[t$95$0, 0.04]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \lor \neg \left(t_0 \leq 0.04\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{3} \cdot -0.16666666666666666 + {im}^{5} \cdot -0.008333333333333333\right) - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1 or 0.0400000000000000008 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.0400000000000000008Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 99.8%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
neg-mul-199.8%
unsub-neg99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
distribute-lft-out--99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -1.0) (not (<= t_0 2e-11)))
(* (* 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 <= -1.0) || !(t_0 <= 2e-11)) {
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 <= (-1.0d0)) .or. (.not. (t_0 <= 2d-11))) 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 <= -1.0) || !(t_0 <= 2e-11)) {
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 <= -1.0) or not (t_0 <= 2e-11): 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 <= -1.0) || !(t_0 <= 2e-11)) 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 <= -1.0) || ~((t_0 <= 2e-11))) 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, -1.0], N[Not[LessEqual[t$95$0, 2e-11]], $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 -1 \lor \neg \left(t_0 \leq 2 \cdot 10^{-11}\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)) < -1 or 1.99999999999999988e-11 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
neg-sub099.9%
Simplified99.9%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 1.99999999999999988e-11Initial program 8.0%
neg-sub08.0%
Simplified8.0%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r*99.8%
distribute-rgt-out--99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))) (t_1 (* 0.5 (cos re))))
(if (<= t_0 -1.0)
(* t_1 t_0)
(*
t_1
(+
(* im -2.0)
(+
(* -0.3333333333333333 (pow im 3.0))
(+
(* -0.016666666666666666 (pow im 5.0))
(* -0.0003968253968253968 (pow im 7.0)))))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = 0.5 * cos(re);
double tmp;
if (t_0 <= -1.0) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((-0.3333333333333333 * pow(im, 3.0)) + ((-0.016666666666666666 * pow(im, 5.0)) + (-0.0003968253968253968 * pow(im, 7.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) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = 0.5d0 * cos(re)
if (t_0 <= (-1.0d0)) then
tmp = t_1 * t_0
else
tmp = t_1 * ((im * (-2.0d0)) + (((-0.3333333333333333d0) * (im ** 3.0d0)) + (((-0.016666666666666666d0) * (im ** 5.0d0)) + ((-0.0003968253968253968d0) * (im ** 7.0d0)))))
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.5 * Math.cos(re);
double tmp;
if (t_0 <= -1.0) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((-0.3333333333333333 * Math.pow(im, 3.0)) + ((-0.016666666666666666 * Math.pow(im, 5.0)) + (-0.0003968253968253968 * Math.pow(im, 7.0)))));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = 0.5 * math.cos(re) tmp = 0 if t_0 <= -1.0: tmp = t_1 * t_0 else: tmp = t_1 * ((im * -2.0) + ((-0.3333333333333333 * math.pow(im, 3.0)) + ((-0.016666666666666666 * math.pow(im, 5.0)) + (-0.0003968253968253968 * math.pow(im, 7.0))))) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64(0.5 * cos(re)) tmp = 0.0 if (t_0 <= -1.0) tmp = Float64(t_1 * t_0); else tmp = Float64(t_1 * Float64(Float64(im * -2.0) + Float64(Float64(-0.3333333333333333 * (im ^ 3.0)) + Float64(Float64(-0.016666666666666666 * (im ^ 5.0)) + Float64(-0.0003968253968253968 * (im ^ 7.0)))))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = 0.5 * cos(re); tmp = 0.0; if (t_0 <= -1.0) tmp = t_1 * t_0; else tmp = t_1 * ((im * -2.0) + ((-0.3333333333333333 * (im ^ 3.0)) + ((-0.016666666666666666 * (im ^ 5.0)) + (-0.0003968253968253968 * (im ^ 7.0))))); 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.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1.0], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$1 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(-0.3333333333333333 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.016666666666666666 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-0.0003968253968253968 * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := 0.5 \cdot \cos re\\
\mathbf{if}\;t_0 \leq -1:\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(im \cdot -2 + \left(-0.3333333333333333 \cdot {im}^{3} + \left(-0.016666666666666666 \cdot {im}^{5} + -0.0003968253968253968 \cdot {im}^{7}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 41.3%
neg-sub041.3%
Simplified41.3%
Taylor expanded in im around 0 98.9%
Final simplification99.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (<= t_0 -1.0)
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(+
(* (pow im 5.0) -0.008333333333333333)
(* (pow im 7.0) -0.0001984126984126984))
(- (* (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 <= -1.0) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 5.0) * -0.008333333333333333) + (pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= (-1.0d0)) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * ((((im ** 5.0d0) * (-0.008333333333333333d0)) + ((im ** 7.0d0) * (-0.0001984126984126984d0))) + (((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 <= -1.0) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * (((Math.pow(im, 5.0) * -0.008333333333333333) + (Math.pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= -1.0: tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * (((math.pow(im, 5.0) * -0.008333333333333333) + (math.pow(im, 7.0) * -0.0001984126984126984)) + ((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 <= -1.0) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 5.0) * -0.008333333333333333) + Float64((im ^ 7.0) * -0.0001984126984126984)) + 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 <= -1.0) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 5.0) * -0.008333333333333333) + ((im ^ 7.0) * -0.0001984126984126984)) + (((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[LessEqual[t$95$0, -1.0], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] + N[(N[Power[im, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1:\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{5} \cdot -0.008333333333333333 + {im}^{7} \cdot -0.0001984126984126984\right) + \left({im}^{3} \cdot -0.16666666666666666 - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 41.3%
neg-sub041.3%
Simplified41.3%
Taylor expanded in im around 0 98.9%
Taylor expanded in im around 0 98.9%
associate-+r+98.9%
+-commutative98.9%
associate-*r*98.9%
neg-mul-198.9%
distribute-lft-neg-in98.9%
distribute-rgt-out98.9%
associate-*r*98.9%
associate-*r*98.9%
distribute-rgt-out98.9%
distribute-lft-out98.9%
unsub-neg98.9%
*-commutative98.9%
Simplified98.9%
Final simplification99.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 7.0) (* (cos re) -0.0001984126984126984)))
(t_1 (- (exp (- im)) (exp im)))
(t_2 (* 0.5 t_1)))
(if (<= im -5.7)
t_0
(if (<= im 0.029)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 3.6e+14)
t_2
(if (<= im 1.05e+25)
(* (* re re) (* t_1 -0.25))
(if (<= im 1.1e+44) t_2 t_0)))))))
double code(double re, double im) {
double t_0 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double t_1 = exp(-im) - exp(im);
double t_2 = 0.5 * t_1;
double tmp;
if (im <= -5.7) {
tmp = t_0;
} else if (im <= 0.029) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 3.6e+14) {
tmp = t_2;
} else if (im <= 1.05e+25) {
tmp = (re * re) * (t_1 * -0.25);
} else if (im <= 1.1e+44) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
t_1 = exp(-im) - exp(im)
t_2 = 0.5d0 * t_1
if (im <= (-5.7d0)) then
tmp = t_0
else if (im <= 0.029d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 3.6d+14) then
tmp = t_2
else if (im <= 1.05d+25) then
tmp = (re * re) * (t_1 * (-0.25d0))
else if (im <= 1.1d+44) then
tmp = t_2
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double t_1 = Math.exp(-im) - Math.exp(im);
double t_2 = 0.5 * t_1;
double tmp;
if (im <= -5.7) {
tmp = t_0;
} else if (im <= 0.029) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 3.6e+14) {
tmp = t_2;
} else if (im <= 1.05e+25) {
tmp = (re * re) * (t_1 * -0.25);
} else if (im <= 1.1e+44) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) t_1 = math.exp(-im) - math.exp(im) t_2 = 0.5 * t_1 tmp = 0 if im <= -5.7: tmp = t_0 elif im <= 0.029: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 3.6e+14: tmp = t_2 elif im <= 1.05e+25: tmp = (re * re) * (t_1 * -0.25) elif im <= 1.1e+44: tmp = t_2 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) t_1 = Float64(exp(Float64(-im)) - exp(im)) t_2 = Float64(0.5 * t_1) tmp = 0.0 if (im <= -5.7) tmp = t_0; elseif (im <= 0.029) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 3.6e+14) tmp = t_2; elseif (im <= 1.05e+25) tmp = Float64(Float64(re * re) * Float64(t_1 * -0.25)); elseif (im <= 1.1e+44) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); t_1 = exp(-im) - exp(im); t_2 = 0.5 * t_1; tmp = 0.0; if (im <= -5.7) tmp = t_0; elseif (im <= 0.029) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 3.6e+14) tmp = t_2; elseif (im <= 1.05e+25) tmp = (re * re) * (t_1 * -0.25); elseif (im <= 1.1e+44) tmp = t_2; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * t$95$1), $MachinePrecision]}, If[LessEqual[im, -5.7], t$95$0, If[LessEqual[im, 0.029], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.6e+14], t$95$2, If[LessEqual[im, 1.05e+25], N[(N[(re * re), $MachinePrecision] * N[(t$95$1 * -0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$2, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
t_1 := e^{-im} - e^{im}\\
t_2 := 0.5 \cdot t_1\\
\mathbf{if}\;im \leq -5.7:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.029:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 3.6 \cdot 10^{+14}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 1.05 \cdot 10^{+25}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(t_1 \cdot -0.25\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.70000000000000018 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
if -5.70000000000000018 < im < 0.0290000000000000015Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*r*99.5%
distribute-rgt-out--99.5%
*-commutative99.5%
Simplified99.5%
if 0.0290000000000000015 < im < 3.6e14 or 1.05e25 < im < 1.09999999999999998e44Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 86.0%
if 3.6e14 < im < 1.05e25Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in re around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification98.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -5.7)
t_0
(if (<= im 0.042)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44)
(* (- (exp (- im)) (exp im)) (+ 0.5 (* -0.25 (* re re))))
t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -5.7) {
tmp = t_0;
} else if (im <= 0.042) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = (exp(-im) - exp(im)) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-5.7d0)) then
tmp = t_0
else if (im <= 0.042d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = (exp(-im) - exp(im)) * (0.5d0 + ((-0.25d0) * (re * re)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -5.7) {
tmp = t_0;
} else if (im <= 0.042) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = (Math.exp(-im) - Math.exp(im)) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -5.7: tmp = t_0 elif im <= 0.042: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = (math.exp(-im) - math.exp(im)) * (0.5 + (-0.25 * (re * re))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -5.7) tmp = t_0; elseif (im <= 0.042) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -5.7) tmp = t_0; elseif (im <= 0.042) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = (exp(-im) - exp(im)) * (0.5 + (-0.25 * (re * re))); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.7], t$95$0, If[LessEqual[im, 0.042], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -5.7:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.042:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;\left(e^{-im} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.70000000000000018 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
if -5.70000000000000018 < im < 0.0420000000000000026Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*r*99.5%
distribute-rgt-out--99.5%
*-commutative99.5%
Simplified99.5%
if 0.0420000000000000026 < im < 1.09999999999999998e44Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 21.5%
+-commutative21.5%
associate-*r*21.5%
distribute-rgt-out79.4%
unpow279.4%
Simplified79.4%
Final simplification97.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im)))))
(if (<= im -0.0102)
t_0
(if (<= im 0.00105)
(* (cos re) (- im))
(if (<= im 2e+103)
t_0
(if (<= im 2e+165)
(* (* -0.3333333333333333 (pow im 3.0)) (+ 0.5 (* -0.25 (* re re))))
(- (* (pow im 3.0) -0.16666666666666666) im)))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double tmp;
if (im <= -0.0102) {
tmp = t_0;
} else if (im <= 0.00105) {
tmp = cos(re) * -im;
} else if (im <= 2e+103) {
tmp = t_0;
} else if (im <= 2e+165) {
tmp = (-0.3333333333333333 * pow(im, 3.0)) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = (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 = 0.5d0 * (exp(-im) - exp(im))
if (im <= (-0.0102d0)) then
tmp = t_0
else if (im <= 0.00105d0) then
tmp = cos(re) * -im
else if (im <= 2d+103) then
tmp = t_0
else if (im <= 2d+165) then
tmp = ((-0.3333333333333333d0) * (im ** 3.0d0)) * (0.5d0 + ((-0.25d0) * (re * re)))
else
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
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.0102) {
tmp = t_0;
} else if (im <= 0.00105) {
tmp = Math.cos(re) * -im;
} else if (im <= 2e+103) {
tmp = t_0;
} else if (im <= 2e+165) {
tmp = (-0.3333333333333333 * Math.pow(im, 3.0)) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) tmp = 0 if im <= -0.0102: tmp = t_0 elif im <= 0.00105: tmp = math.cos(re) * -im elif im <= 2e+103: tmp = t_0 elif im <= 2e+165: tmp = (-0.3333333333333333 * math.pow(im, 3.0)) * (0.5 + (-0.25 * (re * re))) else: tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) tmp = 0.0 if (im <= -0.0102) tmp = t_0; elseif (im <= 0.00105) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 2e+103) tmp = t_0; elseif (im <= 2e+165) tmp = Float64(Float64(-0.3333333333333333 * (im ^ 3.0)) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); else tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); tmp = 0.0; if (im <= -0.0102) tmp = t_0; elseif (im <= 0.00105) tmp = cos(re) * -im; elseif (im <= 2e+103) tmp = t_0; elseif (im <= 2e+165) tmp = (-0.3333333333333333 * (im ^ 3.0)) * (0.5 + (-0.25 * (re * re))); else tmp = ((im ^ 3.0) * -0.16666666666666666) - im; 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.0102], t$95$0, If[LessEqual[im, 0.00105], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 2e+103], t$95$0, If[LessEqual[im, 2e+165], N[(N[(-0.3333333333333333 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;im \leq -0.0102:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.00105:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+103}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+165}:\\
\;\;\;\;\left(-0.3333333333333333 \cdot {im}^{3}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\end{array}
\end{array}
if im < -0.010200000000000001 or 0.00104999999999999994 < im < 2e103Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 77.8%
if -0.010200000000000001 < im < 0.00104999999999999994Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 98.7%
associate-*r*98.7%
neg-mul-198.7%
Simplified98.7%
if 2e103 < im < 1.9999999999999998e165Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
Simplified100.0%
if 1.9999999999999998e165 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in im around 0 65.4%
Taylor expanded in re around 0 96.2%
distribute-lft-in96.2%
associate-*r*96.2%
metadata-eval96.2%
neg-mul-196.2%
associate-*r*96.2%
metadata-eval96.2%
*-commutative96.2%
+-commutative96.2%
unsub-neg96.2%
*-commutative96.2%
Simplified96.2%
Final simplification90.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 5.0) (* (cos re) -0.008333333333333333))))
(if (<= im -3.3)
t_0
(if (<= im 0.00059)
(* (cos re) (- im))
(if (<= im 1.6e+58) (* 0.5 (- (exp (- im)) (exp im))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 5.0) * (cos(re) * -0.008333333333333333);
double tmp;
if (im <= -3.3) {
tmp = t_0;
} else if (im <= 0.00059) {
tmp = cos(re) * -im;
} else if (im <= 1.6e+58) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 5.0d0) * (cos(re) * (-0.008333333333333333d0))
if (im <= (-3.3d0)) then
tmp = t_0
else if (im <= 0.00059d0) then
tmp = cos(re) * -im
else if (im <= 1.6d+58) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 5.0) * (Math.cos(re) * -0.008333333333333333);
double tmp;
if (im <= -3.3) {
tmp = t_0;
} else if (im <= 0.00059) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.6e+58) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 5.0) * (math.cos(re) * -0.008333333333333333) tmp = 0 if im <= -3.3: tmp = t_0 elif im <= 0.00059: tmp = math.cos(re) * -im elif im <= 1.6e+58: tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 5.0) * Float64(cos(re) * -0.008333333333333333)) tmp = 0.0 if (im <= -3.3) tmp = t_0; elseif (im <= 0.00059) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.6e+58) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 5.0) * (cos(re) * -0.008333333333333333); tmp = 0.0; if (im <= -3.3) tmp = t_0; elseif (im <= 0.00059) tmp = cos(re) * -im; elseif (im <= 1.6e+58) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 5.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.3], t$95$0, If[LessEqual[im, 0.00059], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.6e+58], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{5} \cdot \left(\cos re \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -3.3:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.00059:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.6 \cdot 10^{+58}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -3.2999999999999998 or 1.60000000000000008e58 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 92.5%
Taylor expanded in im around inf 92.5%
*-commutative92.5%
associate-*l*92.5%
Simplified92.5%
if -3.2999999999999998 < im < 5.9000000000000003e-4Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 98.7%
associate-*r*98.7%
neg-mul-198.7%
Simplified98.7%
if 5.9000000000000003e-4 < im < 1.60000000000000008e58Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 62.7%
Final simplification93.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -4.2)
t_0
(if (<= im 0.00126)
(* (cos re) (- im))
(if (<= im 1.1e+44) (* 0.5 (- (exp (- im)) (exp im))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -4.2) {
tmp = t_0;
} else if (im <= 0.00126) {
tmp = cos(re) * -im;
} else if (im <= 1.1e+44) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-4.2d0)) then
tmp = t_0
else if (im <= 0.00126d0) then
tmp = cos(re) * -im
else if (im <= 1.1d+44) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -4.2) {
tmp = t_0;
} else if (im <= 0.00126) {
tmp = Math.cos(re) * -im;
} else if (im <= 1.1e+44) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -4.2: tmp = t_0 elif im <= 0.00126: tmp = math.cos(re) * -im elif im <= 1.1e+44: tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -4.2) tmp = t_0; elseif (im <= 0.00126) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1.1e+44) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -4.2) tmp = t_0; elseif (im <= 0.00126) tmp = cos(re) * -im; elseif (im <= 1.1e+44) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -4.2], t$95$0, If[LessEqual[im, 0.00126], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -4.2:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.00126:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -4.20000000000000018 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
if -4.20000000000000018 < im < 0.00126000000000000005Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 98.7%
associate-*r*98.7%
neg-mul-198.7%
Simplified98.7%
if 0.00126000000000000005 < im < 1.09999999999999998e44Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 58.8%
Final simplification95.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -6.8)
t_0
(if (<= im 0.00125)
(* (cos re) (- (* (pow im 5.0) -0.008333333333333333) im))
(if (<= im 1.1e+44) (* 0.5 (- (exp (- im)) (exp im))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -6.8) {
tmp = t_0;
} else if (im <= 0.00125) {
tmp = cos(re) * ((pow(im, 5.0) * -0.008333333333333333) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-6.8d0)) then
tmp = t_0
else if (im <= 0.00125d0) then
tmp = cos(re) * (((im ** 5.0d0) * (-0.008333333333333333d0)) - im)
else if (im <= 1.1d+44) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -6.8) {
tmp = t_0;
} else if (im <= 0.00125) {
tmp = Math.cos(re) * ((Math.pow(im, 5.0) * -0.008333333333333333) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -6.8: tmp = t_0 elif im <= 0.00125: tmp = math.cos(re) * ((math.pow(im, 5.0) * -0.008333333333333333) - im) elif im <= 1.1e+44: tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -6.8) tmp = t_0; elseif (im <= 0.00125) tmp = Float64(cos(re) * Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im)); elseif (im <= 1.1e+44) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -6.8) tmp = t_0; elseif (im <= 0.00125) tmp = cos(re) * (((im ^ 5.0) * -0.008333333333333333) - im); elseif (im <= 1.1e+44) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.8], t$95$0, If[LessEqual[im, 0.00125], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -6.8:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.00125:\\
\;\;\;\;\cos re \cdot \left({im}^{5} \cdot -0.008333333333333333 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -6.79999999999999982 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
if -6.79999999999999982 < im < 0.00125000000000000003Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 99.8%
Taylor expanded in im around 0 99.8%
+-commutative99.8%
neg-mul-199.8%
unsub-neg99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
distribute-lft-out--99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in im around inf 98.7%
if 0.00125000000000000003 < im < 1.09999999999999998e44Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 58.8%
Final simplification95.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -5.7)
t_0
(if (<= im 0.061)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) (* 0.5 (- (exp (- im)) (exp im))) t_0)))))
double code(double re, double im) {
double t_0 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -5.7) {
tmp = t_0;
} else if (im <= 0.061) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * (exp(-im) - exp(im));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-5.7d0)) then
tmp = t_0
else if (im <= 0.061d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = 0.5d0 * (exp(-im) - exp(im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -5.7) {
tmp = t_0;
} else if (im <= 0.061) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -5.7: tmp = t_0 elif im <= 0.061: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = 0.5 * (math.exp(-im) - math.exp(im)) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -5.7) tmp = t_0; elseif (im <= 0.061) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -5.7) tmp = t_0; elseif (im <= 0.061) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = 0.5 * (exp(-im) - exp(im)); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.7], t$95$0, If[LessEqual[im, 0.061], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -5.7:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.061:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.70000000000000018 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
Taylor expanded in im around inf 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
if -5.70000000000000018 < im < 0.060999999999999999Initial program 9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in im around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
associate-*r*99.5%
distribute-rgt-out--99.5%
*-commutative99.5%
Simplified99.5%
if 0.060999999999999999 < im < 1.09999999999999998e44Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in re around 0 58.8%
Final simplification96.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -9.5e+56)
t_0
(if (<= im 8.6e-8)
(* (cos re) (- im))
(if (<= im 8.5e+165)
(*
(+ 0.5 (* -0.25 (* re re)))
(+ (* im -2.0) (* -0.3333333333333333 (pow im 3.0))))
t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -9.5e+56) {
tmp = t_0;
} else if (im <= 8.6e-8) {
tmp = cos(re) * -im;
} else if (im <= 8.5e+165) {
tmp = (0.5 + (-0.25 * (re * re))) * ((im * -2.0) + (-0.3333333333333333 * pow(im, 3.0)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-9.5d+56)) then
tmp = t_0
else if (im <= 8.6d-8) then
tmp = cos(re) * -im
else if (im <= 8.5d+165) then
tmp = (0.5d0 + ((-0.25d0) * (re * re))) * ((im * (-2.0d0)) + ((-0.3333333333333333d0) * (im ** 3.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -9.5e+56) {
tmp = t_0;
} else if (im <= 8.6e-8) {
tmp = Math.cos(re) * -im;
} else if (im <= 8.5e+165) {
tmp = (0.5 + (-0.25 * (re * re))) * ((im * -2.0) + (-0.3333333333333333 * Math.pow(im, 3.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -9.5e+56: tmp = t_0 elif im <= 8.6e-8: tmp = math.cos(re) * -im elif im <= 8.5e+165: tmp = (0.5 + (-0.25 * (re * re))) * ((im * -2.0) + (-0.3333333333333333 * math.pow(im, 3.0))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -9.5e+56) tmp = t_0; elseif (im <= 8.6e-8) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 8.5e+165) tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * Float64(Float64(im * -2.0) + Float64(-0.3333333333333333 * (im ^ 3.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -9.5e+56) tmp = t_0; elseif (im <= 8.6e-8) tmp = cos(re) * -im; elseif (im <= 8.5e+165) tmp = (0.5 + (-0.25 * (re * re))) * ((im * -2.0) + (-0.3333333333333333 * (im ^ 3.0))); else tmp = t_0; 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, -9.5e+56], t$95$0, If[LessEqual[im, 8.6e-8], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 8.5e+165], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(im * -2.0), $MachinePrecision] + N[(-0.3333333333333333 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -9.5 \cdot 10^{+56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 8.6 \cdot 10^{-8}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 8.5 \cdot 10^{+165}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot \left(im \cdot -2 + -0.3333333333333333 \cdot {im}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -9.4999999999999997e56 or 8.5000000000000001e165 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out72.1%
unpow272.1%
Simplified72.1%
Taylor expanded in im around 0 62.3%
Taylor expanded in re around 0 78.7%
distribute-lft-in78.7%
associate-*r*78.7%
metadata-eval78.7%
neg-mul-178.7%
associate-*r*78.7%
metadata-eval78.7%
*-commutative78.7%
+-commutative78.7%
unsub-neg78.7%
*-commutative78.7%
Simplified78.7%
if -9.4999999999999997e56 < im < 8.6000000000000002e-8Initial program 12.8%
neg-sub012.8%
Simplified12.8%
Taylor expanded in im around 0 93.7%
associate-*r*93.7%
neg-mul-193.7%
Simplified93.7%
if 8.6000000000000002e-8 < im < 8.5000000000000001e165Initial program 98.3%
neg-sub098.3%
Simplified98.3%
Taylor expanded in re around 0 14.8%
+-commutative14.8%
associate-*r*14.8%
distribute-rgt-out86.9%
unpow286.9%
Simplified86.9%
Taylor expanded in im around 0 51.8%
Final simplification81.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -1.2e+57)
t_0
(if (<= im 42000000000.0)
(* (cos re) (- im))
(if (<= im 1e+165)
(* (* -0.3333333333333333 (pow im 3.0)) (+ 0.5 (* -0.25 (* re re))))
t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.2e+57) {
tmp = t_0;
} else if (im <= 42000000000.0) {
tmp = cos(re) * -im;
} else if (im <= 1e+165) {
tmp = (-0.3333333333333333 * pow(im, 3.0)) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-1.2d+57)) then
tmp = t_0
else if (im <= 42000000000.0d0) then
tmp = cos(re) * -im
else if (im <= 1d+165) then
tmp = ((-0.3333333333333333d0) * (im ** 3.0d0)) * (0.5d0 + ((-0.25d0) * (re * re)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -1.2e+57) {
tmp = t_0;
} else if (im <= 42000000000.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 1e+165) {
tmp = (-0.3333333333333333 * Math.pow(im, 3.0)) * (0.5 + (-0.25 * (re * re)));
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -1.2e+57: tmp = t_0 elif im <= 42000000000.0: tmp = math.cos(re) * -im elif im <= 1e+165: tmp = (-0.3333333333333333 * math.pow(im, 3.0)) * (0.5 + (-0.25 * (re * re))) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -1.2e+57) tmp = t_0; elseif (im <= 42000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 1e+165) tmp = Float64(Float64(-0.3333333333333333 * (im ^ 3.0)) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -1.2e+57) tmp = t_0; elseif (im <= 42000000000.0) tmp = cos(re) * -im; elseif (im <= 1e+165) tmp = (-0.3333333333333333 * (im ^ 3.0)) * (0.5 + (-0.25 * (re * re))); else tmp = t_0; 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, -1.2e+57], t$95$0, If[LessEqual[im, 42000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 1e+165], N[(N[(-0.3333333333333333 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -1.2 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 42000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 10^{+165}:\\
\;\;\;\;\left(-0.3333333333333333 \cdot {im}^{3}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -1.20000000000000002e57 or 9.99999999999999899e164 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out72.1%
unpow272.1%
Simplified72.1%
Taylor expanded in im around 0 62.3%
Taylor expanded in re around 0 78.7%
distribute-lft-in78.7%
associate-*r*78.7%
metadata-eval78.7%
neg-mul-178.7%
associate-*r*78.7%
metadata-eval78.7%
*-commutative78.7%
+-commutative78.7%
unsub-neg78.7%
*-commutative78.7%
Simplified78.7%
if -1.20000000000000002e57 < im < 4.2e10Initial program 19.2%
neg-sub019.2%
Simplified19.2%
Taylor expanded in im around 0 88.7%
associate-*r*88.7%
neg-mul-188.7%
Simplified88.7%
if 4.2e10 < im < 9.99999999999999899e164Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out93.8%
unpow293.8%
Simplified93.8%
Taylor expanded in im around 0 58.1%
Taylor expanded in im around inf 58.1%
*-commutative58.1%
Simplified58.1%
Final simplification81.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -7.2e+56)
t_0
(if (<= im 31000000000.0)
(* (cos re) (- im))
(if (<= im 3.25e+103)
(* (pow im 3.0) (* (* re re) 0.08333333333333333))
t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -7.2e+56) {
tmp = t_0;
} else if (im <= 31000000000.0) {
tmp = cos(re) * -im;
} else if (im <= 3.25e+103) {
tmp = pow(im, 3.0) * ((re * re) * 0.08333333333333333);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-7.2d+56)) then
tmp = t_0
else if (im <= 31000000000.0d0) then
tmp = cos(re) * -im
else if (im <= 3.25d+103) then
tmp = (im ** 3.0d0) * ((re * re) * 0.08333333333333333d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -7.2e+56) {
tmp = t_0;
} else if (im <= 31000000000.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 3.25e+103) {
tmp = Math.pow(im, 3.0) * ((re * re) * 0.08333333333333333);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -7.2e+56: tmp = t_0 elif im <= 31000000000.0: tmp = math.cos(re) * -im elif im <= 3.25e+103: tmp = math.pow(im, 3.0) * ((re * re) * 0.08333333333333333) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -7.2e+56) tmp = t_0; elseif (im <= 31000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 3.25e+103) tmp = Float64((im ^ 3.0) * Float64(Float64(re * re) * 0.08333333333333333)); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -7.2e+56) tmp = t_0; elseif (im <= 31000000000.0) tmp = cos(re) * -im; elseif (im <= 3.25e+103) tmp = (im ^ 3.0) * ((re * re) * 0.08333333333333333); else tmp = t_0; 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, -7.2e+56], t$95$0, If[LessEqual[im, 31000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 3.25e+103], N[(N[Power[im, 3.0], $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -7.2 \cdot 10^{+56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 31000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 3.25 \cdot 10^{+103}:\\
\;\;\;\;{im}^{3} \cdot \left(\left(re \cdot re\right) \cdot 0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -7.19999999999999996e56 or 3.25000000000000001e103 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out75.5%
unpow275.5%
Simplified75.5%
Taylor expanded in im around 0 66.9%
Taylor expanded in re around 0 75.2%
distribute-lft-in75.2%
associate-*r*75.2%
metadata-eval75.2%
neg-mul-175.2%
associate-*r*75.2%
metadata-eval75.2%
*-commutative75.2%
+-commutative75.2%
unsub-neg75.2%
*-commutative75.2%
Simplified75.2%
if -7.19999999999999996e56 < im < 3.1e10Initial program 19.2%
neg-sub019.2%
Simplified19.2%
Taylor expanded in im around 0 88.7%
associate-*r*88.7%
neg-mul-188.7%
Simplified88.7%
if 3.1e10 < im < 3.25000000000000001e103Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out90.0%
unpow290.0%
Simplified90.0%
Taylor expanded in im around 0 33.0%
Taylor expanded in im around inf 33.0%
*-commutative33.0%
Simplified33.0%
Taylor expanded in re around inf 31.3%
*-commutative31.3%
associate-*l*31.3%
unpow231.3%
Simplified31.3%
Final simplification79.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -9.5e+56)
t_0
(if (<= im 35000000000.0)
(* (cos re) (- im))
(if (<= im 4.2e+70) (- (* 0.5 (* im (* re re))) im) t_0)))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -9.5e+56) {
tmp = t_0;
} else if (im <= 35000000000.0) {
tmp = cos(re) * -im;
} else if (im <= 4.2e+70) {
tmp = (0.5 * (im * (re * re))) - im;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-9.5d+56)) then
tmp = t_0
else if (im <= 35000000000.0d0) then
tmp = cos(re) * -im
else if (im <= 4.2d+70) then
tmp = (0.5d0 * (im * (re * re))) - im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -9.5e+56) {
tmp = t_0;
} else if (im <= 35000000000.0) {
tmp = Math.cos(re) * -im;
} else if (im <= 4.2e+70) {
tmp = (0.5 * (im * (re * re))) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -9.5e+56: tmp = t_0 elif im <= 35000000000.0: tmp = math.cos(re) * -im elif im <= 4.2e+70: tmp = (0.5 * (im * (re * re))) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -9.5e+56) tmp = t_0; elseif (im <= 35000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif (im <= 4.2e+70) tmp = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -9.5e+56) tmp = t_0; elseif (im <= 35000000000.0) tmp = cos(re) * -im; elseif (im <= 4.2e+70) tmp = (0.5 * (im * (re * re))) - im; else tmp = t_0; 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, -9.5e+56], t$95$0, If[LessEqual[im, 35000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[LessEqual[im, 4.2e+70], N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -9.5 \cdot 10^{+56}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 35000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+70}:\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -9.4999999999999997e56 or 4.20000000000000015e70 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out76.5%
unpow276.5%
Simplified76.5%
Taylor expanded in im around 0 65.5%
Taylor expanded in re around 0 72.4%
distribute-lft-in72.4%
associate-*r*72.4%
metadata-eval72.4%
neg-mul-172.4%
associate-*r*72.4%
metadata-eval72.4%
*-commutative72.4%
+-commutative72.4%
unsub-neg72.4%
*-commutative72.4%
Simplified72.4%
if -9.4999999999999997e56 < im < 3.5e10Initial program 19.2%
neg-sub019.2%
Simplified19.2%
Taylor expanded in im around 0 88.7%
associate-*r*88.7%
neg-mul-188.7%
Simplified88.7%
if 3.5e10 < im < 4.20000000000000015e70Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 3.4%
associate-*r*3.4%
neg-mul-13.4%
Simplified3.4%
Taylor expanded in re around 0 33.3%
neg-mul-133.3%
+-commutative33.3%
unsub-neg33.3%
unpow233.3%
Simplified33.3%
Final simplification78.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* 0.5 (* im (* re re))) im)))
(if (<= im -1.25e+50)
t_0
(if (<= im 100000000000.0)
(* (cos re) (- im))
(if (or (<= im 2.4e+182) (not (<= im 5.5e+272)))
t_0
(* re (* re -6.75)))))))
double code(double re, double im) {
double t_0 = (0.5 * (im * (re * re))) - im;
double tmp;
if (im <= -1.25e+50) {
tmp = t_0;
} else if (im <= 100000000000.0) {
tmp = cos(re) * -im;
} else if ((im <= 2.4e+182) || !(im <= 5.5e+272)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (0.5d0 * (im * (re * re))) - im
if (im <= (-1.25d+50)) then
tmp = t_0
else if (im <= 100000000000.0d0) then
tmp = cos(re) * -im
else if ((im <= 2.4d+182) .or. (.not. (im <= 5.5d+272))) then
tmp = t_0
else
tmp = re * (re * (-6.75d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (0.5 * (im * (re * re))) - im;
double tmp;
if (im <= -1.25e+50) {
tmp = t_0;
} else if (im <= 100000000000.0) {
tmp = Math.cos(re) * -im;
} else if ((im <= 2.4e+182) || !(im <= 5.5e+272)) {
tmp = t_0;
} else {
tmp = re * (re * -6.75);
}
return tmp;
}
def code(re, im): t_0 = (0.5 * (im * (re * re))) - im tmp = 0 if im <= -1.25e+50: tmp = t_0 elif im <= 100000000000.0: tmp = math.cos(re) * -im elif (im <= 2.4e+182) or not (im <= 5.5e+272): tmp = t_0 else: tmp = re * (re * -6.75) return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im) tmp = 0.0 if (im <= -1.25e+50) tmp = t_0; elseif (im <= 100000000000.0) tmp = Float64(cos(re) * Float64(-im)); elseif ((im <= 2.4e+182) || !(im <= 5.5e+272)) tmp = t_0; else tmp = Float64(re * Float64(re * -6.75)); end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * (im * (re * re))) - im; tmp = 0.0; if (im <= -1.25e+50) tmp = t_0; elseif (im <= 100000000000.0) tmp = cos(re) * -im; elseif ((im <= 2.4e+182) || ~((im <= 5.5e+272))) tmp = t_0; else tmp = re * (re * -6.75); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -1.25e+50], t$95$0, If[LessEqual[im, 100000000000.0], N[(N[Cos[re], $MachinePrecision] * (-im)), $MachinePrecision], If[Or[LessEqual[im, 2.4e+182], N[Not[LessEqual[im, 5.5e+272]], $MachinePrecision]], t$95$0, N[(re * N[(re * -6.75), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{if}\;im \leq -1.25 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 100000000000:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 2.4 \cdot 10^{+182} \lor \neg \left(im \leq 5.5 \cdot 10^{+272}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot -6.75\right)\\
\end{array}
\end{array}
if im < -1.25e50 or 1e11 < im < 2.4000000000000001e182 or 5.4999999999999998e272 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 5.3%
associate-*r*5.3%
neg-mul-15.3%
Simplified5.3%
Taylor expanded in re around 0 21.6%
neg-mul-121.6%
+-commutative21.6%
unsub-neg21.6%
unpow221.6%
Simplified21.6%
if -1.25e50 < im < 1e11Initial program 17.4%
neg-sub017.4%
Simplified17.4%
Taylor expanded in im around 0 90.6%
associate-*r*90.6%
neg-mul-190.6%
Simplified90.6%
if 2.4000000000000001e182 < im < 5.4999999999999998e272Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out52.9%
unpow252.9%
Simplified52.9%
Applied egg-rr30.3%
Taylor expanded in re around inf 31.0%
*-commutative31.0%
unpow231.0%
associate-*l*31.0%
Simplified31.0%
Final simplification58.6%
(FPCore (re im) :precision binary64 (- (* 0.5 (* im (* re re))) im))
double code(double re, double im) {
return (0.5 * (im * (re * re))) - im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * (im * (re * re))) - im
end function
public static double code(double re, double im) {
return (0.5 * (im * (re * re))) - im;
}
def code(re, im): return (0.5 * (im * (re * re))) - im
function code(re, im) return Float64(Float64(0.5 * Float64(im * Float64(re * re))) - im) end
function tmp = code(re, im) tmp = (0.5 * (im * (re * re))) - im; end
code[re_, im_] := N[(N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right) - im
\end{array}
Initial program 56.5%
neg-sub056.5%
Simplified56.5%
Taylor expanded in im around 0 50.3%
associate-*r*50.3%
neg-mul-150.3%
Simplified50.3%
Taylor expanded in re around 0 36.0%
neg-mul-136.0%
+-commutative36.0%
unsub-neg36.0%
unpow236.0%
Simplified36.0%
Final simplification36.0%
(FPCore (re im) :precision binary64 (if (<= re 5e+170) (* 0.5 (* im -2.0)) (* re (* re -6.75))))
double code(double re, double im) {
double tmp;
if (re <= 5e+170) {
tmp = 0.5 * (im * -2.0);
} 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 <= 5d+170) then
tmp = 0.5d0 * (im * (-2.0d0))
else
tmp = re * (re * (-6.75d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 5e+170) {
tmp = 0.5 * (im * -2.0);
} else {
tmp = re * (re * -6.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 5e+170: tmp = 0.5 * (im * -2.0) else: tmp = re * (re * -6.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 5e+170) tmp = Float64(0.5 * Float64(im * -2.0)); else tmp = Float64(re * Float64(re * -6.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 5e+170) tmp = 0.5 * (im * -2.0); else tmp = re * (re * -6.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 5e+170], N[(0.5 * N[(im * -2.0), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * -6.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 5 \cdot 10^{+170}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot -6.75\right)\\
\end{array}
\end{array}
if re < 4.99999999999999977e170Initial program 55.4%
neg-sub055.4%
Simplified55.4%
Taylor expanded in re around 0 45.4%
Taylor expanded in im around 0 34.4%
if 4.99999999999999977e170 < re Initial program 64.9%
neg-sub064.9%
Simplified64.9%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out27.6%
unpow227.6%
Simplified27.6%
Applied egg-rr45.4%
Taylor expanded in re around inf 45.4%
*-commutative45.4%
unpow245.4%
associate-*l*45.4%
Simplified45.4%
Final simplification35.6%
(FPCore (re im) :precision binary64 (* 0.5 (* im -2.0)))
double code(double re, double im) {
return 0.5 * (im * -2.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (im * (-2.0d0))
end function
public static double code(double re, double im) {
return 0.5 * (im * -2.0);
}
def code(re, im): return 0.5 * (im * -2.0)
function code(re, im) return Float64(0.5 * Float64(im * -2.0)) end
function tmp = code(re, im) tmp = 0.5 * (im * -2.0); end
code[re_, im_] := N[(0.5 * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(im \cdot -2\right)
\end{array}
Initial program 56.5%
neg-sub056.5%
Simplified56.5%
Taylor expanded in re around 0 44.5%
Taylor expanded in im around 0 31.1%
Final simplification31.1%
(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 56.5%
neg-sub056.5%
Simplified56.5%
Taylor expanded in im around 0 50.3%
associate-*r*50.3%
neg-mul-150.3%
Simplified50.3%
Taylor expanded in re around 0 30.7%
neg-mul-130.7%
Simplified30.7%
Final simplification30.7%
(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 56.5%
neg-sub056.5%
Simplified56.5%
Taylor expanded in re around 0 4.6%
+-commutative4.6%
associate-*r*4.6%
distribute-rgt-out42.5%
unpow242.5%
Simplified42.5%
Applied egg-rr8.4%
Taylor expanded in re around 0 2.9%
Final simplification2.9%
(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 2023293
(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))))