
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 4e-5)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(+
(* (pow im 7.0) -0.0001984126984126984)
(* (pow im 5.0) -0.008333333333333333))
(- (* (* im (* im im)) -0.16666666666666666) im))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 4e-5)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((pow(im, 7.0) * -0.0001984126984126984) + (pow(im, 5.0) * -0.008333333333333333)) + (((im * (im * im)) * -0.16666666666666666) - im));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 4e-5)) {
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)) + (((im * (im * im)) * -0.16666666666666666) - im));
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 4e-5): 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)) + (((im * (im * im)) * -0.16666666666666666) - im)) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 4e-5)) 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(Float64(im * Float64(im * im)) * -0.16666666666666666) - im))); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 4e-5))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * ((((im ^ 7.0) * -0.0001984126984126984) + ((im ^ 5.0) * -0.008333333333333333)) + (((im * (im * im)) * -0.16666666666666666) - im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 4e-5]], $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[(im * N[(im * im), $MachinePrecision]), $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 -\infty \lor \neg \left(t_0 \leq 4 \cdot 10^{-5}\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(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 4.00000000000000033e-5 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -inf.0 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 4.00000000000000033e-5Initial program 10.1%
sub0-neg10.1%
Simplified10.1%
Taylor expanded in im around 0 99.9%
associate-+r+99.9%
+-commutative99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-lft-neg-in99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*l*99.9%
distribute-lft-out99.9%
Simplified99.9%
unpow399.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))) (t_1 (* 0.5 (cos re))))
(if (or (<= t_0 -0.02) (not (<= t_0 4e-5)))
(* t_1 t_0)
(*
t_1
(+
(* im -2.0)
(+
(* (pow im 5.0) -0.016666666666666666)
(* -0.3333333333333333 (pow im 3.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 <= -0.02) || !(t_0 <= 4e-5)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((pow(im, 5.0) * -0.016666666666666666) + (-0.3333333333333333 * pow(im, 3.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 <= (-0.02d0)) .or. (.not. (t_0 <= 4d-5))) then
tmp = t_1 * t_0
else
tmp = t_1 * ((im * (-2.0d0)) + (((im ** 5.0d0) * (-0.016666666666666666d0)) + ((-0.3333333333333333d0) * (im ** 3.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 <= -0.02) || !(t_0 <= 4e-5)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((Math.pow(im, 5.0) * -0.016666666666666666) + (-0.3333333333333333 * Math.pow(im, 3.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 <= -0.02) or not (t_0 <= 4e-5): tmp = t_1 * t_0 else: tmp = t_1 * ((im * -2.0) + ((math.pow(im, 5.0) * -0.016666666666666666) + (-0.3333333333333333 * math.pow(im, 3.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 <= -0.02) || !(t_0 <= 4e-5)) tmp = Float64(t_1 * t_0); else tmp = Float64(t_1 * Float64(Float64(im * -2.0) + Float64(Float64((im ^ 5.0) * -0.016666666666666666) + Float64(-0.3333333333333333 * (im ^ 3.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 <= -0.02) || ~((t_0 <= 4e-5))) tmp = t_1 * t_0; else tmp = t_1 * ((im * -2.0) + (((im ^ 5.0) * -0.016666666666666666) + (-0.3333333333333333 * (im ^ 3.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[Or[LessEqual[t$95$0, -0.02], N[Not[LessEqual[t$95$0, 4e-5]], $MachinePrecision]], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$1 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.016666666666666666), $MachinePrecision] + N[(-0.3333333333333333 * N[Power[im, 3.0], $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 -0.02 \lor \neg \left(t_0 \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(im \cdot -2 + \left({im}^{5} \cdot -0.016666666666666666 + -0.3333333333333333 \cdot {im}^{3}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -0.0200000000000000004 or 4.00000000000000033e-5 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
if -0.0200000000000000004 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 4.00000000000000033e-5Initial program 9.4%
sub0-neg9.4%
Simplified9.4%
Taylor expanded in im around 0 99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -0.005) (not (<= t_0 4e-5)))
(* (* 0.5 (cos re)) t_0)
(* (cos re) (- (* (* im (* im im)) -0.16666666666666666) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -0.005) || !(t_0 <= 4e-5)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-0.005d0)) .or. (.not. (t_0 <= 4d-5))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -0.005) || !(t_0 <= 4e-5)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -0.005) or not (t_0 <= 4e-5): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= -0.005) || !(t_0 <= 4e-5)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -0.005) || ~((t_0 <= 4e-5))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.005], N[Not[LessEqual[t$95$0, 4e-5]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.005 \lor \neg \left(t_0 \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -0.0050000000000000001 or 4.00000000000000033e-5 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
if -0.0050000000000000001 < (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < 4.00000000000000033e-5Initial program 8.8%
sub0-neg8.8%
Simplified8.8%
Taylor expanded in im around 0 99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
associate-*l*99.9%
distribute-lft-out--99.9%
Simplified99.9%
unpow399.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im)))
(t_1 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -5.3e+39)
t_1
(if (<= im -0.055)
(* t_0 (+ 0.5 (* re (* re -0.25))))
(if (<= im 0.1)
(* (cos re) (- (* (* im (* im im)) -0.16666666666666666) im))
(if (<= im 1.1e+44) (* 0.5 t_0) t_1))))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double t_1 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -5.3e+39) {
tmp = t_1;
} else if (im <= -0.055) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if (im <= 0.1) {
tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-5.3d+39)) then
tmp = t_1
else if (im <= (-0.055d0)) then
tmp = t_0 * (0.5d0 + (re * (re * (-0.25d0))))
else if (im <= 0.1d0) then
tmp = cos(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = 0.5d0 * t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double t_1 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -5.3e+39) {
tmp = t_1;
} else if (im <= -0.055) {
tmp = t_0 * (0.5 + (re * (re * -0.25)));
} else if (im <= 0.1) {
tmp = Math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = 0.5 * t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) t_1 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -5.3e+39: tmp = t_1 elif im <= -0.055: tmp = t_0 * (0.5 + (re * (re * -0.25))) elif im <= 0.1: tmp = math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = 0.5 * t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) t_1 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -5.3e+39) tmp = t_1; elseif (im <= -0.055) tmp = Float64(t_0 * Float64(0.5 + Float64(re * Float64(re * -0.25)))); elseif (im <= 0.1) tmp = Float64(cos(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = Float64(0.5 * t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); t_1 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -5.3e+39) tmp = t_1; elseif (im <= -0.055) tmp = t_0 * (0.5 + (re * (re * -0.25))); elseif (im <= 0.1) tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = 0.5 * t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -5.3e+39], t$95$1, If[LessEqual[im, -0.055], N[(t$95$0 * N[(0.5 + N[(re * N[(re * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 0.1], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], N[(0.5 * t$95$0), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -5.3 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.055:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 0.1:\\
\;\;\;\;\cos re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 1.1 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -5.29999999999999979e39 or 1.09999999999999998e44 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 98.3%
associate-+r+98.3%
+-commutative98.3%
mul-1-neg98.3%
*-commutative98.3%
distribute-lft-neg-in98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt-out98.3%
*-commutative98.3%
associate-*l*98.3%
*-commutative98.3%
associate-*l*98.3%
distribute-lft-out98.3%
Simplified98.3%
Taylor expanded in im around inf 98.3%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
if -5.29999999999999979e39 < im < -0.0550000000000000003Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in re around 0 7.6%
*-commutative7.6%
associate-*r*7.6%
distribute-rgt-out84.5%
+-commutative84.5%
*-commutative84.5%
unpow284.5%
associate-*l*84.5%
Simplified84.5%
if -0.0550000000000000003 < im < 0.10000000000000001Initial program 10.1%
sub0-neg10.1%
Simplified10.1%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
associate-*l*99.4%
distribute-lft-out--99.4%
Simplified99.4%
unpow399.9%
Applied egg-rr99.4%
if 0.10000000000000001 < im < 1.09999999999999998e44Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 90.9%
Final simplification97.8%
(FPCore (re im)
:precision binary64
(if (or (<= im -5.8e+102)
(not (or (<= im -0.042) (and (not (<= im 0.09)) (<= im 4.4e+100)))))
(* (cos re) (- (* (* im (* im im)) -0.16666666666666666) im))
(* 0.5 (- (exp (- im)) (exp im)))))
double code(double re, double im) {
double tmp;
if ((im <= -5.8e+102) || !((im <= -0.042) || (!(im <= 0.09) && (im <= 4.4e+100)))) {
tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (exp(-im) - exp(im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-5.8d+102)) .or. (.not. (im <= (-0.042d0)) .or. (.not. (im <= 0.09d0)) .and. (im <= 4.4d+100))) then
tmp = cos(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
else
tmp = 0.5d0 * (exp(-im) - exp(im))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -5.8e+102) || !((im <= -0.042) || (!(im <= 0.09) && (im <= 4.4e+100)))) {
tmp = Math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
} else {
tmp = 0.5 * (Math.exp(-im) - Math.exp(im));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -5.8e+102) or not ((im <= -0.042) or (not (im <= 0.09) and (im <= 4.4e+100))): tmp = math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im) else: tmp = 0.5 * (math.exp(-im) - math.exp(im)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -5.8e+102) || !((im <= -0.042) || (!(im <= 0.09) && (im <= 4.4e+100)))) tmp = Float64(cos(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im)); else tmp = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -5.8e+102) || ~(((im <= -0.042) || (~((im <= 0.09)) && (im <= 4.4e+100))))) tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im); else tmp = 0.5 * (exp(-im) - exp(im)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -5.8e+102], N[Not[Or[LessEqual[im, -0.042], And[N[Not[LessEqual[im, 0.09]], $MachinePrecision], LessEqual[im, 4.4e+100]]]], $MachinePrecision]], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -5.8 \cdot 10^{+102} \lor \neg \left(im \leq -0.042 \lor \neg \left(im \leq 0.09\right) \land im \leq 4.4 \cdot 10^{+100}\right):\\
\;\;\;\;\cos re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\end{array}
if im < -5.8000000000000005e102 or -0.0420000000000000026 < im < 0.089999999999999997 or 4.4000000000000001e100 < im Initial program 44.9%
sub0-neg44.9%
Simplified44.9%
Taylor expanded in im around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
*-commutative99.2%
associate-*l*99.2%
distribute-lft-out--99.2%
Simplified99.2%
unpow399.9%
Applied egg-rr99.2%
if -5.8000000000000005e102 < im < -0.0420000000000000026 or 0.089999999999999997 < im < 4.4000000000000001e100Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 78.8%
Final simplification95.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* (pow im 7.0) (* (cos re) -0.0001984126984126984))))
(if (<= im -7.5e+51)
t_1
(if (<= im -0.0215)
t_0
(if (<= im 0.118)
(* (cos re) (- (* (* im (* im im)) -0.16666666666666666) im))
(if (<= im 1.1e+44) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = pow(im, 7.0) * (cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -7.5e+51) {
tmp = t_1;
} else if (im <= -0.0215) {
tmp = t_0;
} else if (im <= 0.118) {
tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (im ** 7.0d0) * (cos(re) * (-0.0001984126984126984d0))
if (im <= (-7.5d+51)) then
tmp = t_1
else if (im <= (-0.0215d0)) then
tmp = t_0
else if (im <= 0.118d0) then
tmp = cos(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
else if (im <= 1.1d+44) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = Math.pow(im, 7.0) * (Math.cos(re) * -0.0001984126984126984);
double tmp;
if (im <= -7.5e+51) {
tmp = t_1;
} else if (im <= -0.0215) {
tmp = t_0;
} else if (im <= 0.118) {
tmp = Math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
} else if (im <= 1.1e+44) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = math.pow(im, 7.0) * (math.cos(re) * -0.0001984126984126984) tmp = 0 if im <= -7.5e+51: tmp = t_1 elif im <= -0.0215: tmp = t_0 elif im <= 0.118: tmp = math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im) elif im <= 1.1e+44: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64((im ^ 7.0) * Float64(cos(re) * -0.0001984126984126984)) tmp = 0.0 if (im <= -7.5e+51) tmp = t_1; elseif (im <= -0.0215) tmp = t_0; elseif (im <= 0.118) tmp = Float64(cos(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im)); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = (im ^ 7.0) * (cos(re) * -0.0001984126984126984); tmp = 0.0; if (im <= -7.5e+51) tmp = t_1; elseif (im <= -0.0215) tmp = t_0; elseif (im <= 0.118) tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im); elseif (im <= 1.1e+44) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 7.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.0001984126984126984), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -7.5e+51], t$95$1, If[LessEqual[im, -0.0215], t$95$0, If[LessEqual[im, 0.118], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.1e+44], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{7} \cdot \left(\cos re \cdot -0.0001984126984126984\right)\\
\mathbf{if}\;im \leq -7.5 \cdot 10^{+51}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.0215:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.118:\\
\;\;\;\;\cos re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \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 < -7.4999999999999999e51 or 1.09999999999999998e44 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -7.4999999999999999e51 < im < -0.021499999999999998 or 0.11799999999999999 < im < 1.09999999999999998e44Initial program 99.9%
sub0-neg99.9%
Simplified99.9%
Taylor expanded in re around 0 77.7%
if -0.021499999999999998 < im < 0.11799999999999999Initial program 10.1%
sub0-neg10.1%
Simplified10.1%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
associate-*l*99.4%
distribute-lft-out--99.4%
Simplified99.4%
unpow399.9%
Applied egg-rr99.4%
Final simplification97.4%
(FPCore (re im) :precision binary64 (* (cos re) (- (* (* im (* im im)) -0.16666666666666666) im)))
double code(double re, double im) {
return cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(re) * (((im * (im * im)) * (-0.16666666666666666d0)) - im)
end function
public static double code(double re, double im) {
return Math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im);
}
def code(re, im): return math.cos(re) * (((im * (im * im)) * -0.16666666666666666) - im)
function code(re, im) return Float64(cos(re) * Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im)) end
function tmp = code(re, im) tmp = cos(re) * (((im * (im * im)) * -0.16666666666666666) - im); end
code[re_, im_] := N[(N[Cos[re], $MachinePrecision] * N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos re \cdot \left(\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\right)
\end{array}
Initial program 56.1%
sub0-neg56.1%
Simplified56.1%
Taylor expanded in im around 0 80.3%
mul-1-neg80.3%
unsub-neg80.3%
*-commutative80.3%
associate-*l*80.3%
distribute-lft-out--80.3%
Simplified80.3%
unpow390.7%
Applied egg-rr80.3%
Final simplification80.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (* im (* im im)) -0.16666666666666666) im)))
(if (<= im -1e+134)
t_0
(if (<= im -850.0)
(* (* im (* re re)) (+ 0.5 (* (* im im) 0.08333333333333333)))
(if (<= im 1.8e+56) (* im (- (cos re))) t_0)))))
double code(double re, double im) {
double t_0 = ((im * (im * im)) * -0.16666666666666666) - im;
double tmp;
if (im <= -1e+134) {
tmp = t_0;
} else if (im <= -850.0) {
tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333));
} else if (im <= 1.8e+56) {
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 * im)) * (-0.16666666666666666d0)) - im
if (im <= (-1d+134)) then
tmp = t_0
else if (im <= (-850.0d0)) then
tmp = (im * (re * re)) * (0.5d0 + ((im * im) * 0.08333333333333333d0))
else if (im <= 1.8d+56) 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 * im)) * -0.16666666666666666) - im;
double tmp;
if (im <= -1e+134) {
tmp = t_0;
} else if (im <= -850.0) {
tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333));
} else if (im <= 1.8e+56) {
tmp = im * -Math.cos(re);
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = ((im * (im * im)) * -0.16666666666666666) - im tmp = 0 if im <= -1e+134: tmp = t_0 elif im <= -850.0: tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333)) elif im <= 1.8e+56: tmp = im * -math.cos(re) else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -1e+134) tmp = t_0; elseif (im <= -850.0) tmp = Float64(Float64(im * Float64(re * re)) * Float64(0.5 + Float64(Float64(im * im) * 0.08333333333333333))); elseif (im <= 1.8e+56) tmp = Float64(im * Float64(-cos(re))); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = ((im * (im * im)) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -1e+134) tmp = t_0; elseif (im <= -850.0) tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333)); elseif (im <= 1.8e+56) tmp = im * -cos(re); else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -1e+134], t$95$0, If[LessEqual[im, -850.0], N[(N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.8e+56], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -1 \cdot 10^{+134}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -850:\\
\;\;\;\;\left(im \cdot \left(re \cdot re\right)\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+56}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -9.99999999999999921e133 or 1.79999999999999999e56 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 88.3%
mul-1-neg88.3%
unsub-neg88.3%
*-commutative88.3%
associate-*l*88.3%
distribute-lft-out--88.3%
Simplified88.3%
Taylor expanded in re around 0 68.4%
unpow3100.0%
Applied egg-rr68.4%
if -9.99999999999999921e133 < im < -850Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out80.0%
+-commutative80.0%
*-commutative80.0%
unpow280.0%
associate-*l*80.0%
Simplified80.0%
Taylor expanded in re around inf 33.3%
*-commutative33.3%
associate-*r*33.3%
*-commutative33.3%
unpow233.3%
Simplified33.3%
Taylor expanded in im around 0 24.4%
cube-mult24.4%
associate-*r*24.5%
*-commutative24.5%
associate-*r*24.5%
distribute-rgt-out24.5%
*-commutative24.5%
unpow224.5%
Simplified24.5%
if -850 < im < 1.79999999999999999e56Initial program 19.7%
sub0-neg19.7%
Simplified19.7%
Taylor expanded in im around 0 88.7%
mul-1-neg88.7%
*-commutative88.7%
distribute-lft-neg-in88.7%
Simplified88.7%
Final simplification74.3%
(FPCore (re im) :precision binary64 (if (or (<= im -6.2e+134) (not (<= im -520.0))) (- (* (* im (* im im)) -0.16666666666666666) im) (* (* im (* re re)) (+ 0.5 (* (* im im) 0.08333333333333333)))))
double code(double re, double im) {
double tmp;
if ((im <= -6.2e+134) || !(im <= -520.0)) {
tmp = ((im * (im * im)) * -0.16666666666666666) - im;
} else {
tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-6.2d+134)) .or. (.not. (im <= (-520.0d0)))) then
tmp = ((im * (im * im)) * (-0.16666666666666666d0)) - im
else
tmp = (im * (re * re)) * (0.5d0 + ((im * im) * 0.08333333333333333d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -6.2e+134) || !(im <= -520.0)) {
tmp = ((im * (im * im)) * -0.16666666666666666) - im;
} else {
tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -6.2e+134) or not (im <= -520.0): tmp = ((im * (im * im)) * -0.16666666666666666) - im else: tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -6.2e+134) || !(im <= -520.0)) tmp = Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im); else tmp = Float64(Float64(im * Float64(re * re)) * Float64(0.5 + Float64(Float64(im * im) * 0.08333333333333333))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -6.2e+134) || ~((im <= -520.0))) tmp = ((im * (im * im)) * -0.16666666666666666) - im; else tmp = (im * (re * re)) * (0.5 + ((im * im) * 0.08333333333333333)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -6.2e+134], N[Not[LessEqual[im, -520.0]], $MachinePrecision]], N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], N[(N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(N[(im * im), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -6.2 \cdot 10^{+134} \lor \neg \left(im \leq -520\right):\\
\;\;\;\;\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;\left(im \cdot \left(re \cdot re\right)\right) \cdot \left(0.5 + \left(im \cdot im\right) \cdot 0.08333333333333333\right)\\
\end{array}
\end{array}
if im < -6.19999999999999963e134 or -520 < im Initial program 50.3%
sub0-neg50.3%
Simplified50.3%
Taylor expanded in im around 0 89.0%
mul-1-neg89.0%
unsub-neg89.0%
*-commutative89.0%
associate-*l*89.0%
distribute-lft-out--89.0%
Simplified89.0%
Taylor expanded in re around 0 59.1%
unpow395.3%
Applied egg-rr59.1%
if -6.19999999999999963e134 < im < -520Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out80.0%
+-commutative80.0%
*-commutative80.0%
unpow280.0%
associate-*l*80.0%
Simplified80.0%
Taylor expanded in re around inf 33.3%
*-commutative33.3%
associate-*r*33.3%
*-commutative33.3%
unpow233.3%
Simplified33.3%
Taylor expanded in im around 0 24.4%
cube-mult24.4%
associate-*r*24.5%
*-commutative24.5%
associate-*r*24.5%
distribute-rgt-out24.5%
*-commutative24.5%
unpow224.5%
Simplified24.5%
Final simplification55.1%
(FPCore (re im) :precision binary64 (if (or (<= im -3.6e+109) (not (<= im -650.0))) (- (* (* im (* im im)) -0.16666666666666666) im) (* im (* 0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if ((im <= -3.6e+109) || !(im <= -650.0)) {
tmp = ((im * (im * im)) * -0.16666666666666666) - im;
} else {
tmp = im * (0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-3.6d+109)) .or. (.not. (im <= (-650.0d0)))) then
tmp = ((im * (im * im)) * (-0.16666666666666666d0)) - im
else
tmp = im * (0.5d0 * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.6e+109) || !(im <= -650.0)) {
tmp = ((im * (im * im)) * -0.16666666666666666) - im;
} else {
tmp = im * (0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.6e+109) or not (im <= -650.0): tmp = ((im * (im * im)) * -0.16666666666666666) - im else: tmp = im * (0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.6e+109) || !(im <= -650.0)) tmp = Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im); else tmp = Float64(im * Float64(0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.6e+109) || ~((im <= -650.0))) tmp = ((im * (im * im)) * -0.16666666666666666) - im; else tmp = im * (0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.6e+109], N[Not[LessEqual[im, -650.0]], $MachinePrecision]], N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.6 \cdot 10^{+109} \lor \neg \left(im \leq -650\right):\\
\;\;\;\;\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if im < -3.6e109 or -650 < im Initial program 50.7%
sub0-neg50.7%
Simplified50.7%
Taylor expanded in im around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
*-commutative89.1%
associate-*l*89.1%
distribute-lft-out--89.1%
Simplified89.1%
Taylor expanded in re around 0 59.1%
unpow395.3%
Applied egg-rr59.1%
if -3.6e109 < im < -650Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out78.6%
+-commutative78.6%
*-commutative78.6%
unpow278.6%
associate-*l*78.6%
Simplified78.6%
Taylor expanded in re around inf 32.1%
*-commutative32.1%
associate-*r*32.1%
*-commutative32.1%
unpow232.1%
Simplified32.1%
Taylor expanded in im around 0 19.2%
*-commutative19.2%
*-commutative19.2%
associate-*l*19.2%
unpow219.2%
Simplified19.2%
Final simplification54.7%
(FPCore (re im) :precision binary64 (if (or (<= im -3.6e+109) (not (<= im -360.0))) (- (* (* im (* im im)) -0.16666666666666666) im) (- (* im (* 0.5 (* re re))) im)))
double code(double re, double im) {
double tmp;
if ((im <= -3.6e+109) || !(im <= -360.0)) {
tmp = ((im * (im * im)) * -0.16666666666666666) - im;
} else {
tmp = (im * (0.5 * (re * re))) - im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-3.6d+109)) .or. (.not. (im <= (-360.0d0)))) then
tmp = ((im * (im * im)) * (-0.16666666666666666d0)) - im
else
tmp = (im * (0.5d0 * (re * re))) - im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -3.6e+109) || !(im <= -360.0)) {
tmp = ((im * (im * im)) * -0.16666666666666666) - im;
} else {
tmp = (im * (0.5 * (re * re))) - im;
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -3.6e+109) or not (im <= -360.0): tmp = ((im * (im * im)) * -0.16666666666666666) - im else: tmp = (im * (0.5 * (re * re))) - im return tmp
function code(re, im) tmp = 0.0 if ((im <= -3.6e+109) || !(im <= -360.0)) tmp = Float64(Float64(Float64(im * Float64(im * im)) * -0.16666666666666666) - im); else tmp = Float64(Float64(im * Float64(0.5 * Float64(re * re))) - im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -3.6e+109) || ~((im <= -360.0))) tmp = ((im * (im * im)) * -0.16666666666666666) - im; else tmp = (im * (0.5 * (re * re))) - im; end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -3.6e+109], N[Not[LessEqual[im, -360.0]], $MachinePrecision]], N[(N[(N[(im * N[(im * im), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], N[(N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -3.6 \cdot 10^{+109} \lor \neg \left(im \leq -360\right):\\
\;\;\;\;\left(im \cdot \left(im \cdot im\right)\right) \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\end{array}
\end{array}
if im < -3.6e109 or -360 < im Initial program 50.7%
sub0-neg50.7%
Simplified50.7%
Taylor expanded in im around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
*-commutative89.1%
associate-*l*89.1%
distribute-lft-out--89.1%
Simplified89.1%
Taylor expanded in re around 0 59.1%
unpow395.3%
Applied egg-rr59.1%
if -3.6e109 < im < -360Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.5%
mul-1-neg3.5%
*-commutative3.5%
distribute-lft-neg-in3.5%
Simplified3.5%
Taylor expanded in re around 0 20.3%
neg-mul-120.3%
+-commutative20.3%
unsub-neg20.3%
*-commutative20.3%
*-commutative20.3%
associate-*l*20.3%
unpow220.3%
Simplified20.3%
Final simplification54.8%
(FPCore (re im)
:precision binary64
(if (<= re 4e+23)
(- im)
(if (<= re 3.1e+175)
(* re (* im (* 0.5 re)))
(* (* -0.25 (* re re)) 27.0))))
double code(double re, double im) {
double tmp;
if (re <= 4e+23) {
tmp = -im;
} else if (re <= 3.1e+175) {
tmp = re * (im * (0.5 * re));
} else {
tmp = (-0.25 * (re * re)) * 27.0;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 4d+23) then
tmp = -im
else if (re <= 3.1d+175) then
tmp = re * (im * (0.5d0 * re))
else
tmp = ((-0.25d0) * (re * re)) * 27.0d0
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 4e+23) {
tmp = -im;
} else if (re <= 3.1e+175) {
tmp = re * (im * (0.5 * re));
} else {
tmp = (-0.25 * (re * re)) * 27.0;
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 4e+23: tmp = -im elif re <= 3.1e+175: tmp = re * (im * (0.5 * re)) else: tmp = (-0.25 * (re * re)) * 27.0 return tmp
function code(re, im) tmp = 0.0 if (re <= 4e+23) tmp = Float64(-im); elseif (re <= 3.1e+175) tmp = Float64(re * Float64(im * Float64(0.5 * re))); else tmp = Float64(Float64(-0.25 * Float64(re * re)) * 27.0); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 4e+23) tmp = -im; elseif (re <= 3.1e+175) tmp = re * (im * (0.5 * re)); else tmp = (-0.25 * (re * re)) * 27.0; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 4e+23], (-im), If[LessEqual[re, 3.1e+175], N[(re * N[(im * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.25 * N[(re * re), $MachinePrecision]), $MachinePrecision] * 27.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 4 \cdot 10^{+23}:\\
\;\;\;\;-im\\
\mathbf{elif}\;re \leq 3.1 \cdot 10^{+175}:\\
\;\;\;\;re \cdot \left(im \cdot \left(0.5 \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-0.25 \cdot \left(re \cdot re\right)\right) \cdot 27\\
\end{array}
\end{array}
if re < 3.9999999999999997e23Initial program 53.5%
sub0-neg53.5%
Simplified53.5%
Taylor expanded in im around 0 53.8%
mul-1-neg53.8%
*-commutative53.8%
distribute-lft-neg-in53.8%
Simplified53.8%
Taylor expanded in re around 0 38.3%
neg-mul-138.3%
Simplified38.3%
if 3.9999999999999997e23 < re < 3.09999999999999984e175Initial program 67.6%
sub0-neg67.6%
Simplified67.6%
Taylor expanded in re around 0 1.7%
*-commutative1.7%
associate-*r*1.7%
distribute-rgt-out32.8%
+-commutative32.8%
*-commutative32.8%
unpow232.8%
associate-*l*32.8%
Simplified32.8%
Taylor expanded in re around inf 32.8%
*-commutative32.8%
associate-*r*32.8%
*-commutative32.8%
unpow232.8%
Simplified32.8%
Taylor expanded in im around 0 25.9%
*-commutative25.9%
*-commutative25.9%
associate-*l*25.9%
unpow225.9%
Simplified25.9%
Taylor expanded in im around 0 25.9%
unpow225.9%
associate-*r*26.0%
associate-*r*26.0%
*-commutative26.0%
*-commutative26.0%
associate-*l*26.0%
Simplified26.0%
if 3.09999999999999984e175 < re Initial program 62.4%
sub0-neg62.4%
Simplified62.4%
Taylor expanded in re around 0 0.1%
*-commutative0.1%
associate-*r*0.1%
distribute-rgt-out20.1%
+-commutative20.1%
*-commutative20.1%
unpow220.1%
associate-*l*20.1%
Simplified20.1%
Taylor expanded in re around inf 20.1%
*-commutative20.1%
associate-*r*20.1%
*-commutative20.1%
unpow220.1%
Simplified20.1%
Applied egg-rr37.5%
Final simplification36.8%
(FPCore (re im) :precision binary64 (if (<= re 4e+23) (- im) (* im (* 0.5 (* re re)))))
double code(double re, double im) {
double tmp;
if (re <= 4e+23) {
tmp = -im;
} else {
tmp = im * (0.5 * (re * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 4d+23) then
tmp = -im
else
tmp = im * (0.5d0 * (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 4e+23) {
tmp = -im;
} else {
tmp = im * (0.5 * (re * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 4e+23: tmp = -im else: tmp = im * (0.5 * (re * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 4e+23) tmp = Float64(-im); else tmp = Float64(im * Float64(0.5 * Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 4e+23) tmp = -im; else tmp = im * (0.5 * (re * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 4e+23], (-im), N[(im * N[(0.5 * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 4 \cdot 10^{+23}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 3.9999999999999997e23Initial program 53.5%
sub0-neg53.5%
Simplified53.5%
Taylor expanded in im around 0 53.8%
mul-1-neg53.8%
*-commutative53.8%
distribute-lft-neg-in53.8%
Simplified53.8%
Taylor expanded in re around 0 38.3%
neg-mul-138.3%
Simplified38.3%
if 3.9999999999999997e23 < re Initial program 64.9%
sub0-neg64.9%
Simplified64.9%
Taylor expanded in re around 0 0.9%
*-commutative0.9%
associate-*r*0.9%
distribute-rgt-out26.3%
+-commutative26.3%
*-commutative26.3%
unpow226.3%
associate-*l*26.3%
Simplified26.3%
Taylor expanded in re around inf 26.3%
*-commutative26.3%
associate-*r*26.3%
*-commutative26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in im around 0 23.3%
*-commutative23.3%
*-commutative23.3%
associate-*l*23.3%
unpow223.3%
Simplified23.3%
Final simplification34.8%
(FPCore (re im) :precision binary64 (if (<= re 4e+23) (- im) (* re (* im (* 0.5 re)))))
double code(double re, double im) {
double tmp;
if (re <= 4e+23) {
tmp = -im;
} else {
tmp = re * (im * (0.5 * re));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (re <= 4d+23) then
tmp = -im
else
tmp = re * (im * (0.5d0 * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (re <= 4e+23) {
tmp = -im;
} else {
tmp = re * (im * (0.5 * re));
}
return tmp;
}
def code(re, im): tmp = 0 if re <= 4e+23: tmp = -im else: tmp = re * (im * (0.5 * re)) return tmp
function code(re, im) tmp = 0.0 if (re <= 4e+23) tmp = Float64(-im); else tmp = Float64(re * Float64(im * Float64(0.5 * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (re <= 4e+23) tmp = -im; else tmp = re * (im * (0.5 * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[re, 4e+23], (-im), N[(re * N[(im * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 4 \cdot 10^{+23}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(im \cdot \left(0.5 \cdot re\right)\right)\\
\end{array}
\end{array}
if re < 3.9999999999999997e23Initial program 53.5%
sub0-neg53.5%
Simplified53.5%
Taylor expanded in im around 0 53.8%
mul-1-neg53.8%
*-commutative53.8%
distribute-lft-neg-in53.8%
Simplified53.8%
Taylor expanded in re around 0 38.3%
neg-mul-138.3%
Simplified38.3%
if 3.9999999999999997e23 < re Initial program 64.9%
sub0-neg64.9%
Simplified64.9%
Taylor expanded in re around 0 0.9%
*-commutative0.9%
associate-*r*0.9%
distribute-rgt-out26.3%
+-commutative26.3%
*-commutative26.3%
unpow226.3%
associate-*l*26.3%
Simplified26.3%
Taylor expanded in re around inf 26.3%
*-commutative26.3%
associate-*r*26.3%
*-commutative26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in im around 0 23.3%
*-commutative23.3%
*-commutative23.3%
associate-*l*23.3%
unpow223.3%
Simplified23.3%
Taylor expanded in im around 0 23.3%
unpow223.3%
associate-*r*23.3%
associate-*r*23.3%
*-commutative23.3%
*-commutative23.3%
associate-*l*23.3%
Simplified23.3%
Final simplification34.8%
(FPCore (re im) :precision binary64 (- im))
double code(double re, double im) {
return -im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = -im
end function
public static double code(double re, double im) {
return -im;
}
def code(re, im): return -im
function code(re, im) return Float64(-im) end
function tmp = code(re, im) tmp = -im; end
code[re_, im_] := (-im)
\begin{array}{l}
\\
-im
\end{array}
Initial program 56.1%
sub0-neg56.1%
Simplified56.1%
Taylor expanded in im around 0 51.1%
mul-1-neg51.1%
*-commutative51.1%
distribute-lft-neg-in51.1%
Simplified51.1%
Taylor expanded in re around 0 31.0%
neg-mul-131.0%
Simplified31.0%
Final simplification31.0%
(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 2023200
(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))))