
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
def code(re, im): return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
function code(re, im) return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im))) end
function tmp = code(re, im) tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\end{array}
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (cos re))) (t_1 (- (exp (- im)) (exp im))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.001)))
(* t_0 t_1)
(*
t_0
(+
(* im -2.0)
(+
(* -0.016666666666666666 (pow im 5.0))
(* -0.3333333333333333 (pow im 3.0))))))))
double code(double re, double im) {
double t_0 = 0.5 * cos(re);
double t_1 = exp(-im) - exp(im);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.001)) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * ((im * -2.0) + ((-0.016666666666666666 * pow(im, 5.0)) + (-0.3333333333333333 * pow(im, 3.0))));
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = 0.5 * Math.cos(re);
double t_1 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.001)) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * ((im * -2.0) + ((-0.016666666666666666 * Math.pow(im, 5.0)) + (-0.3333333333333333 * Math.pow(im, 3.0))));
}
return tmp;
}
def code(re, im): t_0 = 0.5 * math.cos(re) t_1 = math.exp(-im) - math.exp(im) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.001): tmp = t_0 * t_1 else: tmp = t_0 * ((im * -2.0) + ((-0.016666666666666666 * math.pow(im, 5.0)) + (-0.3333333333333333 * math.pow(im, 3.0)))) return tmp
function code(re, im) t_0 = Float64(0.5 * cos(re)) t_1 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.001)) tmp = Float64(t_0 * t_1); else tmp = Float64(t_0 * Float64(Float64(im * -2.0) + Float64(Float64(-0.016666666666666666 * (im ^ 5.0)) + Float64(-0.3333333333333333 * (im ^ 3.0))))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * cos(re); t_1 = exp(-im) - exp(im); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.001))) tmp = t_0 * t_1; else tmp = t_0 * ((im * -2.0) + ((-0.016666666666666666 * (im ^ 5.0)) + (-0.3333333333333333 * (im ^ 3.0)))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.001]], $MachinePrecision]], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$0 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(-0.016666666666666666 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-0.3333333333333333 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \cos re\\
t_1 := e^{-im} - e^{im}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.001\right):\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(im \cdot -2 + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 1e-3 < (-.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)) < 1e-3Initial program 6.3%
sub0-neg6.3%
Simplified6.3%
Taylor expanded in im around 0 99.7%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.001)))
(* (* 0.5 (cos re)) t_0)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im)))))
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.001)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -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 <= 0.001)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
}
return tmp;
}
def code(re, im): t_0 = math.exp(-im) - math.exp(im) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.001): tmp = (0.5 * math.cos(re)) * t_0 else: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) return tmp
function code(re, im) t_0 = Float64(exp(Float64(-im)) - exp(im)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.001)) tmp = Float64(Float64(0.5 * cos(re)) * t_0); else tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); end return tmp end
function tmp_2 = code(re, im) t_0 = exp(-im) - exp(im); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.001))) tmp = (0.5 * cos(re)) * t_0; else tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 (-.f64 0 im)) (exp.f64 im)) < -inf.0 or 1e-3 < (-.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)) < 1e-3Initial program 6.3%
sub0-neg6.3%
Simplified6.3%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-lft-out--99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (- (* (pow im 3.0) -0.16666666666666666) im))
(t_2 (* t_1 (+ (* (* re re) -0.5) 1.0))))
(if (<= im -3e+205)
t_2
(if (<= im -0.00132)
t_0
(if (<= im 0.00044)
(* im (- (cos re)))
(if (<= im 1.05e+189) t_0 (if (<= im 1e+219) t_2 t_1)))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = (pow(im, 3.0) * -0.16666666666666666) - im;
double t_2 = t_1 * (((re * re) * -0.5) + 1.0);
double tmp;
if (im <= -3e+205) {
tmp = t_2;
} else if (im <= -0.00132) {
tmp = t_0;
} else if (im <= 0.00044) {
tmp = im * -cos(re);
} else if (im <= 1.05e+189) {
tmp = t_0;
} else if (im <= 1e+219) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
t_2 = t_1 * (((re * re) * (-0.5d0)) + 1.0d0)
if (im <= (-3d+205)) then
tmp = t_2
else if (im <= (-0.00132d0)) then
tmp = t_0
else if (im <= 0.00044d0) then
tmp = im * -cos(re)
else if (im <= 1.05d+189) then
tmp = t_0
else if (im <= 1d+219) then
tmp = t_2
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, 3.0) * -0.16666666666666666) - im;
double t_2 = t_1 * (((re * re) * -0.5) + 1.0);
double tmp;
if (im <= -3e+205) {
tmp = t_2;
} else if (im <= -0.00132) {
tmp = t_0;
} else if (im <= 0.00044) {
tmp = im * -Math.cos(re);
} else if (im <= 1.05e+189) {
tmp = t_0;
} else if (im <= 1e+219) {
tmp = t_2;
} 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, 3.0) * -0.16666666666666666) - im t_2 = t_1 * (((re * re) * -0.5) + 1.0) tmp = 0 if im <= -3e+205: tmp = t_2 elif im <= -0.00132: tmp = t_0 elif im <= 0.00044: tmp = im * -math.cos(re) elif im <= 1.05e+189: tmp = t_0 elif im <= 1e+219: tmp = t_2 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) t_2 = Float64(t_1 * Float64(Float64(Float64(re * re) * -0.5) + 1.0)) tmp = 0.0 if (im <= -3e+205) tmp = t_2; elseif (im <= -0.00132) tmp = t_0; elseif (im <= 0.00044) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 1.05e+189) tmp = t_0; elseif (im <= 1e+219) tmp = t_2; 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 ^ 3.0) * -0.16666666666666666) - im; t_2 = t_1 * (((re * re) * -0.5) + 1.0); tmp = 0.0; if (im <= -3e+205) tmp = t_2; elseif (im <= -0.00132) tmp = t_0; elseif (im <= 0.00044) tmp = im * -cos(re); elseif (im <= 1.05e+189) tmp = t_0; elseif (im <= 1e+219) tmp = t_2; 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[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3e+205], t$95$2, If[LessEqual[im, -0.00132], t$95$0, If[LessEqual[im, 0.00044], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 1.05e+189], t$95$0, If[LessEqual[im, 1e+219], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_2 := t_1 \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\mathbf{if}\;im \leq -3 \cdot 10^{+205}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -0.00132:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.00044:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.05 \cdot 10^{+189}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 10^{+219}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -2.9999999999999999e205 or 1.04999999999999996e189 < im < 9.99999999999999965e218Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
associate--l+0.0%
associate-*r*0.0%
distribute-lft1-in93.1%
*-commutative93.1%
unpow293.1%
*-commutative93.1%
Simplified93.1%
if -2.9999999999999999e205 < im < -0.00132 or 4.40000000000000016e-4 < im < 1.04999999999999996e189Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 83.9%
if -0.00132 < im < 4.40000000000000016e-4Initial program 6.3%
sub0-neg6.3%
Simplified6.3%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
*-commutative99.4%
distribute-lft-neg-in99.4%
Simplified99.4%
if 9.99999999999999965e218 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in re around 0 95.0%
*-commutative95.0%
Simplified95.0%
Final simplification92.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* (pow im 5.0) (* (cos re) -0.008333333333333333))))
(if (<= im -6.5e+97)
t_1
(if (<= im -0.00132)
t_0
(if (<= im 0.029) (* im (- (cos re))) (if (<= im 5e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = pow(im, 5.0) * (cos(re) * -0.008333333333333333);
double tmp;
if (im <= -6.5e+97) {
tmp = t_1;
} else if (im <= -0.00132) {
tmp = t_0;
} else if (im <= 0.029) {
tmp = im * -cos(re);
} else if (im <= 5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (im ** 5.0d0) * (cos(re) * (-0.008333333333333333d0))
if (im <= (-6.5d+97)) then
tmp = t_1
else if (im <= (-0.00132d0)) then
tmp = t_0
else if (im <= 0.029d0) then
tmp = im * -cos(re)
else if (im <= 5d+61) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = Math.pow(im, 5.0) * (Math.cos(re) * -0.008333333333333333);
double tmp;
if (im <= -6.5e+97) {
tmp = t_1;
} else if (im <= -0.00132) {
tmp = t_0;
} else if (im <= 0.029) {
tmp = im * -Math.cos(re);
} else if (im <= 5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = math.pow(im, 5.0) * (math.cos(re) * -0.008333333333333333) tmp = 0 if im <= -6.5e+97: tmp = t_1 elif im <= -0.00132: tmp = t_0 elif im <= 0.029: tmp = im * -math.cos(re) elif im <= 5e+61: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64((im ^ 5.0) * Float64(cos(re) * -0.008333333333333333)) tmp = 0.0 if (im <= -6.5e+97) tmp = t_1; elseif (im <= -0.00132) tmp = t_0; elseif (im <= 0.029) tmp = Float64(im * Float64(-cos(re))); elseif (im <= 5e+61) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = (im ^ 5.0) * (cos(re) * -0.008333333333333333); tmp = 0.0; if (im <= -6.5e+97) tmp = t_1; elseif (im <= -0.00132) tmp = t_0; elseif (im <= 0.029) tmp = im * -cos(re); elseif (im <= 5e+61) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 5.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.5e+97], t$95$1, If[LessEqual[im, -0.00132], t$95$0, If[LessEqual[im, 0.029], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], If[LessEqual[im, 5e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{5} \cdot \left(\cos re \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -6.5 \cdot 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00132:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.029:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -6.4999999999999999e97 or 5.00000000000000018e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -6.4999999999999999e97 < im < -0.00132 or 0.0290000000000000015 < im < 5.00000000000000018e61Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 90.3%
if -0.00132 < im < 0.0290000000000000015Initial program 6.3%
sub0-neg6.3%
Simplified6.3%
Taylor expanded in im around 0 99.4%
mul-1-neg99.4%
*-commutative99.4%
distribute-lft-neg-in99.4%
Simplified99.4%
Final simplification98.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (- (exp (- im)) (exp im))))
(t_1 (* (pow im 5.0) (* (cos re) -0.008333333333333333))))
(if (<= im -6.5e+97)
t_1
(if (<= im -0.068)
t_0
(if (<= im 0.052)
(* (cos re) (- (* (pow im 3.0) -0.16666666666666666) im))
(if (<= im 4.5e+61) t_0 t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (exp(-im) - exp(im));
double t_1 = pow(im, 5.0) * (cos(re) * -0.008333333333333333);
double tmp;
if (im <= -6.5e+97) {
tmp = t_1;
} else if (im <= -0.068) {
tmp = t_0;
} else if (im <= 0.052) {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (exp(-im) - exp(im))
t_1 = (im ** 5.0d0) * (cos(re) * (-0.008333333333333333d0))
if (im <= (-6.5d+97)) then
tmp = t_1
else if (im <= (-0.068d0)) then
tmp = t_0
else if (im <= 0.052d0) then
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) - im)
else if (im <= 4.5d+61) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (Math.exp(-im) - Math.exp(im));
double t_1 = Math.pow(im, 5.0) * (Math.cos(re) * -0.008333333333333333);
double tmp;
if (im <= -6.5e+97) {
tmp = t_1;
} else if (im <= -0.068) {
tmp = t_0;
} else if (im <= 0.052) {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) - im);
} else if (im <= 4.5e+61) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (math.exp(-im) - math.exp(im)) t_1 = math.pow(im, 5.0) * (math.cos(re) * -0.008333333333333333) tmp = 0 if im <= -6.5e+97: tmp = t_1 elif im <= -0.068: tmp = t_0 elif im <= 0.052: tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) - im) elif im <= 4.5e+61: tmp = t_0 else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(exp(Float64(-im)) - exp(im))) t_1 = Float64((im ^ 5.0) * Float64(cos(re) * -0.008333333333333333)) tmp = 0.0 if (im <= -6.5e+97) tmp = t_1; elseif (im <= -0.068) tmp = t_0; elseif (im <= 0.052) tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im)); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (exp(-im) - exp(im)); t_1 = (im ^ 5.0) * (cos(re) * -0.008333333333333333); tmp = 0.0; if (im <= -6.5e+97) tmp = t_1; elseif (im <= -0.068) tmp = t_0; elseif (im <= 0.052) tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) - im); elseif (im <= 4.5e+61) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[im, 5.0], $MachinePrecision] * N[(N[Cos[re], $MachinePrecision] * -0.008333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -6.5e+97], t$95$1, If[LessEqual[im, -0.068], t$95$0, If[LessEqual[im, 0.052], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.5e+61], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{5} \cdot \left(\cos re \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -6.5 \cdot 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.068:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.052:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < -6.4999999999999999e97 or 4.5e61 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Taylor expanded in im around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -6.4999999999999999e97 < im < -0.068000000000000005 or 0.0519999999999999976 < im < 4.5e61Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 90.3%
if -0.068000000000000005 < im < 0.0519999999999999976Initial program 6.3%
sub0-neg6.3%
Simplified6.3%
Taylor expanded in im around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
associate-*l*99.7%
distribute-lft-out--99.7%
Simplified99.7%
Final simplification98.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (* (pow im 3.0) -0.16666666666666666) im)))
(if (<= im -5e+214)
(* t_0 (+ (* (* re re) -0.5) 1.0))
(if (or (<= im -2.65e+44) (not (<= im 8.5e+48)))
t_0
(* im (- (cos re)))))))
double code(double re, double im) {
double t_0 = (pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -5e+214) {
tmp = t_0 * (((re * re) * -0.5) + 1.0);
} else if ((im <= -2.65e+44) || !(im <= 8.5e+48)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
if (im <= (-5d+214)) then
tmp = t_0 * (((re * re) * (-0.5d0)) + 1.0d0)
else if ((im <= (-2.65d+44)) .or. (.not. (im <= 8.5d+48))) then
tmp = t_0
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
double tmp;
if (im <= -5e+214) {
tmp = t_0 * (((re * re) * -0.5) + 1.0);
} else if ((im <= -2.65e+44) || !(im <= 8.5e+48)) {
tmp = t_0;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): t_0 = (math.pow(im, 3.0) * -0.16666666666666666) - im tmp = 0 if im <= -5e+214: tmp = t_0 * (((re * re) * -0.5) + 1.0) elif (im <= -2.65e+44) or not (im <= 8.5e+48): tmp = t_0 else: tmp = im * -math.cos(re) return tmp
function code(re, im) t_0 = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im) tmp = 0.0 if (im <= -5e+214) tmp = Float64(t_0 * Float64(Float64(Float64(re * re) * -0.5) + 1.0)); elseif ((im <= -2.65e+44) || !(im <= 8.5e+48)) tmp = t_0; else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) t_0 = ((im ^ 3.0) * -0.16666666666666666) - im; tmp = 0.0; if (im <= -5e+214) tmp = t_0 * (((re * re) * -0.5) + 1.0); elseif ((im <= -2.65e+44) || ~((im <= 8.5e+48))) tmp = t_0; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision]}, If[LessEqual[im, -5e+214], N[(t$95$0 * N[(N[(N[(re * re), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, -2.65e+44], N[Not[LessEqual[im, 8.5e+48]], $MachinePrecision]], t$95$0, N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -5 \cdot 10^{+214}:\\
\;\;\;\;t_0 \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\mathbf{elif}\;im \leq -2.65 \cdot 10^{+44} \lor \neg \left(im \leq 8.5 \cdot 10^{+48}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -4.99999999999999953e214Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
associate-*l*100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
associate--l+0.0%
associate-*r*0.0%
distribute-lft1-in90.5%
*-commutative90.5%
unpow290.5%
*-commutative90.5%
Simplified90.5%
if -4.99999999999999953e214 < im < -2.65e44 or 8.5000000000000001e48 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 74.4%
mul-1-neg74.4%
unsub-neg74.4%
*-commutative74.4%
associate-*l*74.4%
distribute-lft-out--74.4%
Simplified74.4%
Taylor expanded in re around 0 60.4%
*-commutative60.4%
Simplified60.4%
if -2.65e44 < im < 8.5000000000000001e48Initial program 15.3%
sub0-neg15.3%
Simplified15.3%
Taylor expanded in im around 0 90.2%
mul-1-neg90.2%
*-commutative90.2%
distribute-lft-neg-in90.2%
Simplified90.2%
Final simplification77.5%
(FPCore (re im)
:precision binary64
(if (<= im -7.6e+167)
(- (* 0.5 (* re (* im re))) im)
(if (<= im -4.1e+18)
(* (* re re) 0.75)
(if (<= im 680.0) (* im (- (cos re))) (* (* re re) -6.75)))))
double code(double re, double im) {
double tmp;
if (im <= -7.6e+167) {
tmp = (0.5 * (re * (im * re))) - im;
} else if (im <= -4.1e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 680.0) {
tmp = im * -cos(re);
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-7.6d+167)) then
tmp = (0.5d0 * (re * (im * re))) - im
else if (im <= (-4.1d+18)) then
tmp = (re * re) * 0.75d0
else if (im <= 680.0d0) then
tmp = im * -cos(re)
else
tmp = (re * re) * (-6.75d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -7.6e+167) {
tmp = (0.5 * (re * (im * re))) - im;
} else if (im <= -4.1e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 680.0) {
tmp = im * -Math.cos(re);
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -7.6e+167: tmp = (0.5 * (re * (im * re))) - im elif im <= -4.1e+18: tmp = (re * re) * 0.75 elif im <= 680.0: tmp = im * -math.cos(re) else: tmp = (re * re) * -6.75 return tmp
function code(re, im) tmp = 0.0 if (im <= -7.6e+167) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); elseif (im <= -4.1e+18) tmp = Float64(Float64(re * re) * 0.75); elseif (im <= 680.0) tmp = Float64(im * Float64(-cos(re))); else tmp = Float64(Float64(re * re) * -6.75); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -7.6e+167) tmp = (0.5 * (re * (im * re))) - im; elseif (im <= -4.1e+18) tmp = (re * re) * 0.75; elseif (im <= 680.0) tmp = im * -cos(re); else tmp = (re * re) * -6.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -7.6e+167], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[im, -4.1e+18], N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision], If[LessEqual[im, 680.0], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision], N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -7.6 \cdot 10^{+167}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq -4.1 \cdot 10^{+18}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 680:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\end{array}
\end{array}
if im < -7.59999999999999987e167Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.0%
mul-1-neg7.0%
*-commutative7.0%
distribute-lft-neg-in7.0%
Simplified7.0%
Taylor expanded in re around 0 43.1%
mul-1-neg43.1%
+-commutative43.1%
unsub-neg43.1%
unpow243.1%
associate-*l*43.1%
Simplified43.1%
if -7.59999999999999987e167 < im < -4.1e18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out55.6%
+-commutative55.6%
*-commutative55.6%
unpow255.6%
associate-*l*55.6%
Simplified55.6%
Applied egg-rr26.3%
Taylor expanded in re around inf 26.9%
*-commutative26.9%
unpow226.9%
Simplified26.9%
if -4.1e18 < im < 680Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 97.7%
mul-1-neg97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
Simplified97.7%
if 680 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out71.6%
+-commutative71.6%
*-commutative71.6%
unpow271.6%
associate-*l*71.6%
Simplified71.6%
Taylor expanded in re around inf 16.2%
associate-*r*16.2%
*-commutative16.2%
unpow216.2%
Simplified16.2%
Applied egg-rr19.2%
Final simplification58.7%
(FPCore (re im) :precision binary64 (if (or (<= im -1.32e+47) (not (<= im 9e+46))) (- (* (pow im 3.0) -0.16666666666666666) im) (* im (- (cos re)))))
double code(double re, double im) {
double tmp;
if ((im <= -1.32e+47) || !(im <= 9e+46)) {
tmp = (pow(im, 3.0) * -0.16666666666666666) - im;
} else {
tmp = im * -cos(re);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((im <= (-1.32d+47)) .or. (.not. (im <= 9d+46))) then
tmp = ((im ** 3.0d0) * (-0.16666666666666666d0)) - im
else
tmp = im * -cos(re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((im <= -1.32e+47) || !(im <= 9e+46)) {
tmp = (Math.pow(im, 3.0) * -0.16666666666666666) - im;
} else {
tmp = im * -Math.cos(re);
}
return tmp;
}
def code(re, im): tmp = 0 if (im <= -1.32e+47) or not (im <= 9e+46): tmp = (math.pow(im, 3.0) * -0.16666666666666666) - im else: tmp = im * -math.cos(re) return tmp
function code(re, im) tmp = 0.0 if ((im <= -1.32e+47) || !(im <= 9e+46)) tmp = Float64(Float64((im ^ 3.0) * -0.16666666666666666) - im); else tmp = Float64(im * Float64(-cos(re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((im <= -1.32e+47) || ~((im <= 9e+46))) tmp = ((im ^ 3.0) * -0.16666666666666666) - im; else tmp = im * -cos(re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[im, -1.32e+47], N[Not[LessEqual[im, 9e+46]], $MachinePrecision]], N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - im), $MachinePrecision], N[(im * (-N[Cos[re], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.32 \cdot 10^{+47} \lor \neg \left(im \leq 9 \cdot 10^{+46}\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\end{array}
if im < -1.31999999999999992e47 or 9.00000000000000019e46 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 78.5%
mul-1-neg78.5%
unsub-neg78.5%
*-commutative78.5%
associate-*l*78.5%
distribute-lft-out--78.5%
Simplified78.5%
Taylor expanded in re around 0 59.8%
*-commutative59.8%
Simplified59.8%
if -1.31999999999999992e47 < im < 9.00000000000000019e46Initial program 15.3%
sub0-neg15.3%
Simplified15.3%
Taylor expanded in im around 0 90.2%
mul-1-neg90.2%
*-commutative90.2%
distribute-lft-neg-in90.2%
Simplified90.2%
Final simplification74.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (* re re) -6.75)))
(if (<= im -5.6e+172)
t_0
(if (<= im -4.1e+18) (* (* re re) 0.75) (if (<= im 500.0) (- im) t_0)))))
double code(double re, double im) {
double t_0 = (re * re) * -6.75;
double tmp;
if (im <= -5.6e+172) {
tmp = t_0;
} else if (im <= -4.1e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 500.0) {
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 = (re * re) * (-6.75d0)
if (im <= (-5.6d+172)) then
tmp = t_0
else if (im <= (-4.1d+18)) then
tmp = (re * re) * 0.75d0
else if (im <= 500.0d0) then
tmp = -im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (re * re) * -6.75;
double tmp;
if (im <= -5.6e+172) {
tmp = t_0;
} else if (im <= -4.1e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 500.0) {
tmp = -im;
} else {
tmp = t_0;
}
return tmp;
}
def code(re, im): t_0 = (re * re) * -6.75 tmp = 0 if im <= -5.6e+172: tmp = t_0 elif im <= -4.1e+18: tmp = (re * re) * 0.75 elif im <= 500.0: tmp = -im else: tmp = t_0 return tmp
function code(re, im) t_0 = Float64(Float64(re * re) * -6.75) tmp = 0.0 if (im <= -5.6e+172) tmp = t_0; elseif (im <= -4.1e+18) tmp = Float64(Float64(re * re) * 0.75); elseif (im <= 500.0) tmp = Float64(-im); else tmp = t_0; end return tmp end
function tmp_2 = code(re, im) t_0 = (re * re) * -6.75; tmp = 0.0; if (im <= -5.6e+172) tmp = t_0; elseif (im <= -4.1e+18) tmp = (re * re) * 0.75; elseif (im <= 500.0) tmp = -im; else tmp = t_0; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]}, If[LessEqual[im, -5.6e+172], t$95$0, If[LessEqual[im, -4.1e+18], N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision], If[LessEqual[im, 500.0], (-im), t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(re \cdot re\right) \cdot -6.75\\
\mathbf{if}\;im \leq -5.6 \cdot 10^{+172}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -4.1 \cdot 10^{+18}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 500:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if im < -5.5999999999999999e172 or 500 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out74.8%
+-commutative74.8%
*-commutative74.8%
unpow274.8%
associate-*l*74.8%
Simplified74.8%
Taylor expanded in re around inf 23.3%
associate-*r*23.3%
*-commutative23.3%
unpow223.3%
Simplified23.3%
Applied egg-rr21.1%
if -5.5999999999999999e172 < im < -4.1e18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out56.8%
+-commutative56.8%
*-commutative56.8%
unpow256.8%
associate-*l*56.8%
Simplified56.8%
Applied egg-rr25.6%
Taylor expanded in re around inf 26.2%
*-commutative26.2%
unpow226.2%
Simplified26.2%
if -4.1e18 < im < 500Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 97.7%
mul-1-neg97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
Simplified97.7%
Taylor expanded in re around 0 54.0%
mul-1-neg54.0%
Simplified54.0%
Final simplification36.8%
(FPCore (re im)
:precision binary64
(if (<= im -1.45e+173)
(* (* re re) (* im 0.5))
(if (<= im -4.6e+18)
(* (* re re) 0.75)
(if (<= im 580.0) (- im) (* (* re re) -6.75)))))
double code(double re, double im) {
double tmp;
if (im <= -1.45e+173) {
tmp = (re * re) * (im * 0.5);
} else if (im <= -4.6e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 580.0) {
tmp = -im;
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-1.45d+173)) then
tmp = (re * re) * (im * 0.5d0)
else if (im <= (-4.6d+18)) then
tmp = (re * re) * 0.75d0
else if (im <= 580.0d0) then
tmp = -im
else
tmp = (re * re) * (-6.75d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -1.45e+173) {
tmp = (re * re) * (im * 0.5);
} else if (im <= -4.6e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 580.0) {
tmp = -im;
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -1.45e+173: tmp = (re * re) * (im * 0.5) elif im <= -4.6e+18: tmp = (re * re) * 0.75 elif im <= 580.0: tmp = -im else: tmp = (re * re) * -6.75 return tmp
function code(re, im) tmp = 0.0 if (im <= -1.45e+173) tmp = Float64(Float64(re * re) * Float64(im * 0.5)); elseif (im <= -4.6e+18) tmp = Float64(Float64(re * re) * 0.75); elseif (im <= 580.0) tmp = Float64(-im); else tmp = Float64(Float64(re * re) * -6.75); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -1.45e+173) tmp = (re * re) * (im * 0.5); elseif (im <= -4.6e+18) tmp = (re * re) * 0.75; elseif (im <= 580.0) tmp = -im; else tmp = (re * re) * -6.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -1.45e+173], N[(N[(re * re), $MachinePrecision] * N[(im * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -4.6e+18], N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision], If[LessEqual[im, 580.0], (-im), N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -1.45 \cdot 10^{+173}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(im \cdot 0.5\right)\\
\mathbf{elif}\;im \leq -4.6 \cdot 10^{+18}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 580:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\end{array}
\end{array}
if im < -1.45000000000000003e173Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out82.8%
+-commutative82.8%
*-commutative82.8%
unpow282.8%
associate-*l*82.8%
Simplified82.8%
Taylor expanded in re around inf 41.4%
associate-*r*41.4%
*-commutative41.4%
unpow241.4%
Simplified41.4%
Taylor expanded in im around 0 41.9%
*-commutative41.9%
associate-*l*41.9%
unpow241.9%
Simplified41.9%
if -1.45000000000000003e173 < im < -4.6e18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out56.8%
+-commutative56.8%
*-commutative56.8%
unpow256.8%
associate-*l*56.8%
Simplified56.8%
Applied egg-rr25.6%
Taylor expanded in re around inf 26.2%
*-commutative26.2%
unpow226.2%
Simplified26.2%
if -4.6e18 < im < 580Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 97.7%
mul-1-neg97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
Simplified97.7%
Taylor expanded in re around 0 54.0%
mul-1-neg54.0%
Simplified54.0%
if 580 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out71.6%
+-commutative71.6%
*-commutative71.6%
unpow271.6%
associate-*l*71.6%
Simplified71.6%
Taylor expanded in re around inf 16.2%
associate-*r*16.2%
*-commutative16.2%
unpow216.2%
Simplified16.2%
Applied egg-rr19.2%
Final simplification38.6%
(FPCore (re im)
:precision binary64
(if (<= im -2.3e+171)
(- (* 0.5 (* re (* im re))) im)
(if (<= im -4.1e+18)
(* (* re re) 0.75)
(if (<= im 520.0) (- im) (* (* re re) -6.75)))))
double code(double re, double im) {
double tmp;
if (im <= -2.3e+171) {
tmp = (0.5 * (re * (im * re))) - im;
} else if (im <= -4.1e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 520.0) {
tmp = -im;
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if (im <= (-2.3d+171)) then
tmp = (0.5d0 * (re * (im * re))) - im
else if (im <= (-4.1d+18)) then
tmp = (re * re) * 0.75d0
else if (im <= 520.0d0) then
tmp = -im
else
tmp = (re * re) * (-6.75d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= -2.3e+171) {
tmp = (0.5 * (re * (im * re))) - im;
} else if (im <= -4.1e+18) {
tmp = (re * re) * 0.75;
} else if (im <= 520.0) {
tmp = -im;
} else {
tmp = (re * re) * -6.75;
}
return tmp;
}
def code(re, im): tmp = 0 if im <= -2.3e+171: tmp = (0.5 * (re * (im * re))) - im elif im <= -4.1e+18: tmp = (re * re) * 0.75 elif im <= 520.0: tmp = -im else: tmp = (re * re) * -6.75 return tmp
function code(re, im) tmp = 0.0 if (im <= -2.3e+171) tmp = Float64(Float64(0.5 * Float64(re * Float64(im * re))) - im); elseif (im <= -4.1e+18) tmp = Float64(Float64(re * re) * 0.75); elseif (im <= 520.0) tmp = Float64(-im); else tmp = Float64(Float64(re * re) * -6.75); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= -2.3e+171) tmp = (0.5 * (re * (im * re))) - im; elseif (im <= -4.1e+18) tmp = (re * re) * 0.75; elseif (im <= 520.0) tmp = -im; else tmp = (re * re) * -6.75; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, -2.3e+171], N[(N[(0.5 * N[(re * N[(im * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision], If[LessEqual[im, -4.1e+18], N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision], If[LessEqual[im, 520.0], (-im), N[(N[(re * re), $MachinePrecision] * -6.75), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq -2.3 \cdot 10^{+171}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq -4.1 \cdot 10^{+18}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 520:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\end{array}
\end{array}
if im < -2.30000000000000017e171Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 7.0%
mul-1-neg7.0%
*-commutative7.0%
distribute-lft-neg-in7.0%
Simplified7.0%
Taylor expanded in re around 0 43.1%
mul-1-neg43.1%
+-commutative43.1%
unsub-neg43.1%
unpow243.1%
associate-*l*43.1%
Simplified43.1%
if -2.30000000000000017e171 < im < -4.1e18Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out55.6%
+-commutative55.6%
*-commutative55.6%
unpow255.6%
associate-*l*55.6%
Simplified55.6%
Applied egg-rr26.3%
Taylor expanded in re around inf 26.9%
*-commutative26.9%
unpow226.9%
Simplified26.9%
if -4.1e18 < im < 520Initial program 8.0%
sub0-neg8.0%
Simplified8.0%
Taylor expanded in im around 0 97.7%
mul-1-neg97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
Simplified97.7%
Taylor expanded in re around 0 54.0%
mul-1-neg54.0%
Simplified54.0%
if 520 < im Initial program 100.0%
sub0-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out71.6%
+-commutative71.6%
*-commutative71.6%
unpow271.6%
associate-*l*71.6%
Simplified71.6%
Taylor expanded in re around inf 16.2%
associate-*r*16.2%
*-commutative16.2%
unpow216.2%
Simplified16.2%
Applied egg-rr19.2%
Final simplification38.9%
(FPCore (re im) :precision binary64 (if (or (<= re -5.2e+160) (not (<= re 1.15e+176))) (* (* re re) 0.75) (* 0.5 (* im -2.0))))
double code(double re, double im) {
double tmp;
if ((re <= -5.2e+160) || !(re <= 1.15e+176)) {
tmp = (re * re) * 0.75;
} else {
tmp = 0.5 * (im * -2.0);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((re <= (-5.2d+160)) .or. (.not. (re <= 1.15d+176))) then
tmp = (re * re) * 0.75d0
else
tmp = 0.5d0 * (im * (-2.0d0))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= -5.2e+160) || !(re <= 1.15e+176)) {
tmp = (re * re) * 0.75;
} else {
tmp = 0.5 * (im * -2.0);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= -5.2e+160) or not (re <= 1.15e+176): tmp = (re * re) * 0.75 else: tmp = 0.5 * (im * -2.0) return tmp
function code(re, im) tmp = 0.0 if ((re <= -5.2e+160) || !(re <= 1.15e+176)) tmp = Float64(Float64(re * re) * 0.75); else tmp = Float64(0.5 * Float64(im * -2.0)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= -5.2e+160) || ~((re <= 1.15e+176))) tmp = (re * re) * 0.75; else tmp = 0.5 * (im * -2.0); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, -5.2e+160], N[Not[LessEqual[re, 1.15e+176]], $MachinePrecision]], N[(N[(re * re), $MachinePrecision] * 0.75), $MachinePrecision], N[(0.5 * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -5.2 \cdot 10^{+160} \lor \neg \left(re \leq 1.15 \cdot 10^{+176}\right):\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(im \cdot -2\right)\\
\end{array}
\end{array}
if re < -5.2000000000000001e160 or 1.14999999999999998e176 < re Initial program 63.3%
sub0-neg63.3%
Simplified63.3%
Taylor expanded in re around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out23.7%
+-commutative23.7%
*-commutative23.7%
unpow223.7%
associate-*l*23.7%
Simplified23.7%
Applied egg-rr27.7%
Taylor expanded in re around inf 27.7%
*-commutative27.7%
unpow227.7%
Simplified27.7%
if -5.2000000000000001e160 < re < 1.14999999999999998e176Initial program 56.8%
sub0-neg56.8%
Simplified56.8%
Taylor expanded in re around 0 48.2%
Taylor expanded in im around 0 33.0%
Final simplification31.8%
(FPCore (re im) :precision binary64 (* 0.5 (* im -2.0)))
double code(double re, double im) {
return 0.5 * (im * -2.0);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.5d0 * (im * (-2.0d0))
end function
public static double code(double re, double im) {
return 0.5 * (im * -2.0);
}
def code(re, im): return 0.5 * (im * -2.0)
function code(re, im) return Float64(0.5 * Float64(im * -2.0)) end
function tmp = code(re, im) tmp = 0.5 * (im * -2.0); end
code[re_, im_] := N[(0.5 * N[(im * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(im \cdot -2\right)
\end{array}
Initial program 58.3%
sub0-neg58.3%
Simplified58.3%
Taylor expanded in re around 0 46.3%
Taylor expanded in im around 0 27.2%
Final simplification27.2%
(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 58.3%
sub0-neg58.3%
Simplified58.3%
Taylor expanded in im around 0 47.3%
mul-1-neg47.3%
*-commutative47.3%
distribute-lft-neg-in47.3%
Simplified47.3%
Taylor expanded in re around 0 26.9%
mul-1-neg26.9%
Simplified26.9%
Final simplification26.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 58.3%
sub0-neg58.3%
Simplified58.3%
Taylor expanded in re around 0 2.0%
*-commutative2.0%
associate-*r*2.0%
distribute-rgt-out41.0%
+-commutative41.0%
*-commutative41.0%
unpow241.0%
associate-*l*41.0%
Simplified41.0%
Applied egg-rr8.5%
Taylor expanded in re around 0 2.9%
Final simplification2.9%
(FPCore (re im) :precision binary64 0.0)
double code(double re, double im) {
return 0.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.0d0
end function
public static double code(double re, double im) {
return 0.0;
}
def code(re, im): return 0.0
function code(re, im) return 0.0 end
function tmp = code(re, im) tmp = 0.0; end
code[re_, im_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 58.3%
sub0-neg58.3%
Simplified58.3%
Taylor expanded in re around 0 2.0%
*-commutative2.0%
associate-*r*2.0%
distribute-rgt-out41.0%
+-commutative41.0%
*-commutative41.0%
unpow241.0%
associate-*l*41.0%
Simplified41.0%
Taylor expanded in re around inf 13.7%
associate-*r*13.7%
*-commutative13.7%
unpow213.7%
Simplified13.7%
expm1-log1p-u6.6%
expm1-udef6.6%
associate-*l*7.2%
add-sqr-sqrt1.3%
sqrt-unprod2.5%
sqr-neg2.5%
sqrt-unprod1.2%
add-sqr-sqrt2.9%
Applied egg-rr2.9%
expm1-def2.9%
expm1-log1p2.9%
associate-*r*2.3%
unpow22.3%
+-inverses2.6%
metadata-eval2.6%
mul0-rgt3.4%
Simplified3.4%
Final simplification3.4%
(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 2023196
(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))))