
(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 -1e+15) (not (<= t_0 0.0)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 5.0) -0.008333333333333333))
(- (* (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 <= -1e+15) || !(t_0 <= 0.0)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 5.0) * -0.008333333333333333)) + ((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 <= (-1d+15)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * ((((im ** 7.0d0) * (-0.0001984126984126984d0)) + ((im ** 5.0d0) * (-0.008333333333333333d0))) + (((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 <= -1e+15) || !(t_0 <= 0.0)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * (((Math.pow(im, 7.0) * -0.0001984126984126984) + (Math.pow(im, 5.0) * -0.008333333333333333)) + ((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 <= -1e+15) or not (t_0 <= 0.0): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * (((math.pow(im, 7.0) * -0.0001984126984126984) + (math.pow(im, 5.0) * -0.008333333333333333)) + ((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 <= -1e+15) || !(t_0 <= 0.0)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64((im ^ 7.0) * -0.0001984126984126984) + Float64((im ^ 5.0) * -0.008333333333333333)) + 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 <= -1e+15) || ~((t_0 <= 0.0))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 5.0) * -0.008333333333333333)) + (((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, -1e+15], N[Not[LessEqual[t$95$0, 0.0]], $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, 7.0], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $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 \cdot 10^{+15} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left({im}^{7} \cdot -0.0001984126984126984 + {im}^{5} \cdot -0.008333333333333333\right) + \left({im}^{3} \cdot -0.16666666666666666 - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1e15 or 0.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1e15 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.0Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
associate-*r*99.8%
associate-*r*99.8%
neg-mul-199.8%
distribute-rgt-out99.8%
+-commutative99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
distribute-lft-out99.8%
+-commutative99.8%
Simplified99.8%
fma-udef99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -1e+15) (not (<= t_0 0.0)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(- (* (* im im) (* im -0.16666666666666666)) im)
(* (pow im 5.0) -0.008333333333333333))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -1e+15) || !(t_0 <= 0.0)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + (pow(im, 5.0) * -0.008333333333333333));
}
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 <= (-1d+15)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * ((((im * im) * (im * (-0.16666666666666666d0))) - im) + ((im ** 5.0d0) * (-0.008333333333333333d0)))
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 <= -1e+15) || !(t_0 <= 0.0)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + (Math.pow(im, 5.0) * -0.008333333333333333));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -1e+15) or not (t_0 <= 0.0): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + (math.pow(im, 5.0) * -0.008333333333333333)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -1e+15) || !(t_0 <= 0.0)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64(Float64(im * im) * Float64(im * -0.16666666666666666)) - im) + Float64((im ^ 5.0) * -0.008333333333333333))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -1e+15) || ~((t_0 <= 0.0))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + ((im ^ 5.0) * -0.008333333333333333)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -1e+15], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(im * im), $MachinePrecision] * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+15} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot -0.16666666666666666\right) - im\right) + {im}^{5} \cdot -0.008333333333333333\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -1e15 or 0.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
if -1e15 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 0.0Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
associate-*r*99.8%
associate-*r*99.8%
neg-mul-199.8%
distribute-rgt-out99.8%
+-commutative99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
distribute-lft-out99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
associate-*r*99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.8%
+-commutative99.8%
sub-neg99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
distribute-lft-out99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
+-rgt-identity99.8%
*-commutative99.8%
unpow399.8%
associate-*l*99.8%
fma-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
fma-udef99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (+ 0.5 (* -0.25 (* re re)))))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -1.1e+44)
t_1
(if (<= im -0.122)
t_0
(if (<= im 0.33)
(*
(cos re)
(+
(- (* (* im im) (* im -0.16666666666666666)) im)
(* (pow im 5.0) -0.008333333333333333)))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 + (-0.25 * (re * re)));
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -0.122) {
tmp = t_0;
} else if (im <= 0.33) {
tmp = cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + (pow(im, 5.0) * -0.008333333333333333));
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (exp(-im) - exp(im)) * (0.5d0 + ((-0.25d0) * (re * re)))
t_1 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-1.1d+44)) then
tmp = t_1
else if (im <= (-0.122d0)) then
tmp = t_0
else if (im <= 0.33d0) then
tmp = cos(re) * ((((im * im) * (im * (-0.16666666666666666d0))) - im) + ((im ** 5.0d0) * (-0.008333333333333333d0)))
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.exp(-im) - Math.exp(im)) * (0.5 + (-0.25 * (re * re)));
double t_1 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -0.122) {
tmp = t_0;
} else if (im <= 0.33) {
tmp = Math.cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + (Math.pow(im, 5.0) * -0.008333333333333333));
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 + (-0.25 * (re * re))) t_1 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.1e+44: tmp = t_1 elif im <= -0.122: tmp = t_0 elif im <= 0.33: tmp = math.cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + (math.pow(im, 5.0) * -0.008333333333333333)) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))) t_1 = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.1e+44) tmp = t_1; elseif (im <= -0.122) tmp = t_0; elseif (im <= 0.33) tmp = Float64(cos(re) * Float64(Float64(Float64(Float64(im * im) * Float64(im * -0.16666666666666666)) - im) + Float64((im ^ 5.0) * -0.008333333333333333))); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) - exp(im)) * (0.5 + (-0.25 * (re * re))); t_1 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.1e+44) tmp = t_1; elseif (im <= -0.122) tmp = t_0; elseif (im <= 0.33) tmp = cos(re) * ((((im * im) * (im * -0.16666666666666666)) - im) + ((im ^ 5.0) * -0.008333333333333333)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.1e+44], t$95$1, If[LessEqual[im, -0.122], t$95$0, If[LessEqual[im, 0.33], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(N[(im * im), $MachinePrecision] * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision] + N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.122:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.33:\\
\;\;\;\;\cos re \cdot \left(\left(\left(im \cdot im\right) \cdot \left(im \cdot -0.16666666666666666\right) - im\right) + {im}^{5} \cdot -0.008333333333333333\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.09999999999999998e44 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
neg-mul-1100.0%
distribute-rgt-out100.0%
+-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.09999999999999998e44 < im < -0.122 or 0.330000000000000016 < im < 1.09999999999999998e44Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 5.0%
+-commutative5.0%
associate-*r*5.0%
distribute-rgt-out85.0%
unpow285.0%
Simplified85.0%
if -0.122 < im < 0.330000000000000016Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
+-commutative99.8%
associate-*r*99.8%
associate-*r*99.8%
neg-mul-199.8%
distribute-rgt-out99.8%
+-commutative99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
distribute-lft-out99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in im around 0 99.8%
associate-+r+99.8%
associate-*r*99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-out99.8%
+-commutative99.8%
sub-neg99.8%
associate-*r*99.8%
*-commutative99.8%
*-commutative99.8%
distribute-lft-out99.8%
*-commutative99.8%
*-commutative99.8%
Simplified99.8%
+-rgt-identity99.8%
*-commutative99.8%
unpow399.8%
associate-*l*99.8%
fma-def99.8%
*-commutative99.8%
Applied egg-rr99.8%
fma-udef99.8%
+-rgt-identity99.8%
Simplified99.8%
Final simplification98.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (- (exp (- im)) (exp im)) (+ 0.5 (* -0.25 (* re re)))))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -1.1e+44)
t_1
(if (<= im -0.025)
t_0
(if (<= im 0.065)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = (exp(-im) - exp(im)) * (0.5 + (-0.25 * (re * re)));
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -0.025) {
tmp = t_0;
} else if (im <= 0.065) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (exp(-im) - exp(im)) * (0.5d0 + ((-0.25d0) * (re * re)))
t_1 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-1.1d+44)) then
tmp = t_1
else if (im <= (-0.025d0)) then
tmp = t_0
else if (im <= 0.065d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.exp(-im) - Math.exp(im)) * (0.5 + (-0.25 * (re * re)));
double t_1 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -1.1e+44) {
tmp = t_1;
} else if (im <= -0.025) {
tmp = t_0;
} else if (im <= 0.065) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (math.exp(-im) - math.exp(im)) * (0.5 + (-0.25 * (re * re))) t_1 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -1.1e+44: tmp = t_1 elif im <= -0.025: tmp = t_0 elif im <= 0.065: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(0.5 + Float64(-0.25 * Float64(re * re)))) t_1 = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -1.1e+44) tmp = t_1; elseif (im <= -0.025) tmp = t_0; elseif (im <= 0.065) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (exp(-im) - exp(im)) * (0.5 + (-0.25 * (re * re))); t_1 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -1.1e+44) tmp = t_1; elseif (im <= -0.025) tmp = t_0; elseif (im <= 0.065) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.1e+44], t$95$1, If[LessEqual[im, -0.025], t$95$0, If[LessEqual[im, 0.065], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -1.1 \cdot 10^{+44}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.025:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.065:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -1.09999999999999998e44 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
neg-mul-1100.0%
distribute-rgt-out100.0%
+-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
distribute-lft-out100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
if -1.09999999999999998e44 < im < -0.025000000000000001 or 0.065000000000000002 < im < 1.09999999999999998e44Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 5.0%
+-commutative5.0%
associate-*r*5.0%
distribute-rgt-out85.0%
unpow285.0%
Simplified85.0%
if -0.025000000000000001 < im < 0.065000000000000002Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
associate-*r*99.6%
distribute-rgt-out--99.6%
*-commutative99.6%
Simplified99.6%
Final simplification98.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -3.8e+43)
t_1
(if (<= im -0.0008)
t_0
(if (<= im 0.011) (* im (- (cos re))) (if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -3.8e+43) {
tmp = t_1;
} else if (im <= -0.0008) {
tmp = t_0;
} else if (im <= 0.011) {
tmp = im * -cos(re);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-3.8d+43)) then
tmp = t_1
else if (im <= (-0.0008d0)) then
tmp = t_0
else if (im <= 0.011d0) then
tmp = im * -cos(re)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -3.8e+43) {
tmp = t_1;
} else if (im <= -0.0008) {
tmp = t_0;
} else if (im <= 0.011) {
tmp = im * -Math.cos(re);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -3.8e+43: tmp = t_1 elif im <= -0.0008: tmp = t_0 elif im <= 0.011: tmp = im * -math.cos(re) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -3.8e+43) tmp = t_1; elseif (im <= -0.0008) tmp = t_0; elseif (im <= 0.011) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -3.8e+43) tmp = t_1; elseif (im <= -0.0008) tmp = t_0; elseif (im <= 0.011) tmp = im * -cos(re); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+43], t$95$1, If[LessEqual[im, -0.0008], t$95$0, If[LessEqual[im, 0.011], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0008:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.011:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -3.80000000000000008e43 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 99.2%
associate-+r+99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
neg-mul-199.2%
distribute-rgt-out99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
distribute-lft-out99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in im around inf 99.2%
if -3.80000000000000008e43 < im < -8.00000000000000038e-4 or 0.010999999999999999 < im < 1.09999999999999998e44Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 78.9%
if -8.00000000000000038e-4 < im < 0.010999999999999999Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.4%
associate-*r*99.4%
neg-mul-199.4%
Simplified99.4%
Final simplification97.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* -0.0001984126984126984 (* (cos re) (pow im 7.0)))))
(if (<= im -3.8e+43)
t_1
(if (<= im -0.125)
t_0
(if (<= im 0.082)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
double tmp;
if (im <= -3.8e+43) {
tmp = t_1;
} else if (im <= -0.125) {
tmp = t_0;
} else if (im <= 0.082) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
if (im <= (-3.8d+43)) then
tmp = t_1
else if (im <= (-0.125d0)) then
tmp = t_0
else if (im <= 0.082d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
double tmp;
if (im <= -3.8e+43) {
tmp = t_1;
} else if (im <= -0.125) {
tmp = t_0;
} else if (im <= 0.082) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) tmp = 0 if im <= -3.8e+43: tmp = t_1 elif im <= -0.125: tmp = t_0 elif im <= 0.082: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))) tmp = 0.0 if (im <= -3.8e+43) tmp = t_1; elseif (im <= -0.125) tmp = t_0; elseif (im <= 0.082) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); tmp = 0.0; if (im <= -3.8e+43) tmp = t_1; elseif (im <= -0.125) tmp = t_0; elseif (im <= 0.082) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8e+43], t$95$1, If[LessEqual[im, -0.125], t$95$0, If[LessEqual[im, 0.082], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{if}\;im \leq -3.8 \cdot 10^{+43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.125:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.082:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -3.80000000000000008e43 or 1.09999999999999998e44 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 99.2%
associate-+r+99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
neg-mul-199.2%
distribute-rgt-out99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
distribute-lft-out99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in im around inf 99.2%
if -3.80000000000000008e43 < im < -0.125 or 0.0820000000000000034 < im < 1.09999999999999998e44Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 78.9%
if -0.125 < im < 0.0820000000000000034Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
associate-*r*99.6%
distribute-rgt-out--99.6%
*-commutative99.6%
Simplified99.6%
Final simplification97.9%
(FPCore (re im) :precision binary64 (if (or (<= im -4.1) (not (<= im 4.2))) (* -0.0001984126984126984 (* (cos re) (pow im 7.0))) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -4.1) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (cos(re) * pow(im, 7.0));
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-4.1d0)) .or. (.not. (im <= 4.2d0))) then
tmp = (-0.0001984126984126984d0) * (cos(re) * (im ** 7.0d0))
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -4.1) || !(im <= 4.2)) {
tmp = -0.0001984126984126984 * (Math.cos(re) * Math.pow(im, 7.0));
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -4.1) or not (im <= 4.2): tmp = -0.0001984126984126984 * (math.cos(re) * math.pow(im, 7.0)) else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -4.1) || !(im <= 4.2)) tmp = Float64(-0.0001984126984126984 * Float64(cos(re) * (im ^ 7.0))); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -4.1) || ~((im <= 4.2))) tmp = -0.0001984126984126984 * (cos(re) * (im ^ 7.0)); else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -4.1], N[Not[LessEqual[im, 4.2]], $MachinePrecision]], N[(-0.0001984126984126984 * N[(N[Cos[re], $MachinePrecision] * N[Power[im, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -4.1 \lor \neg \left(im \leq 4.2\right):\\
\;\;\;\;-0.0001984126984126984 \cdot \left(\cos re \cdot {im}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -4.0999999999999996 or 4.20000000000000018 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 85.3%
associate-+r+85.3%
+-commutative85.3%
associate-*r*85.3%
associate-*r*85.3%
neg-mul-185.3%
distribute-rgt-out85.3%
+-commutative85.3%
associate-*r*85.3%
associate-*r*85.3%
distribute-rgt-out85.3%
distribute-lft-out85.3%
+-commutative85.3%
Simplified85.3%
Taylor expanded in im around inf 85.3%
if -4.0999999999999996 < im < 4.20000000000000018Initial program 7.6%
neg-sub07.6%
Simplified7.6%
Taylor expanded in im around 0 99.4%
associate-*r*99.4%
neg-mul-199.4%
Simplified99.4%
Final simplification92.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (cos re)))
(t_1 (* (* im im) (/ t_0 im)))
(t_2
(cast
(!
:precision
binary32
(cast (! :precision binary64 (- (* im (* 0.5 (* re re))) im)))))))
(if (<= im -2.45e+179)
t_1
(if (<= im -780.0)
t_2
(if (<= im 35.0) (* im t_0) (if (<= im 1.35e+154) t_2 t_1))))))
double code(double re, double im) {
double t_0 = -cos(re);
double t_1 = (im * im) * (t_0 / im);
double tmp_2 = (im * (0.5 * (re * re))) - im;
double tmp_1 = (float) tmp_2;
double t_2 = (double) tmp_1;
double tmp_3;
if (im <= -2.45e+179) {
tmp_3 = t_1;
} else if (im <= -780.0) {
tmp_3 = t_2;
} else if (im <= 35.0) {
tmp_3 = im * t_0;
} else if (im <= 1.35e+154) {
tmp_3 = t_2;
} else {
tmp_3 = t_1;
}
return tmp_3;
}
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
real(8) :: tmp_1
real(8) :: tmp_2
real(8) :: tmp_3
t_0 = -cos(re)
t_1 = (im * im) * (t_0 / im)
tmp_2 = (im * (0.5d0 * (re * re))) - im
tmp_1 = real(tmp_2, 4)
t_2 = real(tmp_1, 8)
if (im <= (-2.45d+179)) then
tmp_3 = t_1
else if (im <= (-780.0d0)) then
tmp_3 = t_2
else if (im <= 35.0d0) then
tmp_3 = im * t_0
else if (im <= 1.35d+154) then
tmp_3 = t_2
else
tmp_3 = t_1
end if
code = tmp_3
end function
function code(re, im) t_0 = Float64(-cos(re)) t_1 = Float64(Float64(im * im) * Float64(t_0 / im)) tmp_2 = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im) tmp_1 = Float32(tmp_2) t_2 = Float64(tmp_1) tmp_3 = 0.0 if (im <= -2.45e+179) tmp_3 = t_1; elseif (im <= -780.0) tmp_3 = t_2; elseif (im <= 35.0) tmp_3 = Float64(im * t_0); elseif (im <= 1.35e+154) tmp_3 = t_2; else tmp_3 = t_1; end return tmp_3 end
function tmp_5 = code(re, im) t_0 = -cos(re); t_1 = (im * im) * (t_0 / im); tmp_3 = (im * (0.5 * (re * re))) - im; tmp_2 = single(tmp_3); t_2 = double(tmp_2); tmp_4 = 0.0; if (im <= -2.45e+179) tmp_4 = t_1; elseif (im <= -780.0) tmp_4 = t_2; elseif (im <= 35.0) tmp_4 = im * t_0; elseif (im <= 1.35e+154) tmp_4 = t_2; else tmp_4 = t_1; end tmp_5 = tmp_4; end
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\cos re\\
t_1 := \left(im \cdot im\right) \cdot \frac{t_0}{im}\\
t_2 := \langle \left( \langle \left( im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im \right)_{\text{binary64}} \rangle_{\text{binary32}} \right)_{\text{binary32}} \rangle_{\text{binary64}}\\
\mathbf{if}\;im \leq -2.45 \cdot 10^{+179}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -780:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 35:\\
\;\;\;\;im \cdot t_0\\
\mathbf{elif}\;im \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.4499999999999999e179 or 1.35000000000000003e154 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 7.3%
associate-*r*7.3%
neg-mul-17.3%
Simplified7.3%
*-commutative7.3%
neg-sub07.3%
flip--100.0%
metadata-eval100.0%
neg-sub0100.0%
+-lft-identity100.0%
associate-*r/100.0%
neg-mul-1100.0%
associate-*l*100.0%
neg-mul-1100.0%
*-commutative100.0%
Applied egg-rr100.0%
associate-/l*100.0%
associate-/r/100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
if -2.4499999999999999e179 < im < -780 or 35 < im < 1.35000000000000003e154Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 4.0%
associate-*r*4.0%
neg-mul-14.0%
Simplified4.0%
Taylor expanded in re around 0 19.4%
neg-mul-119.4%
+-commutative19.4%
unsub-neg19.4%
*-commutative19.4%
unpow219.4%
associate-*l*19.4%
Simplified19.4%
rewrite-binary64/binary32-simplify64.0%
Applied rewrite-once64.0%
if -780 < im < 35Initial program 8.3%
neg-sub08.3%
Simplified8.3%
Taylor expanded in im around 0 98.6%
associate-*r*98.6%
neg-mul-198.6%
Simplified98.6%
Final simplification90.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ (* im -2.0) (* (pow im 3.0) -0.3333333333333333)))
(t_1 (- (cos re))))
(if (<= im -2.45e+179)
(* (* im im) (/ t_1 im))
(if (<= im -6e+36)
(* (+ 0.5 (* -0.25 (* re re))) t_0)
(if (<= im 6.5e+67) (* im t_1) (* 0.5 t_0))))))
double code(double re, double im) {
double t_0 = (im * -2.0) + (pow(im, 3.0) * -0.3333333333333333);
double t_1 = -cos(re);
double tmp;
if (im <= -2.45e+179) {
tmp = (im * im) * (t_1 / im);
} else if (im <= -6e+36) {
tmp = (0.5 + (-0.25 * (re * re))) * t_0;
} else if (im <= 6.5e+67) {
tmp = im * t_1;
} else {
tmp = 0.5 * 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) :: tmp
t_0 = (im * (-2.0d0)) + ((im ** 3.0d0) * (-0.3333333333333333d0))
t_1 = -cos(re)
if (im <= (-2.45d+179)) then
tmp = (im * im) * (t_1 / im)
else if (im <= (-6d+36)) then
tmp = (0.5d0 + ((-0.25d0) * (re * re))) * t_0
else if (im <= 6.5d+67) then
tmp = im * t_1
else
tmp = 0.5d0 * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * -2.0) + (Math.pow(im, 3.0) * -0.3333333333333333);
double t_1 = -Math.cos(re);
double tmp;
if (im <= -2.45e+179) {
tmp = (im * im) * (t_1 / im);
} else if (im <= -6e+36) {
tmp = (0.5 + (-0.25 * (re * re))) * t_0;
} else if (im <= 6.5e+67) {
tmp = im * t_1;
} else {
tmp = 0.5 * t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * -2.0) + (math.pow(im, 3.0) * -0.3333333333333333) t_1 = -math.cos(re) tmp = 0 if im <= -2.45e+179: tmp = (im * im) * (t_1 / im) elif im <= -6e+36: tmp = (0.5 + (-0.25 * (re * re))) * t_0 elif im <= 6.5e+67: tmp = im * t_1 else: tmp = 0.5 * t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * -2.0) + Float64((im ^ 3.0) * -0.3333333333333333)) t_1 = Float64(-cos(re)) tmp = 0.0 if (im <= -2.45e+179) tmp = Float64(Float64(im * im) * Float64(t_1 / im)); elseif (im <= -6e+36) tmp = Float64(Float64(0.5 + Float64(-0.25 * Float64(re * re))) * t_0); elseif (im <= 6.5e+67) tmp = Float64(im * t_1); else tmp = Float64(0.5 * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = (im * -2.0) + ((im ^ 3.0) * -0.3333333333333333); t_1 = -cos(re); tmp = 0.0; if (im <= -2.45e+179) tmp = (im * im) * (t_1 / im); elseif (im <= -6e+36) tmp = (0.5 + (-0.25 * (re * re))) * t_0; elseif (im <= 6.5e+67) tmp = im * t_1; else tmp = 0.5 * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Cos[re], $MachinePrecision])}, If[LessEqual[im, -2.45e+179], N[(N[(im * im), $MachinePrecision] * N[(t$95$1 / im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -6e+36], N[(N[(0.5 + N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[im, 6.5e+67], N[(im * t$95$1), $MachinePrecision], N[(0.5 * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\\
t_1 := -\cos re\\
\mathbf{if}\;im \leq -2.45 \cdot 10^{+179}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \frac{t_1}{im}\\
\mathbf{elif}\;im \leq -6 \cdot 10^{+36}:\\
\;\;\;\;\left(0.5 + -0.25 \cdot \left(re \cdot re\right)\right) \cdot t_0\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{+67}:\\
\;\;\;\;im \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot t_0\\
\end{array}
\end{array}
if im < -2.4499999999999999e179Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 7.0%
associate-*r*7.0%
neg-mul-17.0%
Simplified7.0%
*-commutative7.0%
neg-sub07.0%
flip--100.0%
metadata-eval100.0%
neg-sub0100.0%
+-lft-identity100.0%
associate-*r/100.0%
neg-mul-1100.0%
associate-*l*100.0%
neg-mul-1100.0%
*-commutative100.0%
Applied egg-rr100.0%
associate-/l*100.0%
associate-/r/100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
if -2.4499999999999999e179 < im < -6e36Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out80.0%
unpow280.0%
Simplified80.0%
Taylor expanded in im around 0 68.7%
if -6e36 < im < 6.4999999999999995e67Initial program 20.6%
neg-sub020.6%
Simplified20.6%
Taylor expanded in im around 0 85.9%
associate-*r*85.9%
neg-mul-185.9%
Simplified85.9%
if 6.4999999999999995e67 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 92.3%
Taylor expanded in im around 0 83.3%
Final simplification85.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (cos re))))
(if (<= im -3.9e+141)
(* (* im im) (/ t_0 im))
(if (or (<= im -6.4e+44) (not (<= im 2.3e+67)))
(* 0.5 (+ (* im -2.0) (* (pow im 3.0) -0.3333333333333333)))
(* im t_0)))))
double code(double re, double im) {
double t_0 = -cos(re);
double tmp;
if (im <= -3.9e+141) {
tmp = (im * im) * (t_0 / im);
} else if ((im <= -6.4e+44) || !(im <= 2.3e+67)) {
tmp = 0.5 * ((im * -2.0) + (pow(im, 3.0) * -0.3333333333333333));
} else {
tmp = im * 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 = -cos(re)
if (im <= (-3.9d+141)) then
tmp = (im * im) * (t_0 / im)
else if ((im <= (-6.4d+44)) .or. (.not. (im <= 2.3d+67))) then
tmp = 0.5d0 * ((im * (-2.0d0)) + ((im ** 3.0d0) * (-0.3333333333333333d0)))
else
tmp = im * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -Math.cos(re);
double tmp;
if (im <= -3.9e+141) {
tmp = (im * im) * (t_0 / im);
} else if ((im <= -6.4e+44) || !(im <= 2.3e+67)) {
tmp = 0.5 * ((im * -2.0) + (Math.pow(im, 3.0) * -0.3333333333333333));
} else {
tmp = im * t_0;
}
return tmp;
}
def code(re, im): t_0 = -math.cos(re) tmp = 0 if im <= -3.9e+141: tmp = (im * im) * (t_0 / im) elif (im <= -6.4e+44) or not (im <= 2.3e+67): tmp = 0.5 * ((im * -2.0) + (math.pow(im, 3.0) * -0.3333333333333333)) else: tmp = im * t_0 return tmp
function code(re, im) t_0 = Float64(-cos(re)) tmp = 0.0 if (im <= -3.9e+141) tmp = Float64(Float64(im * im) * Float64(t_0 / im)); elseif ((im <= -6.4e+44) || !(im <= 2.3e+67)) tmp = Float64(0.5 * Float64(Float64(im * -2.0) + Float64((im ^ 3.0) * -0.3333333333333333))); else tmp = Float64(im * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = -cos(re); tmp = 0.0; if (im <= -3.9e+141) tmp = (im * im) * (t_0 / im); elseif ((im <= -6.4e+44) || ~((im <= 2.3e+67))) tmp = 0.5 * ((im * -2.0) + ((im ^ 3.0) * -0.3333333333333333)); else tmp = im * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = (-N[Cos[re], $MachinePrecision])}, If[LessEqual[im, -3.9e+141], N[(N[(im * im), $MachinePrecision] * N[(t$95$0 / im), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -6.4e+44], N[Not[LessEqual[im, 2.3e+67]], $MachinePrecision]], N[(0.5 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[Power[im, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\cos re\\
\mathbf{if}\;im \leq -3.9 \cdot 10^{+141}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \frac{t_0}{im}\\
\mathbf{elif}\;im \leq -6.4 \cdot 10^{+44} \lor \neg \left(im \leq 2.3 \cdot 10^{+67}\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot -2 + {im}^{3} \cdot -0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot t_0\\
\end{array}
\end{array}
if im < -3.89999999999999991e141Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 6.6%
associate-*r*6.6%
neg-mul-16.6%
Simplified6.6%
*-commutative6.6%
neg-sub06.6%
flip--97.4%
metadata-eval97.4%
neg-sub097.4%
+-lft-identity97.4%
associate-*r/97.4%
neg-mul-197.4%
associate-*l*97.4%
neg-mul-197.4%
*-commutative97.4%
Applied egg-rr97.4%
associate-/l*97.4%
associate-/r/97.4%
distribute-rgt-neg-out97.4%
Simplified97.4%
if -3.89999999999999991e141 < im < -6.40000000000000009e44 or 2.2999999999999999e67 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in re around 0 89.9%
Taylor expanded in im around 0 74.9%
if -6.40000000000000009e44 < im < 2.2999999999999999e67Initial program 21.1%
neg-sub021.1%
Simplified21.1%
Taylor expanded in im around 0 85.3%
associate-*r*85.3%
neg-mul-185.3%
Simplified85.3%
Final simplification84.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (cos re))))
(if (or (<= im -2e+141) (not (<= im 1.1e-6)))
(* (* im im) (/ t_0 im))
(* im t_0))))
double code(double re, double im) {
double t_0 = -cos(re);
double tmp;
if ((im <= -2e+141) || !(im <= 1.1e-6)) {
tmp = (im * im) * (t_0 / im);
} else {
tmp = im * 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 = -cos(re)
if ((im <= (-2d+141)) .or. (.not. (im <= 1.1d-6))) then
tmp = (im * im) * (t_0 / im)
else
tmp = im * t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -Math.cos(re);
double tmp;
if ((im <= -2e+141) || !(im <= 1.1e-6)) {
tmp = (im * im) * (t_0 / im);
} else {
tmp = im * t_0;
}
return tmp;
}
def code(re, im): t_0 = -math.cos(re) tmp = 0 if (im <= -2e+141) or not (im <= 1.1e-6): tmp = (im * im) * (t_0 / im) else: tmp = im * t_0 return tmp
function code(re, im) t_0 = Float64(-cos(re)) tmp = 0.0 if ((im <= -2e+141) || !(im <= 1.1e-6)) tmp = Float64(Float64(im * im) * Float64(t_0 / im)); else tmp = Float64(im * t_0); end return tmp end
function tmp_2 = code(re, im) t_0 = -cos(re); tmp = 0.0; if ((im <= -2e+141) || ~((im <= 1.1e-6))) tmp = (im * im) * (t_0 / im); else tmp = im * t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = (-N[Cos[re], $MachinePrecision])}, If[Or[LessEqual[im, -2e+141], N[Not[LessEqual[im, 1.1e-6]], $MachinePrecision]], N[(N[(im * im), $MachinePrecision] * N[(t$95$0 / im), $MachinePrecision]), $MachinePrecision], N[(im * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\cos re\\
\mathbf{if}\;im \leq -2 \cdot 10^{+141} \lor \neg \left(im \leq 1.1 \cdot 10^{-6}\right):\\
\;\;\;\;\left(im \cdot im\right) \cdot \frac{t_0}{im}\\
\mathbf{else}:\\
\;\;\;\;im \cdot t_0\\
\end{array}
\end{array}
if im < -2.00000000000000003e141 or 1.1000000000000001e-6 < im Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in im around 0 6.7%
associate-*r*6.7%
neg-mul-16.7%
Simplified6.7%
*-commutative6.7%
neg-sub06.7%
flip--75.2%
metadata-eval75.2%
neg-sub075.2%
+-lft-identity75.2%
associate-*r/75.2%
neg-mul-175.2%
associate-*l*75.2%
neg-mul-175.2%
*-commutative75.2%
Applied egg-rr75.2%
associate-/l*75.2%
associate-/r/75.2%
distribute-rgt-neg-out75.2%
Simplified75.2%
if -2.00000000000000003e141 < im < 1.1000000000000001e-6Initial program 24.7%
neg-sub024.7%
Simplified24.7%
Taylor expanded in im around 0 81.4%
associate-*r*81.4%
neg-mul-181.4%
Simplified81.4%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (cos re))))
(if (<= im -2e+141)
(* (* im im) (/ t_0 im))
(if (<= im 3e-10) (* im t_0) (/ (cos re) (/ im (* im (- im))))))))
double code(double re, double im) {
double t_0 = -cos(re);
double tmp;
if (im <= -2e+141) {
tmp = (im * im) * (t_0 / im);
} else if (im <= 3e-10) {
tmp = im * t_0;
} else {
tmp = cos(re) / (im / (im * -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 = -cos(re)
if (im <= (-2d+141)) then
tmp = (im * im) * (t_0 / im)
else if (im <= 3d-10) then
tmp = im * t_0
else
tmp = cos(re) / (im / (im * -im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = -Math.cos(re);
double tmp;
if (im <= -2e+141) {
tmp = (im * im) * (t_0 / im);
} else if (im <= 3e-10) {
tmp = im * t_0;
} else {
tmp = Math.cos(re) / (im / (im * -im));
}
return tmp;
}
def code(re, im): t_0 = -math.cos(re) tmp = 0 if im <= -2e+141: tmp = (im * im) * (t_0 / im) elif im <= 3e-10: tmp = im * t_0 else: tmp = math.cos(re) / (im / (im * -im)) return tmp
function code(re, im) t_0 = Float64(-cos(re)) tmp = 0.0 if (im <= -2e+141) tmp = Float64(Float64(im * im) * Float64(t_0 / im)); elseif (im <= 3e-10) tmp = Float64(im * t_0); else tmp = Float64(cos(re) / Float64(im / Float64(im * Float64(-im)))); end return tmp end
function tmp_2 = code(re, im) t_0 = -cos(re); tmp = 0.0; if (im <= -2e+141) tmp = (im * im) * (t_0 / im); elseif (im <= 3e-10) tmp = im * t_0; else tmp = cos(re) / (im / (im * -im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = (-N[Cos[re], $MachinePrecision])}, If[LessEqual[im, -2e+141], N[(N[(im * im), $MachinePrecision] * N[(t$95$0 / im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3e-10], N[(im * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] / N[(im / N[(im * (-im)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -\cos re\\
\mathbf{if}\;im \leq -2 \cdot 10^{+141}:\\
\;\;\;\;\left(im \cdot im\right) \cdot \frac{t_0}{im}\\
\mathbf{elif}\;im \leq 3 \cdot 10^{-10}:\\
\;\;\;\;im \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos re}{\frac{im}{im \cdot \left(-im\right)}}\\
\end{array}
\end{array}
if im < -2.00000000000000003e141Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 6.6%
associate-*r*6.6%
neg-mul-16.6%
Simplified6.6%
*-commutative6.6%
neg-sub06.6%
flip--97.4%
metadata-eval97.4%
neg-sub097.4%
+-lft-identity97.4%
associate-*r/97.4%
neg-mul-197.4%
associate-*l*97.4%
neg-mul-197.4%
*-commutative97.4%
Applied egg-rr97.4%
associate-/l*97.4%
associate-/r/97.4%
distribute-rgt-neg-out97.4%
Simplified97.4%
if -2.00000000000000003e141 < im < 3e-10Initial program 24.2%
neg-sub024.2%
Simplified24.2%
Taylor expanded in im around 0 81.2%
associate-*r*81.2%
neg-mul-181.2%
Simplified81.2%
if 3e-10 < im Initial program 98.8%
neg-sub098.8%
Simplified98.8%
Taylor expanded in im around 0 9.7%
associate-*r*9.7%
neg-mul-19.7%
Simplified9.7%
*-commutative9.7%
neg-sub09.7%
flip--63.2%
metadata-eval63.2%
neg-sub063.2%
+-lft-identity63.2%
associate-*r/63.2%
neg-mul-163.2%
associate-*l*63.2%
neg-mul-163.2%
*-commutative63.2%
Applied egg-rr63.2%
associate-/l*63.2%
Simplified63.2%
Final simplification79.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (/ -1.0 im))))
(if (<= im -2.45e+179)
t_0
(if (<= im -5.5e+35)
(* im (+ (* re (* 0.5 re)) -1.0))
(if (<= im 2.1e+132) (* im (- (cos re))) t_0)))))
double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -5.5e+35) {
tmp = im * ((re * (0.5 * re)) + -1.0);
} else if (im <= 2.1e+132) {
tmp = im * -cos(re);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im * im) * ((-1.0d0) / im)
if (im <= (-2.45d+179)) then
tmp = t_0
else if (im <= (-5.5d+35)) then
tmp = im * ((re * (0.5d0 * re)) + (-1.0d0))
else if (im <= 2.1d+132) then
tmp = im * -cos(re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -5.5e+35) {
tmp = im * ((re * (0.5 * re)) + -1.0);
} else if (im <= 2.1e+132) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (-1.0 / im) tmp = 0 if im <= -2.45e+179: tmp = t_0 elif im <= -5.5e+35: tmp = im * ((re * (0.5 * re)) + -1.0) elif im <= 2.1e+132: tmp = im * -math.cos(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(-1.0 / im)) tmp = 0.0 if (im <= -2.45e+179) tmp = t_0; elseif (im <= -5.5e+35) tmp = Float64(im * Float64(Float64(re * Float64(0.5 * re)) + -1.0)); elseif (im <= 2.1e+132) tmp = Float64(im * Float64(-cos(re))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (-1.0 / im); tmp = 0.0; if (im <= -2.45e+179) tmp = t_0; elseif (im <= -5.5e+35) tmp = im * ((re * (0.5 * re)) + -1.0); elseif (im <= 2.1e+132) tmp = im * -cos(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(-1.0 / im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.45e+179], t$95$0, If[LessEqual[im, -5.5e+35], N[(im * N[(N[(re * N[(0.5 * re), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.1e+132], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \frac{-1}{im}\\
\mathbf{if}\;im \leq -2.45 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -5.5 \cdot 10^{+35}:\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot re\right) + -1\right)\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+132}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.4499999999999999e179 or 2.09999999999999993e132 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 7.2%
associate-*r*7.2%
neg-mul-17.2%
Simplified7.2%
*-commutative7.2%
neg-sub07.2%
flip--94.6%
metadata-eval94.6%
neg-sub094.6%
+-lft-identity94.6%
associate-*r/94.6%
neg-mul-194.6%
associate-*l*94.6%
neg-mul-194.6%
*-commutative94.6%
Applied egg-rr94.6%
associate-/l*94.6%
associate-/r/94.6%
distribute-rgt-neg-out94.6%
Simplified94.6%
Taylor expanded in re around 0 80.5%
if -2.4499999999999999e179 < im < -5.50000000000000001e35Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 4.2%
associate-*r*4.2%
neg-mul-14.2%
Simplified4.2%
Taylor expanded in re around 0 30.3%
neg-mul-130.3%
+-commutative30.3%
unsub-neg30.3%
*-commutative30.3%
unpow230.3%
associate-*l*30.3%
Simplified30.3%
sub-neg30.3%
*-commutative30.3%
neg-mul-130.3%
distribute-rgt-out30.3%
associate-*l*30.3%
Applied egg-rr30.3%
if -5.50000000000000001e35 < im < 2.09999999999999993e132Initial program 26.1%
neg-sub026.1%
Simplified26.1%
Taylor expanded in im around 0 80.2%
associate-*r*80.2%
neg-mul-180.2%
Simplified80.2%
Final simplification75.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (/ -1.0 im)))
(t_1 (* im (+ (* re (* 0.5 re)) -1.0))))
(if (<= im -2.45e+179)
t_0
(if (<= im -3e-21)
t_1
(if (<= im 8e-32) (- im) (if (<= im 1.95e+130) t_1 t_0))))))
double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double t_1 = im * ((re * (0.5 * re)) + -1.0);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -3e-21) {
tmp = t_1;
} else if (im <= 8e-32) {
tmp = -im;
} else if (im <= 1.95e+130) {
tmp = t_1;
} 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) :: tmp
t_0 = (im * im) * ((-1.0d0) / im)
t_1 = im * ((re * (0.5d0 * re)) + (-1.0d0))
if (im <= (-2.45d+179)) then
tmp = t_0
else if (im <= (-3d-21)) then
tmp = t_1
else if (im <= 8d-32) then
tmp = -im
else if (im <= 1.95d+130) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double t_1 = im * ((re * (0.5 * re)) + -1.0);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -3e-21) {
tmp = t_1;
} else if (im <= 8e-32) {
tmp = -im;
} else if (im <= 1.95e+130) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (-1.0 / im) t_1 = im * ((re * (0.5 * re)) + -1.0) tmp = 0 if im <= -2.45e+179: tmp = t_0 elif im <= -3e-21: tmp = t_1 elif im <= 8e-32: tmp = -im elif im <= 1.95e+130: tmp = t_1 else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(-1.0 / im)) t_1 = Float64(im * Float64(Float64(re * Float64(0.5 * re)) + -1.0)) tmp = 0.0 if (im <= -2.45e+179) tmp = t_0; elseif (im <= -3e-21) tmp = t_1; elseif (im <= 8e-32) tmp = Float64(-im); elseif (im <= 1.95e+130) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (-1.0 / im); t_1 = im * ((re * (0.5 * re)) + -1.0); tmp = 0.0; if (im <= -2.45e+179) tmp = t_0; elseif (im <= -3e-21) tmp = t_1; elseif (im <= 8e-32) tmp = -im; elseif (im <= 1.95e+130) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(-1.0 / im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(im * N[(N[(re * N[(0.5 * re), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.45e+179], t$95$0, If[LessEqual[im, -3e-21], t$95$1, If[LessEqual[im, 8e-32], (-im), If[LessEqual[im, 1.95e+130], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \frac{-1}{im}\\
t_1 := im \cdot \left(re \cdot \left(0.5 \cdot re\right) + -1\right)\\
\mathbf{if}\;im \leq -2.45 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -3 \cdot 10^{-21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 8 \cdot 10^{-32}:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 1.95 \cdot 10^{+130}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.4499999999999999e179 or 1.9500000000000001e130 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 7.2%
associate-*r*7.2%
neg-mul-17.2%
Simplified7.2%
*-commutative7.2%
neg-sub07.2%
flip--94.6%
metadata-eval94.6%
neg-sub094.6%
+-lft-identity94.6%
associate-*r/94.6%
neg-mul-194.6%
associate-*l*94.6%
neg-mul-194.6%
*-commutative94.6%
Applied egg-rr94.6%
associate-/l*94.6%
associate-/r/94.6%
distribute-rgt-neg-out94.6%
Simplified94.6%
Taylor expanded in re around 0 80.5%
if -2.4499999999999999e179 < im < -2.99999999999999991e-21 or 8.00000000000000045e-32 < im < 1.9500000000000001e130Initial program 92.5%
neg-sub092.5%
Simplified92.5%
Taylor expanded in im around 0 14.9%
associate-*r*14.9%
neg-mul-114.9%
Simplified14.9%
Taylor expanded in re around 0 22.7%
neg-mul-122.7%
+-commutative22.7%
unsub-neg22.7%
*-commutative22.7%
unpow222.7%
associate-*l*22.7%
Simplified22.7%
sub-neg22.7%
*-commutative22.7%
neg-mul-122.7%
distribute-rgt-out22.7%
associate-*l*22.7%
Applied egg-rr22.7%
if -2.99999999999999991e-21 < im < 8.00000000000000045e-32Initial program 5.5%
neg-sub05.5%
Simplified5.5%
Taylor expanded in im around 0 99.8%
associate-*r*99.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in re around 0 54.2%
neg-mul-154.2%
Simplified54.2%
Final simplification53.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (/ -1.0 im))))
(if (<= im -2.45e+179)
t_0
(if (<= im -3e-21)
(* im (+ (* re (* 0.5 re)) -1.0))
(if (<= im 8.2e-32)
(- im)
(if (<= im 7e+126) (- (* re (* 0.5 (* im re))) im) t_0))))))
double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -3e-21) {
tmp = im * ((re * (0.5 * re)) + -1.0);
} else if (im <= 8.2e-32) {
tmp = -im;
} else if (im <= 7e+126) {
tmp = (re * (0.5 * (im * 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 * im) * ((-1.0d0) / im)
if (im <= (-2.45d+179)) then
tmp = t_0
else if (im <= (-3d-21)) then
tmp = im * ((re * (0.5d0 * re)) + (-1.0d0))
else if (im <= 8.2d-32) then
tmp = -im
else if (im <= 7d+126) then
tmp = (re * (0.5d0 * (im * re))) - im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -3e-21) {
tmp = im * ((re * (0.5 * re)) + -1.0);
} else if (im <= 8.2e-32) {
tmp = -im;
} else if (im <= 7e+126) {
tmp = (re * (0.5 * (im * re))) - im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (-1.0 / im) tmp = 0 if im <= -2.45e+179: tmp = t_0 elif im <= -3e-21: tmp = im * ((re * (0.5 * re)) + -1.0) elif im <= 8.2e-32: tmp = -im elif im <= 7e+126: tmp = (re * (0.5 * (im * re))) - im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(-1.0 / im)) tmp = 0.0 if (im <= -2.45e+179) tmp = t_0; elseif (im <= -3e-21) tmp = Float64(im * Float64(Float64(re * Float64(0.5 * re)) + -1.0)); elseif (im <= 8.2e-32) tmp = Float64(-im); elseif (im <= 7e+126) tmp = Float64(Float64(re * Float64(0.5 * Float64(im * re))) - im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (-1.0 / im); tmp = 0.0; if (im <= -2.45e+179) tmp = t_0; elseif (im <= -3e-21) tmp = im * ((re * (0.5 * re)) + -1.0); elseif (im <= 8.2e-32) tmp = -im; elseif (im <= 7e+126) tmp = (re * (0.5 * (im * re))) - im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(-1.0 / im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.45e+179], t$95$0, If[LessEqual[im, -3e-21], N[(im * N[(N[(re * N[(0.5 * re), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8.2e-32], (-im), If[LessEqual[im, 7e+126], N[(N[(re * N[(0.5 * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \frac{-1}{im}\\
\mathbf{if}\;im \leq -2.45 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -3 \cdot 10^{-21}:\\
\;\;\;\;im \cdot \left(re \cdot \left(0.5 \cdot re\right) + -1\right)\\
\mathbf{elif}\;im \leq 8.2 \cdot 10^{-32}:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+126}:\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.4499999999999999e179 or 7.0000000000000005e126 < im Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 7.2%
associate-*r*7.2%
neg-mul-17.2%
Simplified7.2%
*-commutative7.2%
neg-sub07.2%
flip--94.6%
metadata-eval94.6%
neg-sub094.6%
+-lft-identity94.6%
associate-*r/94.6%
neg-mul-194.6%
associate-*l*94.6%
neg-mul-194.6%
*-commutative94.6%
Applied egg-rr94.6%
associate-/l*94.6%
associate-/r/94.6%
distribute-rgt-neg-out94.6%
Simplified94.6%
Taylor expanded in re around 0 80.5%
if -2.4499999999999999e179 < im < -2.99999999999999991e-21Initial program 95.0%
neg-sub095.0%
Simplified95.0%
Taylor expanded in im around 0 8.8%
associate-*r*8.8%
neg-mul-18.8%
Simplified8.8%
Taylor expanded in re around 0 20.6%
neg-mul-120.6%
+-commutative20.6%
unsub-neg20.6%
*-commutative20.6%
unpow220.6%
associate-*l*20.6%
Simplified20.6%
sub-neg20.6%
*-commutative20.6%
neg-mul-120.6%
distribute-rgt-out20.6%
associate-*l*20.6%
Applied egg-rr20.6%
if -2.99999999999999991e-21 < im < 8.1999999999999995e-32Initial program 5.5%
neg-sub05.5%
Simplified5.5%
Taylor expanded in im around 0 99.8%
associate-*r*99.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in re around 0 54.2%
neg-mul-154.2%
Simplified54.2%
if 8.1999999999999995e-32 < im < 7.0000000000000005e126Initial program 88.7%
neg-sub088.7%
Simplified88.7%
Taylor expanded in im around 0 24.0%
associate-*r*24.0%
neg-mul-124.0%
Simplified24.0%
Taylor expanded in re around 0 26.0%
neg-mul-126.0%
+-commutative26.0%
unsub-neg26.0%
*-commutative26.0%
unpow226.0%
associate-*l*26.0%
Simplified26.0%
Taylor expanded in im around 0 26.0%
*-commutative26.0%
unpow226.0%
associate-*r*26.0%
*-commutative26.0%
associate-*r*26.0%
*-commutative26.0%
*-commutative26.0%
Simplified26.0%
Final simplification53.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* im im) (/ -1.0 im))))
(if (<= im -2.45e+179)
t_0
(if (<= im -6.2e+35)
(* (* re re) (* im 0.5))
(if (<= im 2e-8) (- im) t_0)))))
double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -6.2e+35) {
tmp = (re * re) * (im * 0.5);
} else if (im <= 2e-8) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = (im * im) * ((-1.0d0) / im)
if (im <= (-2.45d+179)) then
tmp = t_0
else if (im <= (-6.2d+35)) then
tmp = (re * re) * (im * 0.5d0)
else if (im <= 2d-8) then
tmp = -im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (im * im) * (-1.0 / im);
double tmp;
if (im <= -2.45e+179) {
tmp = t_0;
} else if (im <= -6.2e+35) {
tmp = (re * re) * (im * 0.5);
} else if (im <= 2e-8) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (im * im) * (-1.0 / im) tmp = 0 if im <= -2.45e+179: tmp = t_0 elif im <= -6.2e+35: tmp = (re * re) * (im * 0.5) elif im <= 2e-8: tmp = -im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(im * im) * Float64(-1.0 / im)) tmp = 0.0 if (im <= -2.45e+179) tmp = t_0; elseif (im <= -6.2e+35) tmp = Float64(Float64(re * re) * Float64(im * 0.5)); elseif (im <= 2e-8) tmp = Float64(-im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (im * im) * (-1.0 / im); tmp = 0.0; if (im <= -2.45e+179) tmp = t_0; elseif (im <= -6.2e+35) tmp = (re * re) * (im * 0.5); elseif (im <= 2e-8) tmp = -im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(im * im), $MachinePrecision] * N[(-1.0 / im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.45e+179], t$95$0, If[LessEqual[im, -6.2e+35], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2e-8], (-im), t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot im\right) \cdot \frac{-1}{im}\\
\mathbf{if}\;im \leq -2.45 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -6.2 \cdot 10^{+35}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\mathbf{elif}\;im \leq 2 \cdot 10^{-8}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -2.4499999999999999e179 or 2e-8 < im Initial program 99.9%
neg-sub099.9%
Simplified99.9%
Taylor expanded in im around 0 6.9%
associate-*r*6.9%
neg-mul-16.9%
Simplified6.9%
*-commutative6.9%
neg-sub06.9%
flip--74.4%
metadata-eval74.4%
neg-sub074.4%
+-lft-identity74.4%
associate-*r/74.4%
neg-mul-174.4%
associate-*l*74.4%
neg-mul-174.4%
*-commutative74.4%
Applied egg-rr74.4%
associate-/l*74.4%
associate-/r/74.4%
distribute-rgt-neg-out74.4%
Simplified74.4%
Taylor expanded in re around 0 62.9%
if -2.4499999999999999e179 < im < -6.19999999999999973e35Initial program 100.0%
neg-sub0100.0%
Simplified100.0%
Taylor expanded in im around 0 4.2%
associate-*r*4.2%
neg-mul-14.2%
Simplified4.2%
Taylor expanded in re around 0 30.3%
neg-mul-130.3%
+-commutative30.3%
unsub-neg30.3%
*-commutative30.3%
unpow230.3%
associate-*l*30.3%
Simplified30.3%
sub-neg30.3%
+-commutative30.3%
flip-+13.5%
sqr-neg13.5%
pow213.5%
associate-*l*13.5%
associate-*r*13.5%
*-commutative13.5%
*-commutative13.5%
associate-*l*13.5%
associate-*r*13.5%
*-commutative13.5%
*-commutative13.5%
Applied egg-rr13.5%
Taylor expanded in re around inf 29.0%
unpow229.0%
associate-*r*29.0%
*-commutative29.0%
*-commutative29.0%
Simplified29.0%
if -6.19999999999999973e35 < im < 2e-8Initial program 14.9%
neg-sub014.9%
Simplified14.9%
Taylor expanded in im around 0 91.5%
associate-*r*91.5%
neg-mul-191.5%
Simplified91.5%
Taylor expanded in re around 0 49.2%
neg-mul-149.2%
Simplified49.2%
Final simplification52.2%
(FPCore (re im) :precision binary64 (if (<= re 6.8e+117) (- im) (if (<= re 8.5e+231) (* (* re re) (* im 0.5)) (* re (* re 0.75)))))
double code(double re, double im) {
double tmp;
if (re <= 6.8e+117) {
tmp = -im;
} else if (re <= 8.5e+231) {
tmp = (re * re) * (im * 0.5);
} 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 (re <= 6.8d+117) then
tmp = -im
else if (re <= 8.5d+231) then
tmp = (re * re) * (im * 0.5d0)
else
tmp = re * (re * 0.75d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 6.8e+117) {
tmp = -im;
} else if (re <= 8.5e+231) {
tmp = (re * re) * (im * 0.5);
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 6.8e+117: tmp = -im elif re <= 8.5e+231: tmp = (re * re) * (im * 0.5) else: tmp = re * (re * 0.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 6.8e+117) tmp = Float64(-im); elseif (re <= 8.5e+231) tmp = Float64(Float64(re * re) * Float64(im * 0.5)); else tmp = Float64(re * Float64(re * 0.75)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 6.8e+117) tmp = -im; elseif (re <= 8.5e+231) tmp = (re * re) * (im * 0.5); else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 6.8e+117], (-im), If[LessEqual[re, 8.5e+231], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 6.8 \cdot 10^{+117}:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 8.5 \cdot 10^{+231}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if re < 6.8000000000000002e117Initial program 53.9%
neg-sub053.9%
Simplified53.9%
Taylor expanded in im around 0 52.6%
associate-*r*52.6%
neg-mul-152.6%
Simplified52.6%
Taylor expanded in re around 0 31.9%
neg-mul-131.9%
Simplified31.9%
if 6.8000000000000002e117 < re < 8.4999999999999994e231Initial program 46.9%
neg-sub046.9%
Simplified46.9%
Taylor expanded in im around 0 58.1%
associate-*r*58.1%
neg-mul-158.1%
Simplified58.1%
Taylor expanded in re around 0 32.6%
neg-mul-132.6%
+-commutative32.6%
unsub-neg32.6%
*-commutative32.6%
unpow232.6%
associate-*l*32.6%
Simplified32.6%
sub-neg32.6%
+-commutative32.6%
flip-+0.7%
sqr-neg0.7%
pow20.7%
associate-*l*0.7%
associate-*r*1.2%
*-commutative1.2%
*-commutative1.2%
associate-*l*1.2%
associate-*r*1.0%
*-commutative1.0%
*-commutative1.0%
Applied egg-rr1.0%
Taylor expanded in re around inf 32.6%
unpow232.6%
associate-*r*32.6%
*-commutative32.6%
*-commutative32.6%
Simplified32.6%
if 8.4999999999999994e231 < re Initial program 58.9%
neg-sub058.9%
Simplified58.9%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out18.8%
unpow218.8%
Simplified18.8%
Applied egg-rr32.0%
Taylor expanded in re around inf 32.0%
*-commutative32.0%
unpow232.0%
associate-*l*32.0%
Simplified32.0%
Final simplification32.0%
(FPCore (re im) :precision binary64 (if (<= re 4.2e+171) (- im) (* re (* re 0.75))))
double code(double re, double im) {
double tmp;
if (re <= 4.2e+171) {
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 (re <= 4.2d+171) 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 (re <= 4.2e+171) {
tmp = -im;
} else {
tmp = re * (re * 0.75);
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 4.2e+171: tmp = -im else: tmp = re * (re * 0.75) return tmp
function code(re, im) tmp = 0.0 if (re <= 4.2e+171) 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 (re <= 4.2e+171) tmp = -im; else tmp = re * (re * 0.75); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 4.2e+171], (-im), N[(re * N[(re * 0.75), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 4.2 \cdot 10^{+171}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.75\right)\\
\end{array}
\end{array}
if re < 4.2000000000000003e171Initial program 53.5%
neg-sub053.5%
Simplified53.5%
Taylor expanded in im around 0 53.0%
associate-*r*53.0%
neg-mul-153.0%
Simplified53.0%
Taylor expanded in re around 0 31.2%
neg-mul-131.2%
Simplified31.2%
if 4.2000000000000003e171 < re Initial program 56.9%
neg-sub056.9%
Simplified56.9%
Taylor expanded in re around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
distribute-rgt-out20.8%
unpow220.8%
Simplified20.8%
Applied egg-rr25.8%
Taylor expanded in re around inf 25.8%
*-commutative25.8%
unpow225.8%
associate-*l*25.8%
Simplified25.8%
Final simplification30.7%
(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 53.8%
neg-sub053.8%
Simplified53.8%
Taylor expanded in im around 0 52.5%
associate-*r*52.5%
neg-mul-152.5%
Simplified52.5%
Taylor expanded in re around 0 28.9%
neg-mul-128.9%
Simplified28.9%
Final simplification28.9%
(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 53.8%
neg-sub053.8%
Simplified53.8%
Taylor expanded in re around 0 3.0%
+-commutative3.0%
associate-*r*3.0%
distribute-rgt-out42.1%
unpow242.1%
Simplified42.1%
Applied egg-rr7.8%
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 2023297
(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))))