
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp (- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im))))
(t_1 (* y.re (atan2 x.im x.re))))
(if (<= x.re -100000000.0)
t_0
(if (<= x.re -4e-310)
(* t_0 (+ (cos t_1) (* (sin t_1) (* y.im (log (/ -1.0 x.re))))))
(* t_0 (cos (+ t_1 (* y.im (log x.re)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -100000000.0) {
tmp = t_0;
} else if (x_46_re <= -4e-310) {
tmp = t_0 * (cos(t_1) + (sin(t_1) * (y_46_im * log((-1.0 / x_46_re)))));
} else {
tmp = t_0 * cos((t_1 + (y_46_im * log(x_46_re))));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -100000000.0) {
tmp = t_0;
} else if (x_46_re <= -4e-310) {
tmp = t_0 * (Math.cos(t_1) + (Math.sin(t_1) * (y_46_im * Math.log((-1.0 / x_46_re)))));
} else {
tmp = t_0 * Math.cos((t_1 + (y_46_im * Math.log(x_46_re))));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) t_1 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -100000000.0: tmp = t_0 elif x_46_re <= -4e-310: tmp = t_0 * (math.cos(t_1) + (math.sin(t_1) * (y_46_im * math.log((-1.0 / x_46_re))))) else: tmp = t_0 * math.cos((t_1 + (y_46_im * math.log(x_46_re)))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -100000000.0) tmp = t_0; elseif (x_46_re <= -4e-310) tmp = Float64(t_0 * Float64(cos(t_1) + Float64(sin(t_1) * Float64(y_46_im * log(Float64(-1.0 / x_46_re)))))); else tmp = Float64(t_0 * cos(Float64(t_1 + Float64(y_46_im * log(x_46_re))))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); t_1 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -100000000.0) tmp = t_0; elseif (x_46_re <= -4e-310) tmp = t_0 * (cos(t_1) + (sin(t_1) * (y_46_im * log((-1.0 / x_46_re))))); else tmp = t_0 * cos((t_1 + (y_46_im * log(x_46_re)))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -100000000.0], t$95$0, If[LessEqual[x$46$re, -4e-310], N[(t$95$0 * N[(N[Cos[t$95$1], $MachinePrecision] + N[(N[Sin[t$95$1], $MachinePrecision] * N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(t$95$1 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -100000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.re \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(\cos t_1 + \sin t_1 \cdot \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(t_1 + y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -1e8Initial program 22.7%
Simplified74.2%
Taylor expanded in y.im around 0 84.8%
Taylor expanded in y.re around 0 92.4%
if -1e8 < x.re < -3.999999999999988e-310Initial program 51.4%
Simplified81.9%
Taylor expanded in x.re around -inf 77.8%
+-commutative77.8%
mul-1-neg77.8%
*-commutative77.8%
unsub-neg77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in y.im around 0 87.5%
if -3.999999999999988e-310 < x.re Initial program 40.6%
Simplified79.9%
Taylor expanded in x.im around 0 80.9%
Final simplification85.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.re -0.00024)
t_1
(* t_1 (cos (fma t_0 y.im (* y.re (atan2 x.im x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= -0.00024) {
tmp = t_1;
} else {
tmp = t_1 * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_re <= -0.00024) tmp = t_1; else tmp = Float64(t_1 * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -0.00024], t$95$1, N[(t$95$1 * N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.re \leq -0.00024:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\end{array}
\end{array}
if x.re < -2.40000000000000006e-4Initial program 22.1%
Simplified72.1%
Taylor expanded in y.im around 0 82.4%
Taylor expanded in y.re around 0 91.2%
if -2.40000000000000006e-4 < x.re Initial program 45.1%
Simplified81.5%
Final simplification84.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.re 2e-187)
t_0
(* t_0 (cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= 2e-187) {
tmp = t_0;
} else {
tmp = t_0 * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_re))));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= 2e-187) {
tmp = t_0;
} else {
tmp = t_0 * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (y_46_im * Math.log(x_46_re))));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if x_46_re <= 2e-187: tmp = t_0 else: tmp = t_0 * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (y_46_im * math.log(x_46_re)))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_re <= 2e-187) tmp = t_0; else tmp = Float64(t_0 * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(y_46_im * log(x_46_re))))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (x_46_re <= 2e-187) tmp = t_0; else tmp = t_0 * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_re)))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, 2e-187], t$95$0, N[(t$95$0 * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.re \leq 2 \cdot 10^{-187}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < 2e-187Initial program 39.5%
Simplified79.6%
Taylor expanded in y.im around 0 82.7%
Taylor expanded in y.re around 0 85.8%
if 2e-187 < x.re Initial program 38.2%
Simplified78.0%
Taylor expanded in x.im around 0 79.2%
Final simplification83.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.re -0.0001) t_0 (* t_0 (cos (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= -0.0001) {
tmp = t_0;
} else {
tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= -0.0001) {
tmp = t_0;
} else {
tmp = t_0 * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if x_46_re <= -0.0001: tmp = t_0 else: tmp = t_0 * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_re <= -0.0001) tmp = t_0; else tmp = Float64(t_0 * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (x_46_re <= -0.0001) tmp = t_0; else tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -0.0001], t$95$0, N[(t$95$0 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.re \leq -0.0001:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if x.re < -1.00000000000000005e-4Initial program 22.1%
Simplified72.1%
Taylor expanded in y.im around 0 82.4%
Taylor expanded in y.re around 0 91.2%
if -1.00000000000000005e-4 < x.re Initial program 45.1%
Simplified81.5%
Taylor expanded in y.im around 0 80.1%
Final simplification83.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\end{array}
Initial program 39.0%
Simplified79.0%
Taylor expanded in y.im around 0 80.7%
Taylor expanded in y.re around 0 81.0%
Final simplification81.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (exp (* y.re (- (log (/ -1.0 x.im)))))))
(if (<= x.im -9.5e+181)
t_0
(if (<= x.im -1.42e+156)
(exp (* (atan2 x.im x.re) (- y.im)))
(if (<= x.im -1e-310)
t_0
(exp (- (* y.re (log x.im)) (* (atan2 x.im x.re) y.im))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = exp((y_46_re * -log((-1.0 / x_46_im))));
double tmp;
if (x_46_im <= -9.5e+181) {
tmp = t_0;
} else if (x_46_im <= -1.42e+156) {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else if (x_46_im <= -1e-310) {
tmp = t_0;
} else {
tmp = exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = exp((y_46re * -log(((-1.0d0) / x_46im))))
if (x_46im <= (-9.5d+181)) then
tmp = t_0
else if (x_46im <= (-1.42d+156)) then
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
else if (x_46im <= (-1d-310)) then
tmp = t_0
else
tmp = exp(((y_46re * log(x_46im)) - (atan2(x_46im, x_46re) * y_46im)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.exp((y_46_re * -Math.log((-1.0 / x_46_im))));
double tmp;
if (x_46_im <= -9.5e+181) {
tmp = t_0;
} else if (x_46_im <= -1.42e+156) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else if (x_46_im <= -1e-310) {
tmp = t_0;
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_im)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp((y_46_re * -math.log((-1.0 / x_46_im)))) tmp = 0 if x_46_im <= -9.5e+181: tmp = t_0 elif x_46_im <= -1.42e+156: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) elif x_46_im <= -1e-310: tmp = t_0 else: tmp = math.exp(((y_46_re * math.log(x_46_im)) - (math.atan2(x_46_im, x_46_re) * y_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(y_46_re * Float64(-log(Float64(-1.0 / x_46_im))))) tmp = 0.0 if (x_46_im <= -9.5e+181) tmp = t_0; elseif (x_46_im <= -1.42e+156) tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); elseif (x_46_im <= -1e-310) tmp = t_0; else tmp = exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(atan(x_46_im, x_46_re) * y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp((y_46_re * -log((-1.0 / x_46_im)))); tmp = 0.0; if (x_46_im <= -9.5e+181) tmp = t_0; elseif (x_46_im <= -1.42e+156) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); elseif (x_46_im <= -1e-310) tmp = t_0; else tmp = exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(y$46$re * (-N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -9.5e+181], t$95$0, If[LessEqual[x$46$im, -1.42e+156], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], If[LessEqual[x$46$im, -1e-310], t$95$0, N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{y.re \cdot \left(-\log \left(\frac{-1}{x.im}\right)\right)}\\
\mathbf{if}\;x.im \leq -9.5 \cdot 10^{+181}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq -1.42 \cdot 10^{+156}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{elif}\;x.im \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.im < -9.50000000000000032e181 or -1.41999999999999998e156 < x.im < -9.999999999999969e-311Initial program 45.7%
Simplified83.6%
Taylor expanded in y.im around 0 82.5%
Taylor expanded in y.re around 0 83.1%
Taylor expanded in y.re around inf 60.2%
unpow260.2%
unpow260.2%
hypot-def68.6%
hypot-def60.2%
unpow260.2%
unpow260.2%
+-commutative60.2%
unpow260.2%
unpow260.2%
hypot-def68.6%
log-pow68.6%
hypot-def60.2%
unpow260.2%
unpow260.2%
+-commutative60.2%
unpow260.2%
unpow260.2%
hypot-def68.6%
Simplified68.6%
Taylor expanded in x.im around -inf 58.8%
mul-1-neg58.8%
*-commutative58.8%
distribute-rgt-neg-in58.8%
Simplified58.8%
if -9.50000000000000032e181 < x.im < -1.41999999999999998e156Initial program 0.0%
Simplified76.9%
Taylor expanded in y.im around 0 100.0%
Taylor expanded in y.re around 0 100.0%
Taylor expanded in y.re around 0 92.5%
mul-1-neg92.5%
*-commutative92.5%
distribute-lft-neg-in92.5%
*-commutative92.5%
Simplified92.5%
if -9.999999999999969e-311 < x.im Initial program 36.1%
Taylor expanded in y.im around 0 62.1%
Taylor expanded in y.re around 0 62.1%
Taylor expanded in x.re around 0 70.6%
Final simplification65.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -30500.0) (not (<= y.re 10.0))) (exp (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))) (exp (* (atan2 x.im x.re) (- y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -30500.0) || !(y_46_re <= 10.0)) {
tmp = exp((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))));
} else {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46re <= (-30500.0d0)) .or. (.not. (y_46re <= 10.0d0))) then
tmp = exp((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))))
else
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -30500.0) || !(y_46_re <= 10.0)) {
tmp = Math.exp((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))));
} else {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -30500.0) or not (y_46_re <= 10.0): tmp = math.exp((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))))) else: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -30500.0) || !(y_46_re <= 10.0)) tmp = exp(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))))); else tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_re <= -30500.0) || ~((y_46_re <= 10.0))) tmp = exp((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))))); else tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -30500.0], N[Not[LessEqual[y$46$re, 10.0]], $MachinePrecision]], N[Exp[N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -30500 \lor \neg \left(y.re \leq 10\right):\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -30500 or 10 < y.re Initial program 36.5%
Simplified75.4%
Taylor expanded in y.im around 0 78.6%
Taylor expanded in y.re around 0 79.4%
Taylor expanded in y.re around inf 74.8%
+-commutative74.8%
unpow274.8%
unpow274.8%
Simplified74.8%
if -30500 < y.re < 10Initial program 41.4%
Simplified82.5%
Taylor expanded in y.im around 0 82.7%
Taylor expanded in y.re around 0 82.5%
Taylor expanded in y.re around 0 81.0%
mul-1-neg81.0%
*-commutative81.0%
distribute-lft-neg-in81.0%
*-commutative81.0%
Simplified81.0%
Final simplification78.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.re 1.02e-247) (exp (* (atan2 x.im x.re) (- y.im))) (exp (- (* y.re (log x.re)) (* (atan2 x.im x.re) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 1.02e-247) {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46re <= 1.02d-247) then
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
else
tmp = exp(((y_46re * log(x_46re)) - (atan2(x_46im, x_46re) * y_46im)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 1.02e-247) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_re <= 1.02e-247: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - (math.atan2(x_46_im, x_46_re) * y_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_re <= 1.02e-247) tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - Float64(atan(x_46_im, x_46_re) * y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_re <= 1.02e-247) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = exp(((y_46_re * log(x_46_re)) - (atan2(x_46_im, x_46_re) * y_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$re, 1.02e-247], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 1.02 \cdot 10^{-247}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.re < 1.01999999999999994e-247Initial program 39.2%
Simplified79.1%
Taylor expanded in y.im around 0 81.8%
Taylor expanded in y.re around 0 85.1%
Taylor expanded in y.re around 0 61.6%
mul-1-neg61.6%
*-commutative61.6%
distribute-lft-neg-in61.6%
*-commutative61.6%
Simplified61.6%
if 1.01999999999999994e-247 < x.re Initial program 38.8%
Taylor expanded in y.im around 0 63.5%
Taylor expanded in y.re around 0 59.8%
Taylor expanded in x.re around inf 67.6%
Final simplification64.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.re 1.2e+28) (exp (* (atan2 x.im x.re) (- y.im))) (exp (* y.re (log x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 1.2e+28) {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = exp((y_46_re * log(x_46_re)));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46re <= 1.2d+28) then
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
else
tmp = exp((y_46re * log(x_46re)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 1.2e+28) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.exp((y_46_re * Math.log(x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_re <= 1.2e+28: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.exp((y_46_re * math.log(x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_re <= 1.2e+28) tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); else tmp = exp(Float64(y_46_re * log(x_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_re <= 1.2e+28) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = exp((y_46_re * log(x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$re, 1.2e+28], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[Exp[N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 1.2 \cdot 10^{+28}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re}\\
\end{array}
\end{array}
if x.re < 1.19999999999999991e28Initial program 41.7%
Simplified78.5%
Taylor expanded in y.im around 0 80.9%
Taylor expanded in y.re around 0 82.3%
Taylor expanded in y.re around 0 57.1%
mul-1-neg57.1%
*-commutative57.1%
distribute-lft-neg-in57.1%
*-commutative57.1%
Simplified57.1%
if 1.19999999999999991e28 < x.re Initial program 28.5%
Simplified81.2%
Taylor expanded in y.im around 0 80.0%
Taylor expanded in y.re around 0 75.6%
Taylor expanded in y.re around inf 54.7%
unpow254.7%
unpow254.7%
hypot-def64.4%
hypot-def54.7%
unpow254.7%
unpow254.7%
+-commutative54.7%
unpow254.7%
unpow254.7%
hypot-def64.4%
log-pow64.4%
hypot-def54.7%
unpow254.7%
unpow254.7%
+-commutative54.7%
unpow254.7%
unpow254.7%
hypot-def64.4%
Simplified64.4%
Taylor expanded in x.im around 0 63.7%
log-pow63.7%
Simplified63.7%
Final simplification58.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -1e-310) (exp (* (atan2 x.im x.re) y.im)) (exp (* y.re (log x.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -1e-310) {
tmp = exp((atan2(x_46_im, x_46_re) * y_46_im));
} else {
tmp = exp((y_46_re * log(x_46_im)));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46im <= (-1d-310)) then
tmp = exp((atan2(x_46im, x_46re) * y_46im))
else
tmp = exp((y_46re * log(x_46im)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -1e-310) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * y_46_im));
} else {
tmp = Math.exp((y_46_re * Math.log(x_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_im <= -1e-310: tmp = math.exp((math.atan2(x_46_im, x_46_re) * y_46_im)) else: tmp = math.exp((y_46_re * math.log(x_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= -1e-310) tmp = exp(Float64(atan(x_46_im, x_46_re) * y_46_im)); else tmp = exp(Float64(y_46_re * log(x_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= -1e-310) tmp = exp((atan2(x_46_im, x_46_re) * y_46_im)); else tmp = exp((y_46_re * log(x_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -1e-310], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision], N[Exp[N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1 \cdot 10^{-310}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im}\\
\end{array}
\end{array}
if x.im < -9.999999999999969e-311Initial program 41.4%
Simplified83.0%
Taylor expanded in y.im around 0 84.2%
Taylor expanded in y.re around 0 84.7%
Taylor expanded in y.re around 0 54.1%
mul-1-neg54.1%
*-commutative54.1%
distribute-lft-neg-in54.1%
*-commutative54.1%
Simplified54.1%
*-commutative54.1%
add-sqr-sqrt54.1%
sqrt-unprod54.1%
sqr-neg54.1%
sqrt-unprod0.2%
add-sqr-sqrt36.6%
expm1-log1p-u30.6%
expm1-udef30.6%
Applied egg-rr30.6%
expm1-def30.6%
expm1-log1p36.6%
*-commutative36.6%
Simplified36.6%
if -9.999999999999969e-311 < x.im Initial program 36.1%
Simplified74.2%
Taylor expanded in y.im around 0 76.5%
Taylor expanded in y.re around 0 76.5%
Taylor expanded in y.re around inf 52.9%
unpow252.9%
unpow252.9%
hypot-def57.4%
hypot-def52.9%
unpow252.9%
unpow252.9%
+-commutative52.9%
unpow252.9%
unpow252.9%
hypot-def57.4%
log-pow57.4%
hypot-def52.9%
unpow252.9%
unpow252.9%
+-commutative52.9%
unpow252.9%
unpow252.9%
hypot-def57.4%
Simplified57.4%
Taylor expanded in x.re around 0 51.4%
log-pow51.4%
Simplified51.4%
Final simplification43.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im 2e-233) (exp (* y.re (log x.re))) (exp (* y.re (log x.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= 2e-233) {
tmp = exp((y_46_re * log(x_46_re)));
} else {
tmp = exp((y_46_re * log(x_46_im)));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46im <= 2d-233) then
tmp = exp((y_46re * log(x_46re)))
else
tmp = exp((y_46re * log(x_46im)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= 2e-233) {
tmp = Math.exp((y_46_re * Math.log(x_46_re)));
} else {
tmp = Math.exp((y_46_re * Math.log(x_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_im <= 2e-233: tmp = math.exp((y_46_re * math.log(x_46_re))) else: tmp = math.exp((y_46_re * math.log(x_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= 2e-233) tmp = exp(Float64(y_46_re * log(x_46_re))); else tmp = exp(Float64(y_46_re * log(x_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= 2e-233) tmp = exp((y_46_re * log(x_46_re))); else tmp = exp((y_46_re * log(x_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, 2e-233], N[Exp[N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 2 \cdot 10^{-233}:\\
\;\;\;\;e^{y.re \cdot \log x.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im}\\
\end{array}
\end{array}
if x.im < 1.99999999999999992e-233Initial program 39.4%
Simplified80.8%
Taylor expanded in y.im around 0 83.3%
Taylor expanded in y.re around 0 83.7%
Taylor expanded in y.re around inf 57.4%
unpow257.4%
unpow257.4%
hypot-def66.8%
hypot-def57.4%
unpow257.4%
unpow257.4%
+-commutative57.4%
unpow257.4%
unpow257.4%
hypot-def66.8%
log-pow66.8%
hypot-def57.4%
unpow257.4%
unpow257.4%
+-commutative57.4%
unpow257.4%
unpow257.4%
hypot-def66.8%
Simplified66.8%
Taylor expanded in x.im around 0 40.6%
log-pow25.0%
Simplified25.0%
if 1.99999999999999992e-233 < x.im Initial program 38.5%
Simplified76.3%
Taylor expanded in y.im around 0 76.8%
Taylor expanded in y.re around 0 76.8%
Taylor expanded in y.re around inf 51.6%
unpow251.6%
unpow251.6%
hypot-def56.7%
hypot-def51.6%
unpow251.6%
unpow251.6%
+-commutative51.6%
unpow251.6%
unpow251.6%
hypot-def56.7%
log-pow56.7%
hypot-def51.6%
unpow251.6%
unpow251.6%
+-commutative51.6%
unpow251.6%
unpow251.6%
hypot-def56.7%
Simplified56.7%
Taylor expanded in x.re around 0 54.7%
log-pow54.7%
Simplified54.7%
Final simplification36.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (* y.re (log x.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp((y_46_re * log(x_46_im)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = exp((y_46re * log(x_46im)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp((y_46_re * Math.log(x_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp((y_46_re * math.log(x_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(y_46_re * log(x_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp((y_46_re * log(x_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{y.re \cdot \log x.im}
\end{array}
Initial program 39.0%
Simplified79.0%
Taylor expanded in y.im around 0 80.7%
Taylor expanded in y.re around 0 81.0%
Taylor expanded in y.re around inf 55.1%
unpow255.1%
unpow255.1%
hypot-def62.8%
hypot-def55.1%
unpow255.1%
unpow255.1%
+-commutative55.1%
unpow255.1%
unpow255.1%
hypot-def62.8%
log-pow62.8%
hypot-def55.1%
unpow255.1%
unpow255.1%
+-commutative55.1%
unpow255.1%
unpow255.1%
hypot-def62.8%
Simplified62.8%
Taylor expanded in x.re around 0 39.0%
log-pow23.3%
Simplified23.3%
Final simplification23.3%
herbie shell --seed 2023189
(FPCore (x.re x.im y.re y.im)
:name "powComplex, real part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))