
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(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 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[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 \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))
double code(double re, double im) {
return (0.5 * sin(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 * sin(re)) * (exp((0.0d0 - im)) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.sin(re)) * (Math.exp((0.0 - im)) + Math.exp(im));
}
def code(re, im): return (0.5 * math.sin(re)) * (math.exp((0.0 - im)) + math.exp(im))
function code(re, im) return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) end
function tmp = code(re, im) tmp = (0.5 * sin(re)) * (exp((0.0 - im)) + exp(im)); end
code[re_, im_] := N[(N[(0.5 * N[Sin[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 \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right)
\end{array}
(FPCore (re im) :precision binary64 (* (+ (exp (- im)) (exp im)) (* 0.5 (sin re))))
double code(double re, double im) {
return (exp(-im) + exp(im)) * (0.5 * sin(re));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (exp(-im) + exp(im)) * (0.5d0 * sin(re))
end function
public static double code(double re, double im) {
return (Math.exp(-im) + Math.exp(im)) * (0.5 * Math.sin(re));
}
def code(re, im): return (math.exp(-im) + math.exp(im)) * (0.5 * math.sin(re))
function code(re, im) return Float64(Float64(exp(Float64(-im)) + exp(im)) * Float64(0.5 * sin(re))) end
function tmp = code(re, im) tmp = (exp(-im) + exp(im)) * (0.5 * sin(re)); end
code[re_, im_] := N[(N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(e^{-im} + e^{im}\right) \cdot \left(0.5 \cdot \sin re\right)
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im im))) (t_1 (* (sin re) (+ t_0 1.0))))
(if (<= im 1000.0)
t_1
(if (<= im 9.5e+112)
(* (* 0.5 re) (+ (exp (- im)) (exp im)))
(if (<= im 5.4e+133)
(*
(fma im (* 0.5 im) 1.0)
(+ re (* -0.16666666666666666 (pow re 3.0))))
(if (<= im 1.4e+154)
(/ re (/ (- 1.0 t_0) (+ 1.0 (* -0.25 (pow im 4.0)))))
t_1))))))
double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = sin(re) * (t_0 + 1.0);
double tmp;
if (im <= 1000.0) {
tmp = t_1;
} else if (im <= 9.5e+112) {
tmp = (0.5 * re) * (exp(-im) + exp(im));
} else if (im <= 5.4e+133) {
tmp = fma(im, (0.5 * im), 1.0) * (re + (-0.16666666666666666 * pow(re, 3.0)));
} else if (im <= 1.4e+154) {
tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * pow(im, 4.0))));
} else {
tmp = t_1;
}
return tmp;
}
function code(re, im) t_0 = Float64(0.5 * Float64(im * im)) t_1 = Float64(sin(re) * Float64(t_0 + 1.0)) tmp = 0.0 if (im <= 1000.0) tmp = t_1; elseif (im <= 9.5e+112) tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) + exp(im))); elseif (im <= 5.4e+133) tmp = Float64(fma(im, Float64(0.5 * im), 1.0) * Float64(re + Float64(-0.16666666666666666 * (re ^ 3.0)))); elseif (im <= 1.4e+154) tmp = Float64(re / Float64(Float64(1.0 - t_0) / Float64(1.0 + Float64(-0.25 * (im ^ 4.0))))); else tmp = t_1; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[re], $MachinePrecision] * N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 1000.0], t$95$1, If[LessEqual[im, 9.5e+112], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.4e+133], N[(N[(im * N[(0.5 * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re + N[(-0.16666666666666666 * N[Power[re, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.4e+154], N[(re / N[(N[(1.0 - t$95$0), $MachinePrecision] / N[(1.0 + N[(-0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right)\\
t_1 := \sin re \cdot \left(t_0 + 1\right)\\
\mathbf{if}\;im \leq 1000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{fma}\left(im, 0.5 \cdot im, 1\right) \cdot \left(re + -0.16666666666666666 \cdot {re}^{3}\right)\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{re}{\frac{1 - t_0}{1 + -0.25 \cdot {im}^{4}}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < 1e3 or 1.4e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 1e3 < im < 9.5000000000000008e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 82.9%
Simplified82.9%
if 9.5000000000000008e112 < im < 5.4000000000000004e133Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.4%
Simplified6.4%
Taylor expanded in re around 0 0.9%
+-commutative0.9%
associate-*r*0.9%
distribute-rgt-out75.9%
+-commutative75.9%
unpow275.9%
associate-*r*75.9%
*-commutative75.9%
fma-udef75.9%
Simplified75.9%
if 5.4000000000000004e133 < im < 1.4e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
Simplified5.7%
Taylor expanded in re around 0 3.5%
unpow23.5%
Simplified3.5%
flip-+80.0%
associate-*r/80.0%
metadata-eval80.0%
swap-sqr80.0%
metadata-eval80.0%
pow280.0%
pow280.0%
pow-prod-up80.0%
metadata-eval80.0%
*-commutative80.0%
associate-*r*80.0%
Applied egg-rr80.0%
associate-/l*80.0%
*-commutative80.0%
*-commutative80.0%
associate-*r*80.0%
cancel-sign-sub-inv80.0%
metadata-eval80.0%
Simplified80.0%
Final simplification85.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im im))) (t_1 (+ t_0 1.0)) (t_2 (* (sin re) t_1)))
(if (<= im 1000.0)
t_2
(if (<= im 9.5e+112)
(* (* 0.5 re) (+ (exp (- im)) (exp im)))
(if (<= im 5.4e+133)
(* -0.16666666666666666 (* (pow re 3.0) t_1))
(if (<= im 1.4e+154)
(/ re (/ (- 1.0 t_0) (+ 1.0 (* -0.25 (pow im 4.0)))))
t_2))))))
double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = t_0 + 1.0;
double t_2 = sin(re) * t_1;
double tmp;
if (im <= 1000.0) {
tmp = t_2;
} else if (im <= 9.5e+112) {
tmp = (0.5 * re) * (exp(-im) + exp(im));
} else if (im <= 5.4e+133) {
tmp = -0.16666666666666666 * (pow(re, 3.0) * t_1);
} else if (im <= 1.4e+154) {
tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * pow(im, 4.0))));
} else {
tmp = t_2;
}
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 * (im * im)
t_1 = t_0 + 1.0d0
t_2 = sin(re) * t_1
if (im <= 1000.0d0) then
tmp = t_2
else if (im <= 9.5d+112) then
tmp = (0.5d0 * re) * (exp(-im) + exp(im))
else if (im <= 5.4d+133) then
tmp = (-0.16666666666666666d0) * ((re ** 3.0d0) * t_1)
else if (im <= 1.4d+154) then
tmp = re / ((1.0d0 - t_0) / (1.0d0 + ((-0.25d0) * (im ** 4.0d0))))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = t_0 + 1.0;
double t_2 = Math.sin(re) * t_1;
double tmp;
if (im <= 1000.0) {
tmp = t_2;
} else if (im <= 9.5e+112) {
tmp = (0.5 * re) * (Math.exp(-im) + Math.exp(im));
} else if (im <= 5.4e+133) {
tmp = -0.16666666666666666 * (Math.pow(re, 3.0) * t_1);
} else if (im <= 1.4e+154) {
tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * Math.pow(im, 4.0))));
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (im * im) t_1 = t_0 + 1.0 t_2 = math.sin(re) * t_1 tmp = 0 if im <= 1000.0: tmp = t_2 elif im <= 9.5e+112: tmp = (0.5 * re) * (math.exp(-im) + math.exp(im)) elif im <= 5.4e+133: tmp = -0.16666666666666666 * (math.pow(re, 3.0) * t_1) elif im <= 1.4e+154: tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * math.pow(im, 4.0)))) else: tmp = t_2 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(im * im)) t_1 = Float64(t_0 + 1.0) t_2 = Float64(sin(re) * t_1) tmp = 0.0 if (im <= 1000.0) tmp = t_2; elseif (im <= 9.5e+112) tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) + exp(im))); elseif (im <= 5.4e+133) tmp = Float64(-0.16666666666666666 * Float64((re ^ 3.0) * t_1)); elseif (im <= 1.4e+154) tmp = Float64(re / Float64(Float64(1.0 - t_0) / Float64(1.0 + Float64(-0.25 * (im ^ 4.0))))); else tmp = t_2; end return tmp end
function tmp_2 = code(re, im) t_0 = 0.5 * (im * im); t_1 = t_0 + 1.0; t_2 = sin(re) * t_1; tmp = 0.0; if (im <= 1000.0) tmp = t_2; elseif (im <= 9.5e+112) tmp = (0.5 * re) * (exp(-im) + exp(im)); elseif (im <= 5.4e+133) tmp = -0.16666666666666666 * ((re ^ 3.0) * t_1); elseif (im <= 1.4e+154) tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * (im ^ 4.0)))); else tmp = t_2; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[im, 1000.0], t$95$2, If[LessEqual[im, 9.5e+112], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.4e+133], N[(-0.16666666666666666 * N[(N[Power[re, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.4e+154], N[(re / N[(N[(1.0 - t$95$0), $MachinePrecision] / N[(1.0 + N[(-0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right)\\
t_1 := t_0 + 1\\
t_2 := \sin re \cdot t_1\\
\mathbf{if}\;im \leq 1000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} + e^{im}\right)\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+133}:\\
\;\;\;\;-0.16666666666666666 \cdot \left({re}^{3} \cdot t_1\right)\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{re}{\frac{1 - t_0}{1 + -0.25 \cdot {im}^{4}}}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < 1e3 or 1.4e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 1e3 < im < 9.5000000000000008e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in re around 0 82.9%
Simplified82.9%
if 9.5000000000000008e112 < im < 5.4000000000000004e133Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.4%
Simplified6.4%
Taylor expanded in re around 0 0.9%
+-commutative0.9%
associate-*r*0.9%
distribute-rgt-out75.9%
+-commutative75.9%
unpow275.9%
associate-*r*75.9%
*-commutative75.9%
fma-udef75.9%
Simplified75.9%
Taylor expanded in re around inf 75.4%
unpow275.4%
Simplified75.4%
if 5.4000000000000004e133 < im < 1.4e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
Simplified5.7%
Taylor expanded in re around 0 3.5%
unpow23.5%
Simplified3.5%
flip-+80.0%
associate-*r/80.0%
metadata-eval80.0%
swap-sqr80.0%
metadata-eval80.0%
pow280.0%
pow280.0%
pow-prod-up80.0%
metadata-eval80.0%
*-commutative80.0%
associate-*r*80.0%
Applied egg-rr80.0%
associate-/l*80.0%
*-commutative80.0%
*-commutative80.0%
associate-*r*80.0%
cancel-sign-sub-inv80.0%
metadata-eval80.0%
Simplified80.0%
Final simplification85.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im im))) (t_1 (+ t_0 1.0)) (t_2 (* (sin re) t_1)))
(if (<= im 180000.0)
t_2
(if (<= im 7.1e+75)
(log1p (expm1 (* im (* im (* 0.5 re)))))
(if (<= im 9.5e+112)
(/ (* re (- 1.0 (* (pow im 4.0) 0.25))) (- 1.0 (* im (* 0.5 im))))
(if (<= im 5.4e+133)
(* -0.16666666666666666 (* (pow re 3.0) t_1))
(if (<= im 1.4e+154)
(/ re (/ (- 1.0 t_0) (+ 1.0 (* -0.25 (pow im 4.0)))))
t_2)))))))
double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = t_0 + 1.0;
double t_2 = sin(re) * t_1;
double tmp;
if (im <= 180000.0) {
tmp = t_2;
} else if (im <= 7.1e+75) {
tmp = log1p(expm1((im * (im * (0.5 * re)))));
} else if (im <= 9.5e+112) {
tmp = (re * (1.0 - (pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * im)));
} else if (im <= 5.4e+133) {
tmp = -0.16666666666666666 * (pow(re, 3.0) * t_1);
} else if (im <= 1.4e+154) {
tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * pow(im, 4.0))));
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = t_0 + 1.0;
double t_2 = Math.sin(re) * t_1;
double tmp;
if (im <= 180000.0) {
tmp = t_2;
} else if (im <= 7.1e+75) {
tmp = Math.log1p(Math.expm1((im * (im * (0.5 * re)))));
} else if (im <= 9.5e+112) {
tmp = (re * (1.0 - (Math.pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * im)));
} else if (im <= 5.4e+133) {
tmp = -0.16666666666666666 * (Math.pow(re, 3.0) * t_1);
} else if (im <= 1.4e+154) {
tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * Math.pow(im, 4.0))));
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im): t_0 = 0.5 * (im * im) t_1 = t_0 + 1.0 t_2 = math.sin(re) * t_1 tmp = 0 if im <= 180000.0: tmp = t_2 elif im <= 7.1e+75: tmp = math.log1p(math.expm1((im * (im * (0.5 * re))))) elif im <= 9.5e+112: tmp = (re * (1.0 - (math.pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * im))) elif im <= 5.4e+133: tmp = -0.16666666666666666 * (math.pow(re, 3.0) * t_1) elif im <= 1.4e+154: tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * math.pow(im, 4.0)))) else: tmp = t_2 return tmp
function code(re, im) t_0 = Float64(0.5 * Float64(im * im)) t_1 = Float64(t_0 + 1.0) t_2 = Float64(sin(re) * t_1) tmp = 0.0 if (im <= 180000.0) tmp = t_2; elseif (im <= 7.1e+75) tmp = log1p(expm1(Float64(im * Float64(im * Float64(0.5 * re))))); elseif (im <= 9.5e+112) tmp = Float64(Float64(re * Float64(1.0 - Float64((im ^ 4.0) * 0.25))) / Float64(1.0 - Float64(im * Float64(0.5 * im)))); elseif (im <= 5.4e+133) tmp = Float64(-0.16666666666666666 * Float64((re ^ 3.0) * t_1)); elseif (im <= 1.4e+154) tmp = Float64(re / Float64(Float64(1.0 - t_0) / Float64(1.0 + Float64(-0.25 * (im ^ 4.0))))); else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[im, 180000.0], t$95$2, If[LessEqual[im, 7.1e+75], N[Log[1 + N[(Exp[N[(im * N[(im * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[im, 9.5e+112], N[(N[(re * N[(1.0 - N[(N[Power[im, 4.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.4e+133], N[(-0.16666666666666666 * N[(N[Power[re, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.4e+154], N[(re / N[(N[(1.0 - t$95$0), $MachinePrecision] / N[(1.0 + N[(-0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right)\\
t_1 := t_0 + 1\\
t_2 := \sin re \cdot t_1\\
\mathbf{if}\;im \leq 180000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 7.1 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(im \cdot \left(im \cdot \left(0.5 \cdot re\right)\right)\right)\right)\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112}:\\
\;\;\;\;\frac{re \cdot \left(1 - {im}^{4} \cdot 0.25\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+133}:\\
\;\;\;\;-0.16666666666666666 \cdot \left({re}^{3} \cdot t_1\right)\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{re}{\frac{1 - t_0}{1 + -0.25 \cdot {im}^{4}}}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < 1.8e5 or 1.4e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 1.8e5 < im < 7.09999999999999982e75Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.5%
Simplified3.5%
Taylor expanded in im around inf 3.5%
unpow23.5%
associate-*r*3.5%
*-commutative3.5%
associate-*l*3.5%
associate-*r*3.5%
Simplified3.5%
Taylor expanded in re around 0 3.7%
*-commutative3.7%
associate-*l*3.7%
Simplified3.7%
log1p-expm1-u55.1%
*-commutative55.1%
Applied egg-rr55.1%
if 7.09999999999999982e75 < im < 9.5000000000000008e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.4%
Simplified4.4%
Taylor expanded in re around 0 33.4%
unpow233.4%
Simplified33.4%
*-commutative33.4%
flip-+85.0%
associate-*l/92.3%
metadata-eval92.3%
swap-sqr92.3%
metadata-eval92.3%
pow292.3%
pow292.3%
pow-prod-up92.3%
metadata-eval92.3%
*-commutative92.3%
associate-*r*92.3%
Applied egg-rr92.3%
if 9.5000000000000008e112 < im < 5.4000000000000004e133Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.4%
Simplified6.4%
Taylor expanded in re around 0 0.9%
+-commutative0.9%
associate-*r*0.9%
distribute-rgt-out75.9%
+-commutative75.9%
unpow275.9%
associate-*r*75.9%
*-commutative75.9%
fma-udef75.9%
Simplified75.9%
Taylor expanded in re around inf 75.4%
unpow275.4%
Simplified75.4%
if 5.4000000000000004e133 < im < 1.4e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
Simplified5.7%
Taylor expanded in re around 0 3.5%
unpow23.5%
Simplified3.5%
flip-+80.0%
associate-*r/80.0%
metadata-eval80.0%
swap-sqr80.0%
metadata-eval80.0%
pow280.0%
pow280.0%
pow-prod-up80.0%
metadata-eval80.0%
*-commutative80.0%
associate-*r*80.0%
Applied egg-rr80.0%
associate-/l*80.0%
*-commutative80.0%
*-commutative80.0%
associate-*r*80.0%
cancel-sign-sub-inv80.0%
metadata-eval80.0%
Simplified80.0%
Final simplification83.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im im)))
(t_1 (+ t_0 1.0))
(t_2 (* (sin re) t_1))
(t_3 (/ re (/ (- 1.0 t_0) (+ 1.0 (* -0.25 (pow im 4.0)))))))
(if (<= im 680.0)
t_2
(if (<= im 1.5e+68)
(+
0.08333333333333333
(fma (* re re) 0.016666666666666666 (/ 0.25 (* re re))))
(if (<= im 9.5e+112)
t_3
(if (<= im 5.4e+133)
(* -0.16666666666666666 (* (pow re 3.0) t_1))
(if (<= im 1.4e+154) t_3 t_2)))))))
double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = t_0 + 1.0;
double t_2 = sin(re) * t_1;
double t_3 = re / ((1.0 - t_0) / (1.0 + (-0.25 * pow(im, 4.0))));
double tmp;
if (im <= 680.0) {
tmp = t_2;
} else if (im <= 1.5e+68) {
tmp = 0.08333333333333333 + fma((re * re), 0.016666666666666666, (0.25 / (re * re)));
} else if (im <= 9.5e+112) {
tmp = t_3;
} else if (im <= 5.4e+133) {
tmp = -0.16666666666666666 * (pow(re, 3.0) * t_1);
} else if (im <= 1.4e+154) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(0.5 * Float64(im * im)) t_1 = Float64(t_0 + 1.0) t_2 = Float64(sin(re) * t_1) t_3 = Float64(re / Float64(Float64(1.0 - t_0) / Float64(1.0 + Float64(-0.25 * (im ^ 4.0))))) tmp = 0.0 if (im <= 680.0) tmp = t_2; elseif (im <= 1.5e+68) tmp = Float64(0.08333333333333333 + fma(Float64(re * re), 0.016666666666666666, Float64(0.25 / Float64(re * re)))); elseif (im <= 9.5e+112) tmp = t_3; elseif (im <= 5.4e+133) tmp = Float64(-0.16666666666666666 * Float64((re ^ 3.0) * t_1)); elseif (im <= 1.4e+154) tmp = t_3; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(re / N[(N[(1.0 - t$95$0), $MachinePrecision] / N[(1.0 + N[(-0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 680.0], t$95$2, If[LessEqual[im, 1.5e+68], N[(0.08333333333333333 + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.5e+112], t$95$3, If[LessEqual[im, 5.4e+133], N[(-0.16666666666666666 * N[(N[Power[re, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.4e+154], t$95$3, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right)\\
t_1 := t_0 + 1\\
t_2 := \sin re \cdot t_1\\
t_3 := \frac{re}{\frac{1 - t_0}{1 + -0.25 \cdot {im}^{4}}}\\
\mathbf{if}\;im \leq 680:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+68}:\\
\;\;\;\;0.08333333333333333 + \mathsf{fma}\left(re \cdot re, 0.016666666666666666, \frac{0.25}{re \cdot re}\right)\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+133}:\\
\;\;\;\;-0.16666666666666666 \cdot \left({re}^{3} \cdot t_1\right)\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < 680 or 1.4e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 680 < im < 1.5000000000000001e68Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr16.0%
Taylor expanded in re around 0 30.1%
*-commutative30.1%
fma-def30.1%
unpow230.1%
associate-*r/30.1%
metadata-eval30.1%
unpow230.1%
Simplified30.1%
if 1.5000000000000001e68 < im < 9.5000000000000008e112 or 5.4000000000000004e133 < im < 1.4e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.7%
Simplified4.7%
Taylor expanded in re around 0 24.0%
unpow224.0%
Simplified24.0%
flip-+79.4%
associate-*r/84.4%
metadata-eval84.4%
swap-sqr84.4%
metadata-eval84.4%
pow284.4%
pow284.4%
pow-prod-up84.4%
metadata-eval84.4%
*-commutative84.4%
associate-*r*84.4%
Applied egg-rr84.4%
associate-/l*79.4%
*-commutative79.4%
*-commutative79.4%
associate-*r*79.4%
cancel-sign-sub-inv79.4%
metadata-eval79.4%
Simplified79.4%
if 9.5000000000000008e112 < im < 5.4000000000000004e133Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.4%
Simplified6.4%
Taylor expanded in re around 0 0.9%
+-commutative0.9%
associate-*r*0.9%
distribute-rgt-out75.9%
+-commutative75.9%
unpow275.9%
associate-*r*75.9%
*-commutative75.9%
fma-udef75.9%
Simplified75.9%
Taylor expanded in re around inf 75.4%
unpow275.4%
Simplified75.4%
Final simplification80.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* 0.5 (* im im))) (t_1 (+ t_0 1.0)) (t_2 (* (sin re) t_1)))
(if (<= im 580.0)
t_2
(if (<= im 7e+65)
(+
0.08333333333333333
(fma (* re re) 0.016666666666666666 (/ 0.25 (* re re))))
(if (<= im 9.5e+112)
(/ (* re (- 1.0 (* (pow im 4.0) 0.25))) (- 1.0 (* im (* 0.5 im))))
(if (<= im 5.4e+133)
(* -0.16666666666666666 (* (pow re 3.0) t_1))
(if (<= im 1.4e+154)
(/ re (/ (- 1.0 t_0) (+ 1.0 (* -0.25 (pow im 4.0)))))
t_2)))))))
double code(double re, double im) {
double t_0 = 0.5 * (im * im);
double t_1 = t_0 + 1.0;
double t_2 = sin(re) * t_1;
double tmp;
if (im <= 580.0) {
tmp = t_2;
} else if (im <= 7e+65) {
tmp = 0.08333333333333333 + fma((re * re), 0.016666666666666666, (0.25 / (re * re)));
} else if (im <= 9.5e+112) {
tmp = (re * (1.0 - (pow(im, 4.0) * 0.25))) / (1.0 - (im * (0.5 * im)));
} else if (im <= 5.4e+133) {
tmp = -0.16666666666666666 * (pow(re, 3.0) * t_1);
} else if (im <= 1.4e+154) {
tmp = re / ((1.0 - t_0) / (1.0 + (-0.25 * pow(im, 4.0))));
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(0.5 * Float64(im * im)) t_1 = Float64(t_0 + 1.0) t_2 = Float64(sin(re) * t_1) tmp = 0.0 if (im <= 580.0) tmp = t_2; elseif (im <= 7e+65) tmp = Float64(0.08333333333333333 + fma(Float64(re * re), 0.016666666666666666, Float64(0.25 / Float64(re * re)))); elseif (im <= 9.5e+112) tmp = Float64(Float64(re * Float64(1.0 - Float64((im ^ 4.0) * 0.25))) / Float64(1.0 - Float64(im * Float64(0.5 * im)))); elseif (im <= 5.4e+133) tmp = Float64(-0.16666666666666666 * Float64((re ^ 3.0) * t_1)); elseif (im <= 1.4e+154) tmp = Float64(re / Float64(Float64(1.0 - t_0) / Float64(1.0 + Float64(-0.25 * (im ^ 4.0))))); else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[im, 580.0], t$95$2, If[LessEqual[im, 7e+65], N[(0.08333333333333333 + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.5e+112], N[(N[(re * N[(1.0 - N[(N[Power[im, 4.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(im * N[(0.5 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.4e+133], N[(-0.16666666666666666 * N[(N[Power[re, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.4e+154], N[(re / N[(N[(1.0 - t$95$0), $MachinePrecision] / N[(1.0 + N[(-0.25 * N[Power[im, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right)\\
t_1 := t_0 + 1\\
t_2 := \sin re \cdot t_1\\
\mathbf{if}\;im \leq 580:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 7 \cdot 10^{+65}:\\
\;\;\;\;0.08333333333333333 + \mathsf{fma}\left(re \cdot re, 0.016666666666666666, \frac{0.25}{re \cdot re}\right)\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112}:\\
\;\;\;\;\frac{re \cdot \left(1 - {im}^{4} \cdot 0.25\right)}{1 - im \cdot \left(0.5 \cdot im\right)}\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+133}:\\
\;\;\;\;-0.16666666666666666 \cdot \left({re}^{3} \cdot t_1\right)\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{re}{\frac{1 - t_0}{1 + -0.25 \cdot {im}^{4}}}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < 580 or 1.4e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 580 < im < 7.0000000000000002e65Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr16.0%
Taylor expanded in re around 0 30.1%
*-commutative30.1%
fma-def30.1%
unpow230.1%
associate-*r/30.1%
metadata-eval30.1%
unpow230.1%
Simplified30.1%
if 7.0000000000000002e65 < im < 9.5000000000000008e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.4%
Simplified4.4%
Taylor expanded in re around 0 31.3%
unpow231.3%
Simplified31.3%
*-commutative31.3%
flip-+79.2%
associate-*l/86.0%
metadata-eval86.0%
swap-sqr86.0%
metadata-eval86.0%
pow286.0%
pow286.0%
pow-prod-up86.0%
metadata-eval86.0%
*-commutative86.0%
associate-*r*86.0%
Applied egg-rr86.0%
if 9.5000000000000008e112 < im < 5.4000000000000004e133Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 6.4%
Simplified6.4%
Taylor expanded in re around 0 0.9%
+-commutative0.9%
associate-*r*0.9%
distribute-rgt-out75.9%
+-commutative75.9%
unpow275.9%
associate-*r*75.9%
*-commutative75.9%
fma-udef75.9%
Simplified75.9%
Taylor expanded in re around inf 75.4%
unpow275.4%
Simplified75.4%
if 5.4000000000000004e133 < im < 1.4e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.7%
Simplified5.7%
Taylor expanded in re around 0 3.5%
unpow23.5%
Simplified3.5%
flip-+80.0%
associate-*r/80.0%
metadata-eval80.0%
swap-sqr80.0%
metadata-eval80.0%
pow280.0%
pow280.0%
pow-prod-up80.0%
metadata-eval80.0%
*-commutative80.0%
associate-*r*80.0%
Applied egg-rr80.0%
associate-/l*80.0%
*-commutative80.0%
*-commutative80.0%
associate-*r*80.0%
cancel-sign-sub-inv80.0%
metadata-eval80.0%
Simplified80.0%
Final simplification80.9%
(FPCore (re im)
:precision binary64
(let* ((t_0
(+
0.08333333333333333
(fma (* re re) 0.016666666666666666 (/ 0.25 (* re re)))))
(t_1 (+ (* 0.5 (* im im)) 1.0))
(t_2 (* (sin re) t_1))
(t_3 (* re (* im im))))
(if (<= im 680.0)
t_2
(if (<= im 1.2e+68)
t_0
(if (<= im 6.6e+92)
(/
(- (* re re) (* 0.25 (* t_3 t_3)))
(+ re (* (* re im) (* im -0.5))))
(if (<= im 1.06e+100)
t_0
(if (<= im 3.8e+122) (* re t_1) (if (<= im 1.4e+154) t_0 t_2))))))))
double code(double re, double im) {
double t_0 = 0.08333333333333333 + fma((re * re), 0.016666666666666666, (0.25 / (re * re)));
double t_1 = (0.5 * (im * im)) + 1.0;
double t_2 = sin(re) * t_1;
double t_3 = re * (im * im);
double tmp;
if (im <= 680.0) {
tmp = t_2;
} else if (im <= 1.2e+68) {
tmp = t_0;
} else if (im <= 6.6e+92) {
tmp = ((re * re) - (0.25 * (t_3 * t_3))) / (re + ((re * im) * (im * -0.5)));
} else if (im <= 1.06e+100) {
tmp = t_0;
} else if (im <= 3.8e+122) {
tmp = re * t_1;
} else if (im <= 1.4e+154) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(0.08333333333333333 + fma(Float64(re * re), 0.016666666666666666, Float64(0.25 / Float64(re * re)))) t_1 = Float64(Float64(0.5 * Float64(im * im)) + 1.0) t_2 = Float64(sin(re) * t_1) t_3 = Float64(re * Float64(im * im)) tmp = 0.0 if (im <= 680.0) tmp = t_2; elseif (im <= 1.2e+68) tmp = t_0; elseif (im <= 6.6e+92) tmp = Float64(Float64(Float64(re * re) - Float64(0.25 * Float64(t_3 * t_3))) / Float64(re + Float64(Float64(re * im) * Float64(im * -0.5)))); elseif (im <= 1.06e+100) tmp = t_0; elseif (im <= 3.8e+122) tmp = Float64(re * t_1); elseif (im <= 1.4e+154) tmp = t_0; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(0.08333333333333333 + N[(N[(re * re), $MachinePrecision] * 0.016666666666666666 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[re], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 680.0], t$95$2, If[LessEqual[im, 1.2e+68], t$95$0, If[LessEqual[im, 6.6e+92], N[(N[(N[(re * re), $MachinePrecision] - N[(0.25 * N[(t$95$3 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(re + N[(N[(re * im), $MachinePrecision] * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.06e+100], t$95$0, If[LessEqual[im, 3.8e+122], N[(re * t$95$1), $MachinePrecision], If[LessEqual[im, 1.4e+154], t$95$0, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.08333333333333333 + \mathsf{fma}\left(re \cdot re, 0.016666666666666666, \frac{0.25}{re \cdot re}\right)\\
t_1 := 0.5 \cdot \left(im \cdot im\right) + 1\\
t_2 := \sin re \cdot t_1\\
t_3 := re \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 680:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 1.2 \cdot 10^{+68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 6.6 \cdot 10^{+92}:\\
\;\;\;\;\frac{re \cdot re - 0.25 \cdot \left(t_3 \cdot t_3\right)}{re + \left(re \cdot im\right) \cdot \left(im \cdot -0.5\right)}\\
\mathbf{elif}\;im \leq 1.06 \cdot 10^{+100}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3.8 \cdot 10^{+122}:\\
\;\;\;\;re \cdot t_1\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if im < 680 or 1.4e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 680 < im < 1.20000000000000004e68 or 6.59999999999999948e92 < im < 1.06000000000000007e100 or 3.7999999999999998e122 < im < 1.4e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr25.0%
Taylor expanded in re around 0 42.3%
*-commutative42.3%
fma-def42.3%
unpow242.3%
associate-*r/42.3%
metadata-eval42.3%
unpow242.3%
Simplified42.3%
if 1.20000000000000004e68 < im < 6.59999999999999948e92Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 4.3%
Simplified4.3%
Taylor expanded in re around 0 5.5%
unpow25.5%
Simplified5.5%
distribute-rgt-in5.5%
*-un-lft-identity5.5%
flip-+61.4%
associate-*r*61.4%
associate-*l*61.4%
*-commutative61.4%
associate-*r*61.4%
associate-*l*61.4%
*-commutative61.4%
associate-*r*61.4%
associate-*l*61.4%
*-commutative61.4%
Applied egg-rr61.4%
*-commutative61.4%
associate-*l*61.4%
associate-*l*61.4%
unpow261.4%
*-commutative61.4%
associate-*l*61.4%
associate-*l*61.4%
unpow261.4%
swap-sqr61.4%
metadata-eval61.4%
*-commutative61.4%
unpow261.4%
*-commutative61.4%
unpow261.4%
Simplified61.4%
if 1.06000000000000007e100 < im < 3.7999999999999998e122Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.3%
Simplified5.3%
Taylor expanded in re around 0 80.6%
unpow280.6%
Simplified80.6%
Final simplification79.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (+ (* 0.5 (* im im)) 1.0))) (t_1 (* re (* im im))))
(if (<= im 390.0)
(sin re)
(if (<= im 4e+57)
(+ 0.08333333333333333 (* re (* re 0.016666666666666666)))
(if (<= im 2.1e+100)
(/
(- (* re re) (* 0.25 (* t_1 t_1)))
(+ re (* (* re im) (* im -0.5))))
(if (<= im 9.2e+112)
t_0
(if (<= im 3.8e+152)
(+ 0.08333333333333333 (/ 0.25 (* re re)))
(if (<= im 4.8e+231) t_0 (* im (* im (* 0.5 (sin re))))))))))))
double code(double re, double im) {
double t_0 = re * ((0.5 * (im * im)) + 1.0);
double t_1 = re * (im * im);
double tmp;
if (im <= 390.0) {
tmp = sin(re);
} else if (im <= 4e+57) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (im <= 2.1e+100) {
tmp = ((re * re) - (0.25 * (t_1 * t_1))) / (re + ((re * im) * (im * -0.5)));
} else if (im <= 9.2e+112) {
tmp = t_0;
} else if (im <= 3.8e+152) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else if (im <= 4.8e+231) {
tmp = t_0;
} else {
tmp = im * (im * (0.5 * sin(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) :: t_1
real(8) :: tmp
t_0 = re * ((0.5d0 * (im * im)) + 1.0d0)
t_1 = re * (im * im)
if (im <= 390.0d0) then
tmp = sin(re)
else if (im <= 4d+57) then
tmp = 0.08333333333333333d0 + (re * (re * 0.016666666666666666d0))
else if (im <= 2.1d+100) then
tmp = ((re * re) - (0.25d0 * (t_1 * t_1))) / (re + ((re * im) * (im * (-0.5d0))))
else if (im <= 9.2d+112) then
tmp = t_0
else if (im <= 3.8d+152) then
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
else if (im <= 4.8d+231) then
tmp = t_0
else
tmp = im * (im * (0.5d0 * sin(re)))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * ((0.5 * (im * im)) + 1.0);
double t_1 = re * (im * im);
double tmp;
if (im <= 390.0) {
tmp = Math.sin(re);
} else if (im <= 4e+57) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (im <= 2.1e+100) {
tmp = ((re * re) - (0.25 * (t_1 * t_1))) / (re + ((re * im) * (im * -0.5)));
} else if (im <= 9.2e+112) {
tmp = t_0;
} else if (im <= 3.8e+152) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else if (im <= 4.8e+231) {
tmp = t_0;
} else {
tmp = im * (im * (0.5 * Math.sin(re)));
}
return tmp;
}
def code(re, im): t_0 = re * ((0.5 * (im * im)) + 1.0) t_1 = re * (im * im) tmp = 0 if im <= 390.0: tmp = math.sin(re) elif im <= 4e+57: tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)) elif im <= 2.1e+100: tmp = ((re * re) - (0.25 * (t_1 * t_1))) / (re + ((re * im) * (im * -0.5))) elif im <= 9.2e+112: tmp = t_0 elif im <= 3.8e+152: tmp = 0.08333333333333333 + (0.25 / (re * re)) elif im <= 4.8e+231: tmp = t_0 else: tmp = im * (im * (0.5 * math.sin(re))) return tmp
function code(re, im) t_0 = Float64(re * Float64(Float64(0.5 * Float64(im * im)) + 1.0)) t_1 = Float64(re * Float64(im * im)) tmp = 0.0 if (im <= 390.0) tmp = sin(re); elseif (im <= 4e+57) tmp = Float64(0.08333333333333333 + Float64(re * Float64(re * 0.016666666666666666))); elseif (im <= 2.1e+100) tmp = Float64(Float64(Float64(re * re) - Float64(0.25 * Float64(t_1 * t_1))) / Float64(re + Float64(Float64(re * im) * Float64(im * -0.5)))); elseif (im <= 9.2e+112) tmp = t_0; elseif (im <= 3.8e+152) tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); elseif (im <= 4.8e+231) tmp = t_0; else tmp = Float64(im * Float64(im * Float64(0.5 * sin(re)))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * ((0.5 * (im * im)) + 1.0); t_1 = re * (im * im); tmp = 0.0; if (im <= 390.0) tmp = sin(re); elseif (im <= 4e+57) tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)); elseif (im <= 2.1e+100) tmp = ((re * re) - (0.25 * (t_1 * t_1))) / (re + ((re * im) * (im * -0.5))); elseif (im <= 9.2e+112) tmp = t_0; elseif (im <= 3.8e+152) tmp = 0.08333333333333333 + (0.25 / (re * re)); elseif (im <= 4.8e+231) tmp = t_0; else tmp = im * (im * (0.5 * sin(re))); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 390.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4e+57], N[(0.08333333333333333 + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.1e+100], N[(N[(N[(re * re), $MachinePrecision] - N[(0.25 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(re + N[(N[(re * im), $MachinePrecision] * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2e+112], t$95$0, If[LessEqual[im, 3.8e+152], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 4.8e+231], t$95$0, N[(im * N[(im * N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\
t_1 := re \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 390:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4 \cdot 10^{+57}:\\
\;\;\;\;0.08333333333333333 + re \cdot \left(re \cdot 0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+100}:\\
\;\;\;\;\frac{re \cdot re - 0.25 \cdot \left(t_1 \cdot t_1\right)}{re + \left(re \cdot im\right) \cdot \left(im \cdot -0.5\right)}\\
\mathbf{elif}\;im \leq 9.2 \cdot 10^{+112}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 3.8 \cdot 10^{+152}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+231}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(im \cdot \left(0.5 \cdot \sin re\right)\right)\\
\end{array}
\end{array}
if im < 390Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.4%
if 390 < im < 4.00000000000000019e57Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr12.8%
Taylor expanded in re around 0 29.0%
*-commutative29.0%
fma-def29.0%
unpow229.0%
associate-*r/29.0%
metadata-eval29.0%
unpow229.0%
Simplified29.0%
Taylor expanded in re around inf 18.3%
+-commutative18.3%
*-commutative18.3%
unpow218.3%
associate-*l*18.3%
Simplified18.3%
if 4.00000000000000019e57 < im < 2.0999999999999999e100Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.9%
Simplified3.9%
Taylor expanded in re around 0 4.1%
unpow24.1%
Simplified4.1%
distribute-rgt-in4.1%
*-un-lft-identity4.1%
flip-+35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
Applied egg-rr35.2%
*-commutative35.2%
associate-*l*35.2%
associate-*l*35.2%
unpow235.2%
*-commutative35.2%
associate-*l*35.2%
associate-*l*35.2%
unpow235.2%
swap-sqr35.2%
metadata-eval35.2%
*-commutative35.2%
unpow235.2%
*-commutative35.2%
unpow235.2%
Simplified35.2%
if 2.0999999999999999e100 < im < 9.1999999999999999e112 or 3.8e152 < im < 4.80000000000000013e231Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 70.4%
Simplified70.4%
Taylor expanded in re around 0 87.7%
unpow287.7%
Simplified87.7%
if 9.1999999999999999e112 < im < 3.8e152Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr34.5%
Taylor expanded in re around 0 34.5%
associate-*r/34.5%
metadata-eval34.5%
unpow234.5%
Simplified34.5%
if 4.80000000000000013e231 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in im around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification64.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ (* 0.5 (* im im)) 1.0))
(t_1 (* (sin re) t_0))
(t_2 (* re (* im im))))
(if (<= im 650.0)
t_1
(if (<= im 1.32e+57)
(+ 0.08333333333333333 (* re (* re 0.016666666666666666)))
(if (<= im 1.9e+100)
(/
(- (* re re) (* 0.25 (* t_2 t_2)))
(+ re (* (* re im) (* im -0.5))))
(if (<= im 9.2e+112)
(* re t_0)
(if (<= im 1.26e+154)
(+ 0.08333333333333333 (/ 0.25 (* re re)))
t_1)))))))
double code(double re, double im) {
double t_0 = (0.5 * (im * im)) + 1.0;
double t_1 = sin(re) * t_0;
double t_2 = re * (im * im);
double tmp;
if (im <= 650.0) {
tmp = t_1;
} else if (im <= 1.32e+57) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (im <= 1.9e+100) {
tmp = ((re * re) - (0.25 * (t_2 * t_2))) / (re + ((re * im) * (im * -0.5)));
} else if (im <= 9.2e+112) {
tmp = re * t_0;
} else if (im <= 1.26e+154) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} 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 * (im * im)) + 1.0d0
t_1 = sin(re) * t_0
t_2 = re * (im * im)
if (im <= 650.0d0) then
tmp = t_1
else if (im <= 1.32d+57) then
tmp = 0.08333333333333333d0 + (re * (re * 0.016666666666666666d0))
else if (im <= 1.9d+100) then
tmp = ((re * re) - (0.25d0 * (t_2 * t_2))) / (re + ((re * im) * (im * (-0.5d0))))
else if (im <= 9.2d+112) then
tmp = re * t_0
else if (im <= 1.26d+154) then
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = (0.5 * (im * im)) + 1.0;
double t_1 = Math.sin(re) * t_0;
double t_2 = re * (im * im);
double tmp;
if (im <= 650.0) {
tmp = t_1;
} else if (im <= 1.32e+57) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (im <= 1.9e+100) {
tmp = ((re * re) - (0.25 * (t_2 * t_2))) / (re + ((re * im) * (im * -0.5)));
} else if (im <= 9.2e+112) {
tmp = re * t_0;
} else if (im <= 1.26e+154) {
tmp = 0.08333333333333333 + (0.25 / (re * re));
} else {
tmp = t_1;
}
return tmp;
}
def code(re, im): t_0 = (0.5 * (im * im)) + 1.0 t_1 = math.sin(re) * t_0 t_2 = re * (im * im) tmp = 0 if im <= 650.0: tmp = t_1 elif im <= 1.32e+57: tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)) elif im <= 1.9e+100: tmp = ((re * re) - (0.25 * (t_2 * t_2))) / (re + ((re * im) * (im * -0.5))) elif im <= 9.2e+112: tmp = re * t_0 elif im <= 1.26e+154: tmp = 0.08333333333333333 + (0.25 / (re * re)) else: tmp = t_1 return tmp
function code(re, im) t_0 = Float64(Float64(0.5 * Float64(im * im)) + 1.0) t_1 = Float64(sin(re) * t_0) t_2 = Float64(re * Float64(im * im)) tmp = 0.0 if (im <= 650.0) tmp = t_1; elseif (im <= 1.32e+57) tmp = Float64(0.08333333333333333 + Float64(re * Float64(re * 0.016666666666666666))); elseif (im <= 1.9e+100) tmp = Float64(Float64(Float64(re * re) - Float64(0.25 * Float64(t_2 * t_2))) / Float64(re + Float64(Float64(re * im) * Float64(im * -0.5)))); elseif (im <= 9.2e+112) tmp = Float64(re * t_0); elseif (im <= 1.26e+154) tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); else tmp = t_1; end return tmp end
function tmp_2 = code(re, im) t_0 = (0.5 * (im * im)) + 1.0; t_1 = sin(re) * t_0; t_2 = re * (im * im); tmp = 0.0; if (im <= 650.0) tmp = t_1; elseif (im <= 1.32e+57) tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)); elseif (im <= 1.9e+100) tmp = ((re * re) - (0.25 * (t_2 * t_2))) / (re + ((re * im) * (im * -0.5))); elseif (im <= 9.2e+112) tmp = re * t_0; elseif (im <= 1.26e+154) tmp = 0.08333333333333333 + (0.25 / (re * re)); else tmp = t_1; end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[re], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 650.0], t$95$1, If[LessEqual[im, 1.32e+57], N[(0.08333333333333333 + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+100], N[(N[(N[(re * re), $MachinePrecision] - N[(0.25 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(re + N[(N[(re * im), $MachinePrecision] * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2e+112], N[(re * t$95$0), $MachinePrecision], If[LessEqual[im, 1.26e+154], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(im \cdot im\right) + 1\\
t_1 := \sin re \cdot t_0\\
t_2 := re \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 650:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 1.32 \cdot 10^{+57}:\\
\;\;\;\;0.08333333333333333 + re \cdot \left(re \cdot 0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 1.9 \cdot 10^{+100}:\\
\;\;\;\;\frac{re \cdot re - 0.25 \cdot \left(t_2 \cdot t_2\right)}{re + \left(re \cdot im\right) \cdot \left(im \cdot -0.5\right)}\\
\mathbf{elif}\;im \leq 9.2 \cdot 10^{+112}:\\
\;\;\;\;re \cdot t_0\\
\mathbf{elif}\;im \leq 1.26 \cdot 10^{+154}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if im < 650 or 1.26e154 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 85.7%
Simplified85.7%
if 650 < im < 1.32000000000000001e57Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr12.8%
Taylor expanded in re around 0 29.0%
*-commutative29.0%
fma-def29.0%
unpow229.0%
associate-*r/29.0%
metadata-eval29.0%
unpow229.0%
Simplified29.0%
Taylor expanded in re around inf 18.3%
+-commutative18.3%
*-commutative18.3%
unpow218.3%
associate-*l*18.3%
Simplified18.3%
if 1.32000000000000001e57 < im < 1.89999999999999982e100Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.9%
Simplified3.9%
Taylor expanded in re around 0 4.1%
unpow24.1%
Simplified4.1%
distribute-rgt-in4.1%
*-un-lft-identity4.1%
flip-+35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
Applied egg-rr35.2%
*-commutative35.2%
associate-*l*35.2%
associate-*l*35.2%
unpow235.2%
*-commutative35.2%
associate-*l*35.2%
associate-*l*35.2%
unpow235.2%
swap-sqr35.2%
metadata-eval35.2%
*-commutative35.2%
unpow235.2%
*-commutative35.2%
unpow235.2%
Simplified35.2%
if 1.89999999999999982e100 < im < 9.1999999999999999e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.3%
Simplified5.3%
Taylor expanded in re around 0 80.6%
unpow280.6%
Simplified80.6%
if 9.1999999999999999e112 < im < 1.26e154Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr34.5%
Taylor expanded in re around 0 34.5%
associate-*r/34.5%
metadata-eval34.5%
unpow234.5%
Simplified34.5%
Final simplification76.7%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* im im))))
(if (<= im 520.0)
(sin re)
(if (<= im 4.3e+57)
(+ 0.08333333333333333 (* re (* re 0.016666666666666666)))
(if (<= im 2.1e+100)
(/
(- (* re re) (* 0.25 (* t_0 t_0)))
(+ re (* (* re im) (* im -0.5))))
(if (or (<= im 9.5e+112) (not (<= im 1.4e+153)))
(* re (+ (* 0.5 (* im im)) 1.0))
(+ 0.08333333333333333 (/ 0.25 (* re re)))))))))
double code(double re, double im) {
double t_0 = re * (im * im);
double tmp;
if (im <= 520.0) {
tmp = sin(re);
} else if (im <= 4.3e+57) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (im <= 2.1e+100) {
tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5)));
} else if ((im <= 9.5e+112) || !(im <= 1.4e+153)) {
tmp = re * ((0.5 * (im * im)) + 1.0);
} else {
tmp = 0.08333333333333333 + (0.25 / (re * 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 = re * (im * im)
if (im <= 520.0d0) then
tmp = sin(re)
else if (im <= 4.3d+57) then
tmp = 0.08333333333333333d0 + (re * (re * 0.016666666666666666d0))
else if (im <= 2.1d+100) then
tmp = ((re * re) - (0.25d0 * (t_0 * t_0))) / (re + ((re * im) * (im * (-0.5d0))))
else if ((im <= 9.5d+112) .or. (.not. (im <= 1.4d+153))) then
tmp = re * ((0.5d0 * (im * im)) + 1.0d0)
else
tmp = 0.08333333333333333d0 + (0.25d0 / (re * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (im * im);
double tmp;
if (im <= 520.0) {
tmp = Math.sin(re);
} else if (im <= 4.3e+57) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (im <= 2.1e+100) {
tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5)));
} else if ((im <= 9.5e+112) || !(im <= 1.4e+153)) {
tmp = re * ((0.5 * (im * im)) + 1.0);
} else {
tmp = 0.08333333333333333 + (0.25 / (re * re));
}
return tmp;
}
def code(re, im): t_0 = re * (im * im) tmp = 0 if im <= 520.0: tmp = math.sin(re) elif im <= 4.3e+57: tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)) elif im <= 2.1e+100: tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5))) elif (im <= 9.5e+112) or not (im <= 1.4e+153): tmp = re * ((0.5 * (im * im)) + 1.0) else: tmp = 0.08333333333333333 + (0.25 / (re * re)) return tmp
function code(re, im) t_0 = Float64(re * Float64(im * im)) tmp = 0.0 if (im <= 520.0) tmp = sin(re); elseif (im <= 4.3e+57) tmp = Float64(0.08333333333333333 + Float64(re * Float64(re * 0.016666666666666666))); elseif (im <= 2.1e+100) tmp = Float64(Float64(Float64(re * re) - Float64(0.25 * Float64(t_0 * t_0))) / Float64(re + Float64(Float64(re * im) * Float64(im * -0.5)))); elseif ((im <= 9.5e+112) || !(im <= 1.4e+153)) tmp = Float64(re * Float64(Float64(0.5 * Float64(im * im)) + 1.0)); else tmp = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (im * im); tmp = 0.0; if (im <= 520.0) tmp = sin(re); elseif (im <= 4.3e+57) tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)); elseif (im <= 2.1e+100) tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5))); elseif ((im <= 9.5e+112) || ~((im <= 1.4e+153))) tmp = re * ((0.5 * (im * im)) + 1.0); else tmp = 0.08333333333333333 + (0.25 / (re * re)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 520.0], N[Sin[re], $MachinePrecision], If[LessEqual[im, 4.3e+57], N[(0.08333333333333333 + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 2.1e+100], N[(N[(N[(re * re), $MachinePrecision] - N[(0.25 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(re + N[(N[(re * im), $MachinePrecision] * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 9.5e+112], N[Not[LessEqual[im, 1.4e+153]], $MachinePrecision]], N[(re * N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(im \cdot im\right)\\
\mathbf{if}\;im \leq 520:\\
\;\;\;\;\sin re\\
\mathbf{elif}\;im \leq 4.3 \cdot 10^{+57}:\\
\;\;\;\;0.08333333333333333 + re \cdot \left(re \cdot 0.016666666666666666\right)\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+100}:\\
\;\;\;\;\frac{re \cdot re - 0.25 \cdot \left(t_0 \cdot t_0\right)}{re + \left(re \cdot im\right) \cdot \left(im \cdot -0.5\right)}\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112} \lor \neg \left(im \leq 1.4 \cdot 10^{+153}\right):\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if im < 520Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 67.4%
if 520 < im < 4.30000000000000033e57Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr12.8%
Taylor expanded in re around 0 29.0%
*-commutative29.0%
fma-def29.0%
unpow229.0%
associate-*r/29.0%
metadata-eval29.0%
unpow229.0%
Simplified29.0%
Taylor expanded in re around inf 18.3%
+-commutative18.3%
*-commutative18.3%
unpow218.3%
associate-*l*18.3%
Simplified18.3%
if 4.30000000000000033e57 < im < 2.0999999999999999e100Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 3.9%
Simplified3.9%
Taylor expanded in re around 0 4.1%
unpow24.1%
Simplified4.1%
distribute-rgt-in4.1%
*-un-lft-identity4.1%
flip-+35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
associate-*r*35.2%
associate-*l*35.2%
*-commutative35.2%
Applied egg-rr35.2%
*-commutative35.2%
associate-*l*35.2%
associate-*l*35.2%
unpow235.2%
*-commutative35.2%
associate-*l*35.2%
associate-*l*35.2%
unpow235.2%
swap-sqr35.2%
metadata-eval35.2%
*-commutative35.2%
unpow235.2%
*-commutative35.2%
unpow235.2%
Simplified35.2%
if 2.0999999999999999e100 < im < 9.5000000000000008e112 or 1.39999999999999993e153 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 83.7%
Simplified83.7%
Taylor expanded in re around 0 76.0%
unpow276.0%
Simplified76.0%
if 9.5000000000000008e112 < im < 1.39999999999999993e153Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr34.5%
Taylor expanded in re around 0 34.5%
associate-*r/34.5%
metadata-eval34.5%
unpow234.5%
Simplified34.5%
Final simplification62.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* re (* im im))))
(if (<= re -1.16e+156)
(+ 0.08333333333333333 (* re (* re 0.016666666666666666)))
(if (<= re -1e-132)
(/ (- (* re re) (* 0.25 (* t_0 t_0))) (+ re (* (* re im) (* im -0.5))))
(if (or (<= re 1.9e-242) (not (<= re 3e-191)))
(* re (+ (* 0.5 (* im im)) 1.0))
(/ 0.25 (* re re)))))))
double code(double re, double im) {
double t_0 = re * (im * im);
double tmp;
if (re <= -1.16e+156) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (re <= -1e-132) {
tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5)));
} else if ((re <= 1.9e-242) || !(re <= 3e-191)) {
tmp = re * ((0.5 * (im * im)) + 1.0);
} else {
tmp = 0.25 / (re * 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 = re * (im * im)
if (re <= (-1.16d+156)) then
tmp = 0.08333333333333333d0 + (re * (re * 0.016666666666666666d0))
else if (re <= (-1d-132)) then
tmp = ((re * re) - (0.25d0 * (t_0 * t_0))) / (re + ((re * im) * (im * (-0.5d0))))
else if ((re <= 1.9d-242) .or. (.not. (re <= 3d-191))) then
tmp = re * ((0.5d0 * (im * im)) + 1.0d0)
else
tmp = 0.25d0 / (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = re * (im * im);
double tmp;
if (re <= -1.16e+156) {
tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666));
} else if (re <= -1e-132) {
tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5)));
} else if ((re <= 1.9e-242) || !(re <= 3e-191)) {
tmp = re * ((0.5 * (im * im)) + 1.0);
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
def code(re, im): t_0 = re * (im * im) tmp = 0 if re <= -1.16e+156: tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)) elif re <= -1e-132: tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5))) elif (re <= 1.9e-242) or not (re <= 3e-191): tmp = re * ((0.5 * (im * im)) + 1.0) else: tmp = 0.25 / (re * re) return tmp
function code(re, im) t_0 = Float64(re * Float64(im * im)) tmp = 0.0 if (re <= -1.16e+156) tmp = Float64(0.08333333333333333 + Float64(re * Float64(re * 0.016666666666666666))); elseif (re <= -1e-132) tmp = Float64(Float64(Float64(re * re) - Float64(0.25 * Float64(t_0 * t_0))) / Float64(re + Float64(Float64(re * im) * Float64(im * -0.5)))); elseif ((re <= 1.9e-242) || !(re <= 3e-191)) tmp = Float64(re * Float64(Float64(0.5 * Float64(im * im)) + 1.0)); else tmp = Float64(0.25 / Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) t_0 = re * (im * im); tmp = 0.0; if (re <= -1.16e+156) tmp = 0.08333333333333333 + (re * (re * 0.016666666666666666)); elseif (re <= -1e-132) tmp = ((re * re) - (0.25 * (t_0 * t_0))) / (re + ((re * im) * (im * -0.5))); elseif ((re <= 1.9e-242) || ~((re <= 3e-191))) tmp = re * ((0.5 * (im * im)) + 1.0); else tmp = 0.25 / (re * re); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(im * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1.16e+156], N[(0.08333333333333333 + N[(re * N[(re * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, -1e-132], N[(N[(N[(re * re), $MachinePrecision] - N[(0.25 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(re + N[(N[(re * im), $MachinePrecision] * N[(im * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[re, 1.9e-242], N[Not[LessEqual[re, 3e-191]], $MachinePrecision]], N[(re * N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := re \cdot \left(im \cdot im\right)\\
\mathbf{if}\;re \leq -1.16 \cdot 10^{+156}:\\
\;\;\;\;0.08333333333333333 + re \cdot \left(re \cdot 0.016666666666666666\right)\\
\mathbf{elif}\;re \leq -1 \cdot 10^{-132}:\\
\;\;\;\;\frac{re \cdot re - 0.25 \cdot \left(t_0 \cdot t_0\right)}{re + \left(re \cdot im\right) \cdot \left(im \cdot -0.5\right)}\\
\mathbf{elif}\;re \leq 1.9 \cdot 10^{-242} \lor \neg \left(re \leq 3 \cdot 10^{-191}\right):\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if re < -1.16e156Initial program 100.0%
distribute-lft-in99.9%
*-commutative99.9%
cancel-sign-sub99.9%
distribute-lft-neg-out99.9%
*-commutative99.9%
distribute-rgt-neg-out99.9%
neg-mul-199.9%
associate-*r*99.9%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr6.6%
Taylor expanded in re around 0 34.3%
*-commutative34.3%
fma-def34.3%
unpow234.3%
associate-*r/34.3%
metadata-eval34.3%
unpow234.3%
Simplified34.3%
Taylor expanded in re around inf 34.3%
+-commutative34.3%
*-commutative34.3%
unpow234.3%
associate-*l*34.3%
Simplified34.3%
if -1.16e156 < re < -9.9999999999999999e-133Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 73.6%
Simplified73.6%
Taylor expanded in re around 0 42.0%
unpow242.0%
Simplified42.0%
distribute-rgt-in42.0%
*-un-lft-identity42.0%
flip-+47.3%
associate-*r*47.3%
associate-*l*47.3%
*-commutative47.3%
associate-*r*47.3%
associate-*l*47.3%
*-commutative47.3%
associate-*r*47.3%
associate-*l*48.8%
*-commutative48.8%
Applied egg-rr48.8%
*-commutative48.8%
associate-*l*48.8%
associate-*l*48.8%
unpow248.8%
*-commutative48.8%
associate-*l*48.8%
associate-*l*48.8%
unpow248.8%
swap-sqr48.8%
metadata-eval48.8%
*-commutative48.8%
unpow248.8%
*-commutative48.8%
unpow248.8%
Simplified48.8%
if -9.9999999999999999e-133 < re < 1.9000000000000001e-242 or 3.0000000000000001e-191 < re Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 74.8%
Simplified74.8%
Taylor expanded in re around 0 54.0%
unpow254.0%
Simplified54.0%
if 1.9000000000000001e-242 < re < 3.0000000000000001e-191Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr86.0%
Taylor expanded in re around 0 86.0%
unpow286.0%
Simplified86.0%
Final simplification52.1%
(FPCore (re im)
:precision binary64
(if (<= im 9.2e-7)
re
(if (or (<= im 1.25e+100) (and (not (<= im 9.2e+112)) (<= im 2.8e+170)))
(/ 0.25 (* re re))
(* im (* im (* 0.5 re))))))
double code(double re, double im) {
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else if ((im <= 1.25e+100) || (!(im <= 9.2e+112) && (im <= 2.8e+170))) {
tmp = 0.25 / (re * re);
} else {
tmp = im * (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 (im <= 9.2d-7) then
tmp = re
else if ((im <= 1.25d+100) .or. (.not. (im <= 9.2d+112)) .and. (im <= 2.8d+170)) then
tmp = 0.25d0 / (re * re)
else
tmp = im * (im * (0.5d0 * re))
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else if ((im <= 1.25e+100) || (!(im <= 9.2e+112) && (im <= 2.8e+170))) {
tmp = 0.25 / (re * re);
} else {
tmp = im * (im * (0.5 * re));
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.2e-7: tmp = re elif (im <= 1.25e+100) or (not (im <= 9.2e+112) and (im <= 2.8e+170)): tmp = 0.25 / (re * re) else: tmp = im * (im * (0.5 * re)) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.2e-7) tmp = re; elseif ((im <= 1.25e+100) || (!(im <= 9.2e+112) && (im <= 2.8e+170))) tmp = Float64(0.25 / Float64(re * re)); else tmp = Float64(im * Float64(im * Float64(0.5 * re))); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.2e-7) tmp = re; elseif ((im <= 1.25e+100) || (~((im <= 9.2e+112)) && (im <= 2.8e+170))) tmp = 0.25 / (re * re); else tmp = im * (im * (0.5 * re)); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.2e-7], re, If[Or[LessEqual[im, 1.25e+100], And[N[Not[LessEqual[im, 9.2e+112]], $MachinePrecision], LessEqual[im, 2.8e+170]]], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision], N[(im * N[(im * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.2 \cdot 10^{-7}:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 1.25 \cdot 10^{+100} \lor \neg \left(im \leq 9.2 \cdot 10^{+112}\right) \land im \leq 2.8 \cdot 10^{+170}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(im \cdot \left(0.5 \cdot re\right)\right)\\
\end{array}
\end{array}
if im < 9.1999999999999998e-7Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.1%
Simplified84.1%
Taylor expanded in re around 0 51.8%
unpow251.8%
Simplified51.8%
Taylor expanded in im around 0 37.6%
if 9.1999999999999998e-7 < im < 1.25e100 or 9.1999999999999999e112 < im < 2.80000000000000015e170Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr25.7%
Taylor expanded in re around 0 25.0%
unpow225.0%
Simplified25.0%
if 1.25e100 < im < 9.1999999999999999e112 or 2.80000000000000015e170 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 82.5%
Simplified82.5%
Taylor expanded in im around inf 82.5%
unpow282.5%
associate-*r*61.4%
*-commutative61.4%
associate-*l*61.4%
associate-*r*61.4%
Simplified61.4%
Taylor expanded in re around 0 53.1%
*-commutative53.1%
associate-*l*53.1%
Simplified53.1%
Final simplification37.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (/ 0.25 (* re re))))
(if (<= im 9.2e-7)
re
(if (<= im 1e+100)
t_0
(if (<= im 9.5e+112)
(* im (* im (* 0.5 re)))
(if (<= im 5.4e+153) t_0 (* re (* 0.5 (* im im)))))))))
double code(double re, double im) {
double t_0 = 0.25 / (re * re);
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else if (im <= 1e+100) {
tmp = t_0;
} else if (im <= 9.5e+112) {
tmp = im * (im * (0.5 * re));
} else if (im <= 5.4e+153) {
tmp = t_0;
} else {
tmp = re * (0.5 * (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.25d0 / (re * re)
if (im <= 9.2d-7) then
tmp = re
else if (im <= 1d+100) then
tmp = t_0
else if (im <= 9.5d+112) then
tmp = im * (im * (0.5d0 * re))
else if (im <= 5.4d+153) then
tmp = t_0
else
tmp = re * (0.5d0 * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.25 / (re * re);
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else if (im <= 1e+100) {
tmp = t_0;
} else if (im <= 9.5e+112) {
tmp = im * (im * (0.5 * re));
} else if (im <= 5.4e+153) {
tmp = t_0;
} else {
tmp = re * (0.5 * (im * im));
}
return tmp;
}
def code(re, im): t_0 = 0.25 / (re * re) tmp = 0 if im <= 9.2e-7: tmp = re elif im <= 1e+100: tmp = t_0 elif im <= 9.5e+112: tmp = im * (im * (0.5 * re)) elif im <= 5.4e+153: tmp = t_0 else: tmp = re * (0.5 * (im * im)) return tmp
function code(re, im) t_0 = Float64(0.25 / Float64(re * re)) tmp = 0.0 if (im <= 9.2e-7) tmp = re; elseif (im <= 1e+100) tmp = t_0; elseif (im <= 9.5e+112) tmp = Float64(im * Float64(im * Float64(0.5 * re))); elseif (im <= 5.4e+153) tmp = t_0; else tmp = Float64(re * Float64(0.5 * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.25 / (re * re); tmp = 0.0; if (im <= 9.2e-7) tmp = re; elseif (im <= 1e+100) tmp = t_0; elseif (im <= 9.5e+112) tmp = im * (im * (0.5 * re)); elseif (im <= 5.4e+153) tmp = t_0; else tmp = re * (0.5 * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 9.2e-7], re, If[LessEqual[im, 1e+100], t$95$0, If[LessEqual[im, 9.5e+112], N[(im * N[(im * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 5.4e+153], t$95$0, N[(re * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.25}{re \cdot re}\\
\mathbf{if}\;im \leq 9.2 \cdot 10^{-7}:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 10^{+100}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 9.5 \cdot 10^{+112}:\\
\;\;\;\;im \cdot \left(im \cdot \left(0.5 \cdot re\right)\right)\\
\mathbf{elif}\;im \leq 5.4 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 9.1999999999999998e-7Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.1%
Simplified84.1%
Taylor expanded in re around 0 51.8%
unpow251.8%
Simplified51.8%
Taylor expanded in im around 0 37.6%
if 9.1999999999999998e-7 < im < 1.00000000000000002e100 or 9.5000000000000008e112 < im < 5.4000000000000001e153Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr24.4%
Taylor expanded in re around 0 23.7%
unpow223.7%
Simplified23.7%
if 1.00000000000000002e100 < im < 9.5000000000000008e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.3%
Simplified5.3%
Taylor expanded in im around inf 5.3%
unpow25.3%
associate-*r*5.3%
*-commutative5.3%
associate-*l*5.3%
associate-*r*5.3%
Simplified5.3%
Taylor expanded in re around 0 80.6%
*-commutative80.6%
associate-*l*80.6%
Simplified80.6%
if 5.4000000000000001e153 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
unpow275.0%
Simplified75.0%
Taylor expanded in im around inf 75.0%
associate-*r*75.0%
unpow275.0%
Simplified75.0%
Final simplification39.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (+ 0.08333333333333333 (/ 0.25 (* re re)))))
(if (<= im 9.2e-7)
re
(if (<= im 8.8e+99)
t_0
(if (<= im 9.2e+112)
(* im (* im (* 0.5 re)))
(if (<= im 3.7e+152) t_0 (* re (* 0.5 (* im im)))))))))
double code(double re, double im) {
double t_0 = 0.08333333333333333 + (0.25 / (re * re));
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else if (im <= 8.8e+99) {
tmp = t_0;
} else if (im <= 9.2e+112) {
tmp = im * (im * (0.5 * re));
} else if (im <= 3.7e+152) {
tmp = t_0;
} else {
tmp = re * (0.5 * (im * im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = 0.08333333333333333d0 + (0.25d0 / (re * re))
if (im <= 9.2d-7) then
tmp = re
else if (im <= 8.8d+99) then
tmp = t_0
else if (im <= 9.2d+112) then
tmp = im * (im * (0.5d0 * re))
else if (im <= 3.7d+152) then
tmp = t_0
else
tmp = re * (0.5d0 * (im * im))
end if
code = tmp
end function
public static double code(double re, double im) {
double t_0 = 0.08333333333333333 + (0.25 / (re * re));
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else if (im <= 8.8e+99) {
tmp = t_0;
} else if (im <= 9.2e+112) {
tmp = im * (im * (0.5 * re));
} else if (im <= 3.7e+152) {
tmp = t_0;
} else {
tmp = re * (0.5 * (im * im));
}
return tmp;
}
def code(re, im): t_0 = 0.08333333333333333 + (0.25 / (re * re)) tmp = 0 if im <= 9.2e-7: tmp = re elif im <= 8.8e+99: tmp = t_0 elif im <= 9.2e+112: tmp = im * (im * (0.5 * re)) elif im <= 3.7e+152: tmp = t_0 else: tmp = re * (0.5 * (im * im)) return tmp
function code(re, im) t_0 = Float64(0.08333333333333333 + Float64(0.25 / Float64(re * re))) tmp = 0.0 if (im <= 9.2e-7) tmp = re; elseif (im <= 8.8e+99) tmp = t_0; elseif (im <= 9.2e+112) tmp = Float64(im * Float64(im * Float64(0.5 * re))); elseif (im <= 3.7e+152) tmp = t_0; else tmp = Float64(re * Float64(0.5 * Float64(im * im))); end return tmp end
function tmp_2 = code(re, im) t_0 = 0.08333333333333333 + (0.25 / (re * re)); tmp = 0.0; if (im <= 9.2e-7) tmp = re; elseif (im <= 8.8e+99) tmp = t_0; elseif (im <= 9.2e+112) tmp = im * (im * (0.5 * re)); elseif (im <= 3.7e+152) tmp = t_0; else tmp = re * (0.5 * (im * im)); end tmp_2 = tmp; end
code[re_, im_] := Block[{t$95$0 = N[(0.08333333333333333 + N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 9.2e-7], re, If[LessEqual[im, 8.8e+99], t$95$0, If[LessEqual[im, 9.2e+112], N[(im * N[(im * N[(0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.7e+152], t$95$0, N[(re * N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.08333333333333333 + \frac{0.25}{re \cdot re}\\
\mathbf{if}\;im \leq 9.2 \cdot 10^{-7}:\\
\;\;\;\;re\\
\mathbf{elif}\;im \leq 8.8 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 9.2 \cdot 10^{+112}:\\
\;\;\;\;im \cdot \left(im \cdot \left(0.5 \cdot re\right)\right)\\
\mathbf{elif}\;im \leq 3.7 \cdot 10^{+152}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot im\right)\right)\\
\end{array}
\end{array}
if im < 9.1999999999999998e-7Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.1%
Simplified84.1%
Taylor expanded in re around 0 51.8%
unpow251.8%
Simplified51.8%
Taylor expanded in im around 0 37.6%
if 9.1999999999999998e-7 < im < 8.79999999999999913e99 or 9.1999999999999999e112 < im < 3.69999999999999996e152Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr24.4%
Taylor expanded in re around 0 24.3%
associate-*r/24.3%
metadata-eval24.3%
unpow224.3%
Simplified24.3%
if 8.79999999999999913e99 < im < 9.1999999999999999e112Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 5.3%
Simplified5.3%
Taylor expanded in im around inf 5.3%
unpow25.3%
associate-*r*5.3%
*-commutative5.3%
associate-*l*5.3%
associate-*r*5.3%
Simplified5.3%
Taylor expanded in re around 0 80.6%
*-commutative80.6%
associate-*l*80.6%
Simplified80.6%
if 3.69999999999999996e152 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 100.0%
Simplified100.0%
Taylor expanded in re around 0 75.0%
unpow275.0%
Simplified75.0%
Taylor expanded in im around inf 75.0%
associate-*r*75.0%
unpow275.0%
Simplified75.0%
Final simplification39.9%
(FPCore (re im) :precision binary64 (if (or (<= re 2e-242) (not (<= re 3e-191))) (* re (+ (* 0.5 (* im im)) 1.0)) (/ 0.25 (* re re))))
double code(double re, double im) {
double tmp;
if ((re <= 2e-242) || !(re <= 3e-191)) {
tmp = re * ((0.5 * (im * im)) + 1.0);
} else {
tmp = 0.25 / (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 <= 2d-242) .or. (.not. (re <= 3d-191))) then
tmp = re * ((0.5d0 * (im * im)) + 1.0d0)
else
tmp = 0.25d0 / (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((re <= 2e-242) || !(re <= 3e-191)) {
tmp = re * ((0.5 * (im * im)) + 1.0);
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if (re <= 2e-242) or not (re <= 3e-191): tmp = re * ((0.5 * (im * im)) + 1.0) else: tmp = 0.25 / (re * re) return tmp
function code(re, im) tmp = 0.0 if ((re <= 2e-242) || !(re <= 3e-191)) tmp = Float64(re * Float64(Float64(0.5 * Float64(im * im)) + 1.0)); else tmp = Float64(0.25 / Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((re <= 2e-242) || ~((re <= 3e-191))) tmp = re * ((0.5 * (im * im)) + 1.0); else tmp = 0.25 / (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[Or[LessEqual[re, 2e-242], N[Not[LessEqual[re, 3e-191]], $MachinePrecision]], N[(re * N[(N[(0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq 2 \cdot 10^{-242} \lor \neg \left(re \leq 3 \cdot 10^{-191}\right):\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot im\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if re < 2e-242 or 3.0000000000000001e-191 < re Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 73.3%
Simplified73.3%
Taylor expanded in re around 0 47.1%
unpow247.1%
Simplified47.1%
if 2e-242 < re < 3.0000000000000001e-191Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr86.0%
Taylor expanded in re around 0 86.0%
unpow286.0%
Simplified86.0%
Final simplification49.2%
(FPCore (re im) :precision binary64 (if (<= im 9.2e-7) re (/ 0.25 (* re re))))
double code(double re, double im) {
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else {
tmp = 0.25 / (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 <= 9.2d-7) then
tmp = re
else
tmp = 0.25d0 / (re * re)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if (im <= 9.2e-7) {
tmp = re;
} else {
tmp = 0.25 / (re * re);
}
return tmp;
}
def code(re, im): tmp = 0 if im <= 9.2e-7: tmp = re else: tmp = 0.25 / (re * re) return tmp
function code(re, im) tmp = 0.0 if (im <= 9.2e-7) tmp = re; else tmp = Float64(0.25 / Float64(re * re)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if (im <= 9.2e-7) tmp = re; else tmp = 0.25 / (re * re); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[im, 9.2e-7], re, N[(0.25 / N[(re * re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;im \leq 9.2 \cdot 10^{-7}:\\
\;\;\;\;re\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25}{re \cdot re}\\
\end{array}
\end{array}
if im < 9.1999999999999998e-7Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 84.1%
Simplified84.1%
Taylor expanded in re around 0 51.8%
unpow251.8%
Simplified51.8%
Taylor expanded in im around 0 37.6%
if 9.1999999999999998e-7 < im Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr22.0%
Taylor expanded in re around 0 21.5%
unpow221.5%
Simplified21.5%
Final simplification33.3%
(FPCore (re im) :precision binary64 0.08333333333333333)
double code(double re, double im) {
return 0.08333333333333333;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 0.08333333333333333d0
end function
public static double code(double re, double im) {
return 0.08333333333333333;
}
def code(re, im): return 0.08333333333333333
function code(re, im) return 0.08333333333333333 end
function tmp = code(re, im) tmp = 0.08333333333333333; end
code[re_, im_] := 0.08333333333333333
\begin{array}{l}
\\
0.08333333333333333
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Applied egg-rr14.1%
Taylor expanded in re around 0 13.9%
associate-*r/13.9%
metadata-eval13.9%
unpow213.9%
Simplified13.9%
Taylor expanded in re around inf 4.4%
Final simplification4.4%
(FPCore (re im) :precision binary64 re)
double code(double re, double im) {
return re;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re
end function
public static double code(double re, double im) {
return re;
}
def code(re, im): return re
function code(re, im) return re end
function tmp = code(re, im) tmp = re; end
code[re_, im_] := re
\begin{array}{l}
\\
re
\end{array}
Initial program 100.0%
distribute-lft-in100.0%
*-commutative100.0%
cancel-sign-sub100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
distribute-rgt-neg-out100.0%
neg-mul-1100.0%
associate-*r*100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
neg-sub0100.0%
*-commutative100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in im around 0 71.7%
Simplified71.7%
Taylor expanded in re around 0 47.0%
unpow247.0%
Simplified47.0%
Taylor expanded in im around 0 28.2%
Final simplification28.2%
herbie shell --seed 2023271
(FPCore (re im)
:name "math.sin on complex, real part"
:precision binary64
(* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))