
(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)))
(sin (+ (* 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))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
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))) * sin(((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.sin(((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.sin(((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))) * sin(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))) * sin(((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[Sin[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 \sin \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)))
(sin (+ (* 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))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
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))) * sin(((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.sin(((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.sin(((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))) * sin(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))) * sin(((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[Sin[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 \sin \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 (log (hypot x.re x.im))))
(*
(exp (fma t_0 y.re (* (- (atan2 x.im x.re)) y.im)))
(sin (fma 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(hypot(x_46_re, x_46_im));
return exp(fma(t_0, y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im))) * sin(fma(t_0, y_46_im, (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(hypot(x_46_re, x_46_im)) return Float64(exp(fma(t_0, y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) * sin(fma(t_0, y_46_im, Float64(atan(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[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(t$95$0 * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$0 * y$46$im + 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(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{\mathsf{fma}\left(t\_0, y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)} \cdot \sin \left(\mathsf{fma}\left(t\_0, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)
\end{array}
\end{array}
Initial program 38.0%
Applied rewrites83.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(fma (log (hypot x.re x.im)) y.re (* (- (atan2 x.im x.re)) y.im)))))
(if (<= x.im -5.6e+37)
(* t_0 (sin (fma (log (- x.im)) y.im (* (atan2 x.im x.re) y.re))))
(* t_0 (fma y.im (log (hypot x.im x.re)) (* 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(fma(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_im <= -5.6e+37) {
tmp = t_0 * sin(fma(log(-x_46_im), y_46_im, (atan2(x_46_im, x_46_re) * y_46_re)));
} else {
tmp = t_0 * fma(y_46_im, log(hypot(x_46_im, x_46_re)), (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 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) tmp = 0.0 if (x_46_im <= -5.6e+37) tmp = Float64(t_0 * sin(fma(log(Float64(-x_46_im)), y_46_im, Float64(atan(x_46_im, x_46_re) * y_46_re)))); else tmp = Float64(t_0 * fma(y_46_im, log(hypot(x_46_im, x_46_re)), 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[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -5.6e+37], N[(t$95$0 * N[Sin[N[(N[Log[(-x$46$im)], $MachinePrecision] * y$46$im + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + 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^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)}\\
\mathbf{if}\;x.im \leq -5.6 \cdot 10^{+37}:\\
\;\;\;\;t\_0 \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.im\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if x.im < -5.5999999999999996e37Initial program 26.3%
Applied rewrites84.8%
Taylor expanded in x.im around -inf
lower-*.f6486.6
Applied rewrites86.6%
if -5.5999999999999996e37 < x.im Initial program 41.1%
Applied rewrites83.7%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
Applied rewrites39.8%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6462.8
Applied rewrites62.8%
Taylor expanded in y.im around 0
lower-fma.f64N/A
lower-log.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6481.2
Applied rewrites81.2%
Final simplification82.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(exp
(fma (log (hypot x.re x.im)) y.re (* (- (atan2 x.im x.re)) y.im)))))
(if (<= y.im 3.2e+116)
(* t_1 (fma y.im (log (hypot x.im x.re)) t_0))
(* t_1 t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_im <= 3.2e+116) {
tmp = t_1 * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0);
} else {
tmp = t_1 * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) tmp = 0.0 if (y_46_im <= 3.2e+116) tmp = Float64(t_1 * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0)); else tmp = Float64(t_1 * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, 3.2e+116], N[(t$95$1 * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)}\\
\mathbf{if}\;y.im \leq 3.2 \cdot 10^{+116}:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\end{array}
\end{array}
if y.im < 3.2e116Initial program 39.3%
Applied rewrites84.3%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
Applied rewrites38.5%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6461.7
Applied rewrites61.7%
Taylor expanded in y.im around 0
lower-fma.f64N/A
lower-log.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6483.9
Applied rewrites83.9%
if 3.2e116 < y.im Initial program 32.7%
Applied rewrites82.2%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
Applied rewrites30.6%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6469.6
Applied rewrites69.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (cos t_1))
(t_3 (pow t_0 2.0))
(t_4 (sin t_1))
(t_5 (pow (hypot x.im x.re) y.re))
(t_6 (* (atan2 x.im x.re) t_5))
(t_7 (* (pow (atan2 x.im x.re) 2.0) t_5))
(t_8 (* t_4 t_6))
(t_9 (* t_4 t_5)))
(if (or (<= y.im -0.0035) (not (<= y.im 9e-24)))
(*
(exp (fma (log (hypot x.re x.im)) y.re (* (- (atan2 x.im x.re)) y.im)))
t_1)
(fma
y.im
(fma
-1.0
t_8
(fma
y.im
(fma
-1.0
(* t_2 (* t_0 t_6))
(fma
-0.5
(* t_3 t_9)
(fma
0.5
(* t_4 t_7)
(*
y.im
(fma
-0.16666666666666666
(* t_2 (* (pow t_0 3.0) t_5))
(fma
-0.16666666666666666
(* t_4 (* (pow (atan2 x.im x.re) 3.0) t_5))
(fma 0.5 (* t_2 (* t_0 t_7)) (* 0.5 (* t_3 t_8)))))))))
(* t_2 (* t_0 t_5))))
t_9))))
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_im, x_46_re));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = cos(t_1);
double t_3 = pow(t_0, 2.0);
double t_4 = sin(t_1);
double t_5 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_6 = atan2(x_46_im, x_46_re) * t_5;
double t_7 = pow(atan2(x_46_im, x_46_re), 2.0) * t_5;
double t_8 = t_4 * t_6;
double t_9 = t_4 * t_5;
double tmp;
if ((y_46_im <= -0.0035) || !(y_46_im <= 9e-24)) {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im))) * t_1;
} else {
tmp = fma(y_46_im, fma(-1.0, t_8, fma(y_46_im, fma(-1.0, (t_2 * (t_0 * t_6)), fma(-0.5, (t_3 * t_9), fma(0.5, (t_4 * t_7), (y_46_im * fma(-0.16666666666666666, (t_2 * (pow(t_0, 3.0) * t_5)), fma(-0.16666666666666666, (t_4 * (pow(atan2(x_46_im, x_46_re), 3.0) * t_5)), fma(0.5, (t_2 * (t_0 * t_7)), (0.5 * (t_3 * t_8))))))))), (t_2 * (t_0 * t_5)))), t_9);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_im, x_46_re)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = cos(t_1) t_3 = t_0 ^ 2.0 t_4 = sin(t_1) t_5 = hypot(x_46_im, x_46_re) ^ y_46_re t_6 = Float64(atan(x_46_im, x_46_re) * t_5) t_7 = Float64((atan(x_46_im, x_46_re) ^ 2.0) * t_5) t_8 = Float64(t_4 * t_6) t_9 = Float64(t_4 * t_5) tmp = 0.0 if ((y_46_im <= -0.0035) || !(y_46_im <= 9e-24)) tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) * t_1); else tmp = fma(y_46_im, fma(-1.0, t_8, fma(y_46_im, fma(-1.0, Float64(t_2 * Float64(t_0 * t_6)), fma(-0.5, Float64(t_3 * t_9), fma(0.5, Float64(t_4 * t_7), Float64(y_46_im * fma(-0.16666666666666666, Float64(t_2 * Float64((t_0 ^ 3.0) * t_5)), fma(-0.16666666666666666, Float64(t_4 * Float64((atan(x_46_im, x_46_re) ^ 3.0) * t_5)), fma(0.5, Float64(t_2 * Float64(t_0 * t_7)), Float64(0.5 * Float64(t_3 * t_8))))))))), Float64(t_2 * Float64(t_0 * t_5)))), t_9); 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$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$0, 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Sin[t$95$1], $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$6 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision] * t$95$5), $MachinePrecision]}, Block[{t$95$8 = N[(t$95$4 * t$95$6), $MachinePrecision]}, Block[{t$95$9 = N[(t$95$4 * t$95$5), $MachinePrecision]}, If[Or[LessEqual[y$46$im, -0.0035], N[Not[LessEqual[y$46$im, 9e-24]], $MachinePrecision]], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(y$46$im * N[(-1.0 * t$95$8 + N[(y$46$im * N[(-1.0 * N[(t$95$2 * N[(t$95$0 * t$95$6), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(t$95$3 * t$95$9), $MachinePrecision] + N[(0.5 * N[(t$95$4 * t$95$7), $MachinePrecision] + N[(y$46$im * N[(-0.16666666666666666 * N[(t$95$2 * N[(N[Power[t$95$0, 3.0], $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$4 * N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 3.0], $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$2 * N[(t$95$0 * t$95$7), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$3 * t$95$8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * N[(t$95$0 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$9), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \cos t\_1\\
t_3 := {t\_0}^{2}\\
t_4 := \sin t\_1\\
t_5 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_6 := \tan^{-1}_* \frac{x.im}{x.re} \cdot t\_5\\
t_7 := {\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot t\_5\\
t_8 := t\_4 \cdot t\_6\\
t_9 := t\_4 \cdot t\_5\\
\mathbf{if}\;y.im \leq -0.0035 \lor \neg \left(y.im \leq 9 \cdot 10^{-24}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y.im, \mathsf{fma}\left(-1, t\_8, \mathsf{fma}\left(y.im, \mathsf{fma}\left(-1, t\_2 \cdot \left(t\_0 \cdot t\_6\right), \mathsf{fma}\left(-0.5, t\_3 \cdot t\_9, \mathsf{fma}\left(0.5, t\_4 \cdot t\_7, y.im \cdot \mathsf{fma}\left(-0.16666666666666666, t\_2 \cdot \left({t\_0}^{3} \cdot t\_5\right), \mathsf{fma}\left(-0.16666666666666666, t\_4 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{3} \cdot t\_5\right), \mathsf{fma}\left(0.5, t\_2 \cdot \left(t\_0 \cdot t\_7\right), 0.5 \cdot \left(t\_3 \cdot t\_8\right)\right)\right)\right)\right)\right)\right), t\_2 \cdot \left(t\_0 \cdot t\_5\right)\right)\right), t\_9\right)\\
\end{array}
\end{array}
if y.im < -0.00350000000000000007 or 8.9999999999999995e-24 < y.im Initial program 32.5%
Applied rewrites74.8%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-*.f64N/A
Applied rewrites31.8%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6468.2
Applied rewrites68.2%
if -0.00350000000000000007 < y.im < 8.9999999999999995e-24Initial program 44.1%
Taylor expanded in y.im around 0
Applied rewrites82.1%
Final simplification74.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))))
(if (<= x.im -1e+38)
(* t_1 (sin (+ (* (log (- x.im)) y.im) (* (atan2 x.im x.re) y.re))))
(if (<= x.im 8.8e-39)
(* t_1 (+ (sin t_0) (* y.im (* (cos t_0) (log (hypot x.im x.re))))))
(*
(exp (- (* y.re (log x.im)) (* y.im (atan2 x.im x.re))))
(sin (fma y.im (log x.im) t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_im <= -1e+38) {
tmp = t_1 * sin(((log(-x_46_im) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
} else if (x_46_im <= 8.8e-39) {
tmp = t_1 * (sin(t_0) + (y_46_im * (cos(t_0) * log(hypot(x_46_im, x_46_re)))));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_im <= -1e+38) tmp = Float64(t_1 * sin(Float64(Float64(log(Float64(-x_46_im)) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))); elseif (x_46_im <= 8.8e-39) tmp = Float64(t_1 * Float64(sin(t_0) + Float64(y_46_im * Float64(cos(t_0) * log(hypot(x_46_im, x_46_re)))))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $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$im, -1e+38], N[(t$95$1 * N[Sin[N[(N[(N[Log[(-x$46$im)], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 8.8e-39], N[(t$95$1 * N[(N[Sin[t$95$0], $MachinePrecision] + N[(y$46$im * N[(N[Cos[t$95$0], $MachinePrecision] * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{+38}:\\
\;\;\;\;t\_1 \cdot \sin \left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{elif}\;x.im \leq 8.8 \cdot 10^{-39}:\\
\;\;\;\;t\_1 \cdot \left(\sin t\_0 + y.im \cdot \left(\cos t\_0 \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_0\right)\right)\\
\end{array}
\end{array}
if x.im < -9.99999999999999977e37Initial program 26.3%
Taylor expanded in x.im around -inf
lower-*.f6472.1
Applied rewrites72.1%
if -9.99999999999999977e37 < x.im < 8.80000000000000003e-39Initial program 48.7%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-log.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6466.9
Applied rewrites66.9%
if 8.80000000000000003e-39 < x.im Initial program 30.5%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6476.4
Applied rewrites76.4%
Final simplification71.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.im 8.8e-39)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(+ (sin t_0) (* y.im (* (cos t_0) (log (hypot x.im x.re))))))
(*
(exp (- (* y.re (log x.im)) (* y.im (atan2 x.im x.re))))
(sin (fma y.im (log x.im) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= 8.8e-39) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * (sin(t_0) + (y_46_im * (cos(t_0) * log(hypot(x_46_im, x_46_re)))));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_im <= 8.8e-39) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * Float64(sin(t_0) + Float64(y_46_im * Float64(cos(t_0) * log(hypot(x_46_im, x_46_re)))))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 8.8e-39], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[t$95$0], $MachinePrecision] + N[(y$46$im * N[(N[Cos[t$95$0], $MachinePrecision] * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq 8.8 \cdot 10^{-39}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\sin t\_0 + y.im \cdot \left(\cos t\_0 \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_0\right)\right)\\
\end{array}
\end{array}
if x.im < 8.80000000000000003e-39Initial program 41.8%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-log.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6466.1
Applied rewrites66.1%
if 8.80000000000000003e-39 < x.im Initial program 30.5%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6476.4
Applied rewrites76.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re))
(t_1 (* (atan2 x.im x.re) t_0))
(t_2 (* (pow (atan2 x.im x.re) 2.0) t_0))
(t_3 (log (hypot x.im x.re)))
(t_4 (* y.re (atan2 x.im x.re)))
(t_5 (cos t_4))
(t_6 (sin t_4))
(t_7 (* t_6 t_0))
(t_8 (* t_6 t_1))
(t_9 (pow t_3 2.0)))
(if (<= x.im 230000000.0)
(fma
y.im
(fma
-1.0
t_8
(fma
y.im
(fma
-1.0
(* t_5 (* t_3 t_1))
(fma
-0.5
(* t_9 t_7)
(fma
0.5
(* t_6 t_2)
(*
y.im
(fma
-0.16666666666666666
(* t_5 (* (pow t_3 3.0) t_0))
(fma
-0.16666666666666666
(* t_6 (* (pow (atan2 x.im x.re) 3.0) t_0))
(fma 0.5 (* t_5 (* t_3 t_2)) (* 0.5 (* t_9 t_8)))))))))
(* t_5 (* t_3 t_0))))
t_7)
(*
(exp (- (* y.re (log x.im)) (* y.im (atan2 x.im x.re))))
(sin (fma y.im (log x.im) t_4))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = atan2(x_46_im, x_46_re) * t_0;
double t_2 = pow(atan2(x_46_im, x_46_re), 2.0) * t_0;
double t_3 = log(hypot(x_46_im, x_46_re));
double t_4 = y_46_re * atan2(x_46_im, x_46_re);
double t_5 = cos(t_4);
double t_6 = sin(t_4);
double t_7 = t_6 * t_0;
double t_8 = t_6 * t_1;
double t_9 = pow(t_3, 2.0);
double tmp;
if (x_46_im <= 230000000.0) {
tmp = fma(y_46_im, fma(-1.0, t_8, fma(y_46_im, fma(-1.0, (t_5 * (t_3 * t_1)), fma(-0.5, (t_9 * t_7), fma(0.5, (t_6 * t_2), (y_46_im * fma(-0.16666666666666666, (t_5 * (pow(t_3, 3.0) * t_0)), fma(-0.16666666666666666, (t_6 * (pow(atan2(x_46_im, x_46_re), 3.0) * t_0)), fma(0.5, (t_5 * (t_3 * t_2)), (0.5 * (t_9 * t_8))))))))), (t_5 * (t_3 * t_0)))), t_7);
} else {
tmp = exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_4));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = Float64(atan(x_46_im, x_46_re) * t_0) t_2 = Float64((atan(x_46_im, x_46_re) ^ 2.0) * t_0) t_3 = log(hypot(x_46_im, x_46_re)) t_4 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_5 = cos(t_4) t_6 = sin(t_4) t_7 = Float64(t_6 * t_0) t_8 = Float64(t_6 * t_1) t_9 = t_3 ^ 2.0 tmp = 0.0 if (x_46_im <= 230000000.0) tmp = fma(y_46_im, fma(-1.0, t_8, fma(y_46_im, fma(-1.0, Float64(t_5 * Float64(t_3 * t_1)), fma(-0.5, Float64(t_9 * t_7), fma(0.5, Float64(t_6 * t_2), Float64(y_46_im * fma(-0.16666666666666666, Float64(t_5 * Float64((t_3 ^ 3.0) * t_0)), fma(-0.16666666666666666, Float64(t_6 * Float64((atan(x_46_im, x_46_re) ^ 3.0) * t_0)), fma(0.5, Float64(t_5 * Float64(t_3 * t_2)), Float64(0.5 * Float64(t_9 * t_8))))))))), Float64(t_5 * Float64(t_3 * t_0)))), t_7); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_4))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Cos[t$95$4], $MachinePrecision]}, Block[{t$95$6 = N[Sin[t$95$4], $MachinePrecision]}, Block[{t$95$7 = N[(t$95$6 * t$95$0), $MachinePrecision]}, Block[{t$95$8 = N[(t$95$6 * t$95$1), $MachinePrecision]}, Block[{t$95$9 = N[Power[t$95$3, 2.0], $MachinePrecision]}, If[LessEqual[x$46$im, 230000000.0], N[(y$46$im * N[(-1.0 * t$95$8 + N[(y$46$im * N[(-1.0 * N[(t$95$5 * N[(t$95$3 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(t$95$9 * t$95$7), $MachinePrecision] + N[(0.5 * N[(t$95$6 * t$95$2), $MachinePrecision] + N[(y$46$im * N[(-0.16666666666666666 * N[(t$95$5 * N[(N[Power[t$95$3, 3.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$6 * N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 3.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$5 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$9 * t$95$8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 * N[(t$95$3 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$7), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot t\_0\\
t_2 := {\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot t\_0\\
t_3 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_4 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_5 := \cos t\_4\\
t_6 := \sin t\_4\\
t_7 := t\_6 \cdot t\_0\\
t_8 := t\_6 \cdot t\_1\\
t_9 := {t\_3}^{2}\\
\mathbf{if}\;x.im \leq 230000000:\\
\;\;\;\;\mathsf{fma}\left(y.im, \mathsf{fma}\left(-1, t\_8, \mathsf{fma}\left(y.im, \mathsf{fma}\left(-1, t\_5 \cdot \left(t\_3 \cdot t\_1\right), \mathsf{fma}\left(-0.5, t\_9 \cdot t\_7, \mathsf{fma}\left(0.5, t\_6 \cdot t\_2, y.im \cdot \mathsf{fma}\left(-0.16666666666666666, t\_5 \cdot \left({t\_3}^{3} \cdot t\_0\right), \mathsf{fma}\left(-0.16666666666666666, t\_6 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{3} \cdot t\_0\right), \mathsf{fma}\left(0.5, t\_5 \cdot \left(t\_3 \cdot t\_2\right), 0.5 \cdot \left(t\_9 \cdot t\_8\right)\right)\right)\right)\right)\right)\right), t\_5 \cdot \left(t\_3 \cdot t\_0\right)\right)\right), t\_7\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_4\right)\right)\\
\end{array}
\end{array}
if x.im < 2.3e8Initial program 41.3%
Taylor expanded in y.im around 0
Applied rewrites53.7%
if 2.3e8 < x.im Initial program 30.2%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6481.1
Applied rewrites81.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re))
(t_1 (* (atan2 x.im x.re) t_0))
(t_2 (log (hypot x.im x.re)))
(t_3 (* y.re (atan2 x.im x.re)))
(t_4 (cos t_3))
(t_5 (sin t_3))
(t_6 (* t_5 t_0)))
(if (<= x.im 230000000.0)
(fma
y.im
(fma
-1.0
(* t_5 t_1)
(fma
y.im
(fma
-1.0
(* t_4 (* t_2 t_1))
(fma
-0.5
(* (pow t_2 2.0) t_6)
(* 0.5 (* t_5 (* (pow (atan2 x.im x.re) 2.0) t_0)))))
(* t_4 (* t_2 t_0))))
t_6)
(*
(exp (- (* y.re (log x.im)) (* y.im (atan2 x.im x.re))))
(sin (fma y.im (log x.im) t_3))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = atan2(x_46_im, x_46_re) * t_0;
double t_2 = log(hypot(x_46_im, x_46_re));
double t_3 = y_46_re * atan2(x_46_im, x_46_re);
double t_4 = cos(t_3);
double t_5 = sin(t_3);
double t_6 = t_5 * t_0;
double tmp;
if (x_46_im <= 230000000.0) {
tmp = fma(y_46_im, fma(-1.0, (t_5 * t_1), fma(y_46_im, fma(-1.0, (t_4 * (t_2 * t_1)), fma(-0.5, (pow(t_2, 2.0) * t_6), (0.5 * (t_5 * (pow(atan2(x_46_im, x_46_re), 2.0) * t_0))))), (t_4 * (t_2 * t_0)))), t_6);
} else {
tmp = exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_3));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = Float64(atan(x_46_im, x_46_re) * t_0) t_2 = log(hypot(x_46_im, x_46_re)) t_3 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_4 = cos(t_3) t_5 = sin(t_3) t_6 = Float64(t_5 * t_0) tmp = 0.0 if (x_46_im <= 230000000.0) tmp = fma(y_46_im, fma(-1.0, Float64(t_5 * t_1), fma(y_46_im, fma(-1.0, Float64(t_4 * Float64(t_2 * t_1)), fma(-0.5, Float64((t_2 ^ 2.0) * t_6), Float64(0.5 * Float64(t_5 * Float64((atan(x_46_im, x_46_re) ^ 2.0) * t_0))))), Float64(t_4 * Float64(t_2 * t_0)))), t_6); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_3))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Sin[t$95$3], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * t$95$0), $MachinePrecision]}, If[LessEqual[x$46$im, 230000000.0], N[(y$46$im * N[(-1.0 * N[(t$95$5 * t$95$1), $MachinePrecision] + N[(y$46$im * N[(-1.0 * N[(t$95$4 * N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[Power[t$95$2, 2.0], $MachinePrecision] * t$95$6), $MachinePrecision] + N[(0.5 * N[(t$95$5 * N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 * N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$6), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot t\_0\\
t_2 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_3 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_4 := \cos t\_3\\
t_5 := \sin t\_3\\
t_6 := t\_5 \cdot t\_0\\
\mathbf{if}\;x.im \leq 230000000:\\
\;\;\;\;\mathsf{fma}\left(y.im, \mathsf{fma}\left(-1, t\_5 \cdot t\_1, \mathsf{fma}\left(y.im, \mathsf{fma}\left(-1, t\_4 \cdot \left(t\_2 \cdot t\_1\right), \mathsf{fma}\left(-0.5, {t\_2}^{2} \cdot t\_6, 0.5 \cdot \left(t\_5 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot t\_0\right)\right)\right)\right), t\_4 \cdot \left(t\_2 \cdot t\_0\right)\right)\right), t\_6\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_3\right)\right)\\
\end{array}
\end{array}
if x.im < 2.3e8Initial program 41.3%
Taylor expanded in y.im around 0
Applied rewrites51.4%
if 2.3e8 < x.im Initial program 30.2%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6481.1
Applied rewrites81.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3 (sqrt (+ (pow x.im 2.0) (pow x.re 2.0))))
(t_4 (pow t_3 y.re))
(t_5 (* t_2 t_4))
(t_6 (* (atan2 x.im x.re) t_4))
(t_7 (* t_2 t_6))
(t_8 (log t_3))
(t_9 (* (pow (atan2 x.im x.re) 2.0) t_4))
(t_10 (pow t_8 2.0)))
(if (<= x.im -1.18e-306)
(*
(pow y.im 3.0)
(fma
-1.0
(/ (* t_1 (* t_8 t_6)) y.im)
(fma
-1.0
(/ t_7 (pow y.im 2.0))
(fma
-0.5
(/ (* t_10 t_5) y.im)
(fma
-0.16666666666666666
(* t_1 (* (pow t_8 3.0) t_4))
(fma
-0.16666666666666666
(* t_2 (* (pow (atan2 x.im x.re) 3.0) t_4))
(fma
0.5
(* t_1 (* t_8 t_9))
(fma
0.5
(* t_10 t_7)
(fma
0.5
(/ (* t_2 t_9) y.im)
(+
(/ (* t_1 (* t_8 t_4)) (pow y.im 2.0))
(/ t_5 (pow y.im 3.0))))))))))))
(*
(exp (- (* y.re (log x.im)) (* y.im (atan2 x.im x.re))))
(sin (fma y.im (log x.im) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = cos(t_0);
double t_2 = sin(t_0);
double t_3 = sqrt((pow(x_46_im, 2.0) + pow(x_46_re, 2.0)));
double t_4 = pow(t_3, y_46_re);
double t_5 = t_2 * t_4;
double t_6 = atan2(x_46_im, x_46_re) * t_4;
double t_7 = t_2 * t_6;
double t_8 = log(t_3);
double t_9 = pow(atan2(x_46_im, x_46_re), 2.0) * t_4;
double t_10 = pow(t_8, 2.0);
double tmp;
if (x_46_im <= -1.18e-306) {
tmp = pow(y_46_im, 3.0) * fma(-1.0, ((t_1 * (t_8 * t_6)) / y_46_im), fma(-1.0, (t_7 / pow(y_46_im, 2.0)), fma(-0.5, ((t_10 * t_5) / y_46_im), fma(-0.16666666666666666, (t_1 * (pow(t_8, 3.0) * t_4)), fma(-0.16666666666666666, (t_2 * (pow(atan2(x_46_im, x_46_re), 3.0) * t_4)), fma(0.5, (t_1 * (t_8 * t_9)), fma(0.5, (t_10 * t_7), fma(0.5, ((t_2 * t_9) / y_46_im), (((t_1 * (t_8 * t_4)) / pow(y_46_im, 2.0)) + (t_5 / pow(y_46_im, 3.0)))))))))));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = cos(t_0) t_2 = sin(t_0) t_3 = sqrt(Float64((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) t_4 = t_3 ^ y_46_re t_5 = Float64(t_2 * t_4) t_6 = Float64(atan(x_46_im, x_46_re) * t_4) t_7 = Float64(t_2 * t_6) t_8 = log(t_3) t_9 = Float64((atan(x_46_im, x_46_re) ^ 2.0) * t_4) t_10 = t_8 ^ 2.0 tmp = 0.0 if (x_46_im <= -1.18e-306) tmp = Float64((y_46_im ^ 3.0) * fma(-1.0, Float64(Float64(t_1 * Float64(t_8 * t_6)) / y_46_im), fma(-1.0, Float64(t_7 / (y_46_im ^ 2.0)), fma(-0.5, Float64(Float64(t_10 * t_5) / y_46_im), fma(-0.16666666666666666, Float64(t_1 * Float64((t_8 ^ 3.0) * t_4)), fma(-0.16666666666666666, Float64(t_2 * Float64((atan(x_46_im, x_46_re) ^ 3.0) * t_4)), fma(0.5, Float64(t_1 * Float64(t_8 * t_9)), fma(0.5, Float64(t_10 * t_7), fma(0.5, Float64(Float64(t_2 * t_9) / y_46_im), Float64(Float64(Float64(t_1 * Float64(t_8 * t_4)) / (y_46_im ^ 2.0)) + Float64(t_5 / (y_46_im ^ 3.0)))))))))))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), t_0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(N[Power[x$46$im, 2.0], $MachinePrecision] + N[Power[x$46$re, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Power[t$95$3, y$46$re], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 * t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * t$95$4), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$2 * t$95$6), $MachinePrecision]}, Block[{t$95$8 = N[Log[t$95$3], $MachinePrecision]}, Block[{t$95$9 = N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision] * t$95$4), $MachinePrecision]}, Block[{t$95$10 = N[Power[t$95$8, 2.0], $MachinePrecision]}, If[LessEqual[x$46$im, -1.18e-306], N[(N[Power[y$46$im, 3.0], $MachinePrecision] * N[(-1.0 * N[(N[(t$95$1 * N[(t$95$8 * t$95$6), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(-1.0 * N[(t$95$7 / N[Power[y$46$im, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(t$95$10 * t$95$5), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$1 * N[(N[Power[t$95$8, 3.0], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$2 * N[(N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 3.0], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$1 * N[(t$95$8 * t$95$9), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$10 * t$95$7), $MachinePrecision] + N[(0.5 * N[(N[(t$95$2 * t$95$9), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(N[(N[(t$95$1 * N[(t$95$8 * t$95$4), $MachinePrecision]), $MachinePrecision] / N[Power[y$46$im, 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$5 / N[Power[y$46$im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := \sqrt{{x.im}^{2} + {x.re}^{2}}\\
t_4 := {t\_3}^{y.re}\\
t_5 := t\_2 \cdot t\_4\\
t_6 := \tan^{-1}_* \frac{x.im}{x.re} \cdot t\_4\\
t_7 := t\_2 \cdot t\_6\\
t_8 := \log t\_3\\
t_9 := {\tan^{-1}_* \frac{x.im}{x.re}}^{2} \cdot t\_4\\
t_10 := {t\_8}^{2}\\
\mathbf{if}\;x.im \leq -1.18 \cdot 10^{-306}:\\
\;\;\;\;{y.im}^{3} \cdot \mathsf{fma}\left(-1, \frac{t\_1 \cdot \left(t\_8 \cdot t\_6\right)}{y.im}, \mathsf{fma}\left(-1, \frac{t\_7}{{y.im}^{2}}, \mathsf{fma}\left(-0.5, \frac{t\_10 \cdot t\_5}{y.im}, \mathsf{fma}\left(-0.16666666666666666, t\_1 \cdot \left({t\_8}^{3} \cdot t\_4\right), \mathsf{fma}\left(-0.16666666666666666, t\_2 \cdot \left({\tan^{-1}_* \frac{x.im}{x.re}}^{3} \cdot t\_4\right), \mathsf{fma}\left(0.5, t\_1 \cdot \left(t\_8 \cdot t\_9\right), \mathsf{fma}\left(0.5, t\_10 \cdot t\_7, \mathsf{fma}\left(0.5, \frac{t\_2 \cdot t\_9}{y.im}, \frac{t\_1 \cdot \left(t\_8 \cdot t\_4\right)}{{y.im}^{2}} + \frac{t\_5}{{y.im}^{3}}\right)\right)\right)\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_0\right)\right)\\
\end{array}
\end{array}
if x.im < -1.17999999999999999e-306Initial program 41.5%
Taylor expanded in y.im around 0
Applied rewrites54.7%
Taylor expanded in y.im around inf
Applied rewrites13.2%
if -1.17999999999999999e-306 < x.im Initial program 35.0%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6463.3
Applied rewrites63.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (log x.im)))
(t_1 (sin t_0))
(t_2 (pow (log x.im) 2.0))
(t_3 (* y.re (atan2 x.im x.re)))
(t_4 (cos t_3))
(t_5 (sin t_3))
(t_6 (pow (atan2 x.im x.re) 3.0))
(t_7 (exp (* (- y.im) (atan2 x.im x.re))))
(t_8 (sqrt (+ (pow x.im 2.0) (pow x.re 2.0))))
(t_9 (pow t_8 y.re))
(t_10 (* t_5 t_9))
(t_11 (* (atan2 x.im x.re) t_9))
(t_12 (* t_5 t_11))
(t_13 (log t_8))
(t_14 (pow t_13 2.0))
(t_15 (pow (atan2 x.im x.re) 2.0))
(t_16 (* t_1 t_15))
(t_17 (* t_15 t_9))
(t_18 (cos t_0)))
(if (<= x.im -1.18e-306)
(*
(pow y.im 3.0)
(fma
-1.0
(/ (* t_4 (* t_13 t_11)) y.im)
(fma
-1.0
(/ t_12 (pow y.im 2.0))
(fma
-0.5
(/ (* t_14 t_10) y.im)
(fma
-0.16666666666666666
(* t_4 (* (pow t_13 3.0) t_9))
(fma
-0.16666666666666666
(* t_5 (* t_6 t_9))
(fma
0.5
(* t_4 (* t_13 t_17))
(fma
0.5
(* t_14 t_12)
(fma
0.5
(/ (* t_5 t_17) y.im)
(+
(/ (* t_4 (* t_13 t_9)) (pow y.im 2.0))
(/ t_10 (pow y.im 3.0))))))))))))
(fma
y.re
(fma
y.re
(fma
-0.5
(* t_7 t_16)
(fma
0.5
(* t_7 (* t_2 t_1))
(fma
y.re
(fma
-0.5
(* t_7 (* (log x.im) t_16))
(fma
-0.16666666666666666
(* t_18 (* t_7 t_6))
(fma
0.16666666666666666
(* t_7 (* (pow (log x.im) 3.0) t_1))
(* 0.5 (* t_18 (* t_7 (* t_2 (atan2 x.im x.re))))))))
(* t_18 (* t_7 (* (log x.im) (atan2 x.im x.re)))))))
(fma t_18 (* t_7 (atan2 x.im x.re)) (* t_7 (* (log x.im) t_1))))
(* t_7 t_1)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * log(x_46_im);
double t_1 = sin(t_0);
double t_2 = pow(log(x_46_im), 2.0);
double t_3 = y_46_re * atan2(x_46_im, x_46_re);
double t_4 = cos(t_3);
double t_5 = sin(t_3);
double t_6 = pow(atan2(x_46_im, x_46_re), 3.0);
double t_7 = exp((-y_46_im * atan2(x_46_im, x_46_re)));
double t_8 = sqrt((pow(x_46_im, 2.0) + pow(x_46_re, 2.0)));
double t_9 = pow(t_8, y_46_re);
double t_10 = t_5 * t_9;
double t_11 = atan2(x_46_im, x_46_re) * t_9;
double t_12 = t_5 * t_11;
double t_13 = log(t_8);
double t_14 = pow(t_13, 2.0);
double t_15 = pow(atan2(x_46_im, x_46_re), 2.0);
double t_16 = t_1 * t_15;
double t_17 = t_15 * t_9;
double t_18 = cos(t_0);
double tmp;
if (x_46_im <= -1.18e-306) {
tmp = pow(y_46_im, 3.0) * fma(-1.0, ((t_4 * (t_13 * t_11)) / y_46_im), fma(-1.0, (t_12 / pow(y_46_im, 2.0)), fma(-0.5, ((t_14 * t_10) / y_46_im), fma(-0.16666666666666666, (t_4 * (pow(t_13, 3.0) * t_9)), fma(-0.16666666666666666, (t_5 * (t_6 * t_9)), fma(0.5, (t_4 * (t_13 * t_17)), fma(0.5, (t_14 * t_12), fma(0.5, ((t_5 * t_17) / y_46_im), (((t_4 * (t_13 * t_9)) / pow(y_46_im, 2.0)) + (t_10 / pow(y_46_im, 3.0)))))))))));
} else {
tmp = fma(y_46_re, fma(y_46_re, fma(-0.5, (t_7 * t_16), fma(0.5, (t_7 * (t_2 * t_1)), fma(y_46_re, fma(-0.5, (t_7 * (log(x_46_im) * t_16)), fma(-0.16666666666666666, (t_18 * (t_7 * t_6)), fma(0.16666666666666666, (t_7 * (pow(log(x_46_im), 3.0) * t_1)), (0.5 * (t_18 * (t_7 * (t_2 * atan2(x_46_im, x_46_re)))))))), (t_18 * (t_7 * (log(x_46_im) * atan2(x_46_im, x_46_re))))))), fma(t_18, (t_7 * atan2(x_46_im, x_46_re)), (t_7 * (log(x_46_im) * t_1)))), (t_7 * t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * log(x_46_im)) t_1 = sin(t_0) t_2 = log(x_46_im) ^ 2.0 t_3 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_4 = cos(t_3) t_5 = sin(t_3) t_6 = atan(x_46_im, x_46_re) ^ 3.0 t_7 = exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) t_8 = sqrt(Float64((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) t_9 = t_8 ^ y_46_re t_10 = Float64(t_5 * t_9) t_11 = Float64(atan(x_46_im, x_46_re) * t_9) t_12 = Float64(t_5 * t_11) t_13 = log(t_8) t_14 = t_13 ^ 2.0 t_15 = atan(x_46_im, x_46_re) ^ 2.0 t_16 = Float64(t_1 * t_15) t_17 = Float64(t_15 * t_9) t_18 = cos(t_0) tmp = 0.0 if (x_46_im <= -1.18e-306) tmp = Float64((y_46_im ^ 3.0) * fma(-1.0, Float64(Float64(t_4 * Float64(t_13 * t_11)) / y_46_im), fma(-1.0, Float64(t_12 / (y_46_im ^ 2.0)), fma(-0.5, Float64(Float64(t_14 * t_10) / y_46_im), fma(-0.16666666666666666, Float64(t_4 * Float64((t_13 ^ 3.0) * t_9)), fma(-0.16666666666666666, Float64(t_5 * Float64(t_6 * t_9)), fma(0.5, Float64(t_4 * Float64(t_13 * t_17)), fma(0.5, Float64(t_14 * t_12), fma(0.5, Float64(Float64(t_5 * t_17) / y_46_im), Float64(Float64(Float64(t_4 * Float64(t_13 * t_9)) / (y_46_im ^ 2.0)) + Float64(t_10 / (y_46_im ^ 3.0)))))))))))); else tmp = fma(y_46_re, fma(y_46_re, fma(-0.5, Float64(t_7 * t_16), fma(0.5, Float64(t_7 * Float64(t_2 * t_1)), fma(y_46_re, fma(-0.5, Float64(t_7 * Float64(log(x_46_im) * t_16)), fma(-0.16666666666666666, Float64(t_18 * Float64(t_7 * t_6)), fma(0.16666666666666666, Float64(t_7 * Float64((log(x_46_im) ^ 3.0) * t_1)), Float64(0.5 * Float64(t_18 * Float64(t_7 * Float64(t_2 * atan(x_46_im, x_46_re)))))))), Float64(t_18 * Float64(t_7 * Float64(log(x_46_im) * atan(x_46_im, x_46_re))))))), fma(t_18, Float64(t_7 * atan(x_46_im, x_46_re)), Float64(t_7 * Float64(log(x_46_im) * t_1)))), Float64(t_7 * t_1)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Log[x$46$im], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[Sin[t$95$3], $MachinePrecision]}, Block[{t$95$6 = N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$7 = N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$8 = N[Sqrt[N[(N[Power[x$46$im, 2.0], $MachinePrecision] + N[Power[x$46$re, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$9 = N[Power[t$95$8, y$46$re], $MachinePrecision]}, Block[{t$95$10 = N[(t$95$5 * t$95$9), $MachinePrecision]}, Block[{t$95$11 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * t$95$9), $MachinePrecision]}, Block[{t$95$12 = N[(t$95$5 * t$95$11), $MachinePrecision]}, Block[{t$95$13 = N[Log[t$95$8], $MachinePrecision]}, Block[{t$95$14 = N[Power[t$95$13, 2.0], $MachinePrecision]}, Block[{t$95$15 = N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$16 = N[(t$95$1 * t$95$15), $MachinePrecision]}, Block[{t$95$17 = N[(t$95$15 * t$95$9), $MachinePrecision]}, Block[{t$95$18 = N[Cos[t$95$0], $MachinePrecision]}, If[LessEqual[x$46$im, -1.18e-306], N[(N[Power[y$46$im, 3.0], $MachinePrecision] * N[(-1.0 * N[(N[(t$95$4 * N[(t$95$13 * t$95$11), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(-1.0 * N[(t$95$12 / N[Power[y$46$im, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(t$95$14 * t$95$10), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$4 * N[(N[Power[t$95$13, 3.0], $MachinePrecision] * t$95$9), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$5 * N[(t$95$6 * t$95$9), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$4 * N[(t$95$13 * t$95$17), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$14 * t$95$12), $MachinePrecision] + N[(0.5 * N[(N[(t$95$5 * t$95$17), $MachinePrecision] / y$46$im), $MachinePrecision] + N[(N[(N[(t$95$4 * N[(t$95$13 * t$95$9), $MachinePrecision]), $MachinePrecision] / N[Power[y$46$im, 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$10 / N[Power[y$46$im, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$46$re * N[(y$46$re * N[(-0.5 * N[(t$95$7 * t$95$16), $MachinePrecision] + N[(0.5 * N[(t$95$7 * N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(y$46$re * N[(-0.5 * N[(t$95$7 * N[(N[Log[x$46$im], $MachinePrecision] * t$95$16), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$18 * N[(t$95$7 * t$95$6), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$7 * N[(N[Power[N[Log[x$46$im], $MachinePrecision], 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$18 * N[(t$95$7 * N[(t$95$2 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$18 * N[(t$95$7 * N[(N[Log[x$46$im], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$18 * N[(t$95$7 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(t$95$7 * N[(N[Log[x$46$im], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$7 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \log x.im\\
t_1 := \sin t\_0\\
t_2 := {\log x.im}^{2}\\
t_3 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_4 := \cos t\_3\\
t_5 := \sin t\_3\\
t_6 := {\tan^{-1}_* \frac{x.im}{x.re}}^{3}\\
t_7 := e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_8 := \sqrt{{x.im}^{2} + {x.re}^{2}}\\
t_9 := {t\_8}^{y.re}\\
t_10 := t\_5 \cdot t\_9\\
t_11 := \tan^{-1}_* \frac{x.im}{x.re} \cdot t\_9\\
t_12 := t\_5 \cdot t\_11\\
t_13 := \log t\_8\\
t_14 := {t\_13}^{2}\\
t_15 := {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\\
t_16 := t\_1 \cdot t\_15\\
t_17 := t\_15 \cdot t\_9\\
t_18 := \cos t\_0\\
\mathbf{if}\;x.im \leq -1.18 \cdot 10^{-306}:\\
\;\;\;\;{y.im}^{3} \cdot \mathsf{fma}\left(-1, \frac{t\_4 \cdot \left(t\_13 \cdot t\_11\right)}{y.im}, \mathsf{fma}\left(-1, \frac{t\_12}{{y.im}^{2}}, \mathsf{fma}\left(-0.5, \frac{t\_14 \cdot t\_10}{y.im}, \mathsf{fma}\left(-0.16666666666666666, t\_4 \cdot \left({t\_13}^{3} \cdot t\_9\right), \mathsf{fma}\left(-0.16666666666666666, t\_5 \cdot \left(t\_6 \cdot t\_9\right), \mathsf{fma}\left(0.5, t\_4 \cdot \left(t\_13 \cdot t\_17\right), \mathsf{fma}\left(0.5, t\_14 \cdot t\_12, \mathsf{fma}\left(0.5, \frac{t\_5 \cdot t\_17}{y.im}, \frac{t\_4 \cdot \left(t\_13 \cdot t\_9\right)}{{y.im}^{2}} + \frac{t\_10}{{y.im}^{3}}\right)\right)\right)\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y.re, \mathsf{fma}\left(y.re, \mathsf{fma}\left(-0.5, t\_7 \cdot t\_16, \mathsf{fma}\left(0.5, t\_7 \cdot \left(t\_2 \cdot t\_1\right), \mathsf{fma}\left(y.re, \mathsf{fma}\left(-0.5, t\_7 \cdot \left(\log x.im \cdot t\_16\right), \mathsf{fma}\left(-0.16666666666666666, t\_18 \cdot \left(t\_7 \cdot t\_6\right), \mathsf{fma}\left(0.16666666666666666, t\_7 \cdot \left({\log x.im}^{3} \cdot t\_1\right), 0.5 \cdot \left(t\_18 \cdot \left(t\_7 \cdot \left(t\_2 \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)\right)\right), t\_18 \cdot \left(t\_7 \cdot \left(\log x.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)\right), \mathsf{fma}\left(t\_18, t\_7 \cdot \tan^{-1}_* \frac{x.im}{x.re}, t\_7 \cdot \left(\log x.im \cdot t\_1\right)\right)\right), t\_7 \cdot t\_1\right)\\
\end{array}
\end{array}
if x.im < -1.17999999999999999e-306Initial program 41.5%
Taylor expanded in y.im around 0
Applied rewrites54.7%
Taylor expanded in y.im around inf
Applied rewrites13.2%
if -1.17999999999999999e-306 < x.im Initial program 35.0%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6463.3
Applied rewrites63.3%
Taylor expanded in y.re around 0
Applied rewrites39.0%
Final simplification27.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (exp (* (- y.im) (atan2 x.im x.re))))
(t_1 (pow (log x.im) 2.0))
(t_2 (* y.im (log x.im)))
(t_3 (sin t_2))
(t_4 (* t_3 (pow (atan2 x.im x.re) 2.0)))
(t_5 (cos t_2)))
(fma
y.re
(fma
y.re
(fma
-0.5
(* t_0 t_4)
(fma
0.5
(* t_0 (* t_1 t_3))
(fma
y.re
(fma
-0.5
(* t_0 (* (log x.im) t_4))
(fma
-0.16666666666666666
(* t_5 (* t_0 (pow (atan2 x.im x.re) 3.0)))
(fma
0.16666666666666666
(* t_0 (* (pow (log x.im) 3.0) t_3))
(* 0.5 (* t_5 (* t_0 (* t_1 (atan2 x.im x.re))))))))
(* t_5 (* t_0 (* (log x.im) (atan2 x.im x.re)))))))
(fma t_5 (* t_0 (atan2 x.im x.re)) (* t_0 (* (log x.im) t_3))))
(* t_0 t_3))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = exp((-y_46_im * atan2(x_46_im, x_46_re)));
double t_1 = pow(log(x_46_im), 2.0);
double t_2 = y_46_im * log(x_46_im);
double t_3 = sin(t_2);
double t_4 = t_3 * pow(atan2(x_46_im, x_46_re), 2.0);
double t_5 = cos(t_2);
return fma(y_46_re, fma(y_46_re, fma(-0.5, (t_0 * t_4), fma(0.5, (t_0 * (t_1 * t_3)), fma(y_46_re, fma(-0.5, (t_0 * (log(x_46_im) * t_4)), fma(-0.16666666666666666, (t_5 * (t_0 * pow(atan2(x_46_im, x_46_re), 3.0))), fma(0.16666666666666666, (t_0 * (pow(log(x_46_im), 3.0) * t_3)), (0.5 * (t_5 * (t_0 * (t_1 * atan2(x_46_im, x_46_re)))))))), (t_5 * (t_0 * (log(x_46_im) * atan2(x_46_im, x_46_re))))))), fma(t_5, (t_0 * atan2(x_46_im, x_46_re)), (t_0 * (log(x_46_im) * t_3)))), (t_0 * t_3));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) t_1 = log(x_46_im) ^ 2.0 t_2 = Float64(y_46_im * log(x_46_im)) t_3 = sin(t_2) t_4 = Float64(t_3 * (atan(x_46_im, x_46_re) ^ 2.0)) t_5 = cos(t_2) return fma(y_46_re, fma(y_46_re, fma(-0.5, Float64(t_0 * t_4), fma(0.5, Float64(t_0 * Float64(t_1 * t_3)), fma(y_46_re, fma(-0.5, Float64(t_0 * Float64(log(x_46_im) * t_4)), fma(-0.16666666666666666, Float64(t_5 * Float64(t_0 * (atan(x_46_im, x_46_re) ^ 3.0))), fma(0.16666666666666666, Float64(t_0 * Float64((log(x_46_im) ^ 3.0) * t_3)), Float64(0.5 * Float64(t_5 * Float64(t_0 * Float64(t_1 * atan(x_46_im, x_46_re)))))))), Float64(t_5 * Float64(t_0 * Float64(log(x_46_im) * atan(x_46_im, x_46_re))))))), fma(t_5, Float64(t_0 * atan(x_46_im, x_46_re)), Float64(t_0 * Float64(log(x_46_im) * t_3)))), Float64(t_0 * t_3)) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Log[x$46$im], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sin[t$95$2], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Cos[t$95$2], $MachinePrecision]}, N[(y$46$re * N[(y$46$re * N[(-0.5 * N[(t$95$0 * t$95$4), $MachinePrecision] + N[(0.5 * N[(t$95$0 * N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(y$46$re * N[(-0.5 * N[(t$95$0 * N[(N[Log[x$46$im], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$5 * N[(t$95$0 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$0 * N[(N[Power[N[Log[x$46$im], $MachinePrecision], 3.0], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$5 * N[(t$95$0 * N[(t$95$1 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 * N[(t$95$0 * N[(N[Log[x$46$im], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$5 * N[(t$95$0 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[Log[x$46$im], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$3), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_1 := {\log x.im}^{2}\\
t_2 := y.im \cdot \log x.im\\
t_3 := \sin t\_2\\
t_4 := t\_3 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\\
t_5 := \cos t\_2\\
\mathsf{fma}\left(y.re, \mathsf{fma}\left(y.re, \mathsf{fma}\left(-0.5, t\_0 \cdot t\_4, \mathsf{fma}\left(0.5, t\_0 \cdot \left(t\_1 \cdot t\_3\right), \mathsf{fma}\left(y.re, \mathsf{fma}\left(-0.5, t\_0 \cdot \left(\log x.im \cdot t\_4\right), \mathsf{fma}\left(-0.16666666666666666, t\_5 \cdot \left(t\_0 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{3}\right), \mathsf{fma}\left(0.16666666666666666, t\_0 \cdot \left({\log x.im}^{3} \cdot t\_3\right), 0.5 \cdot \left(t\_5 \cdot \left(t\_0 \cdot \left(t\_1 \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)\right)\right), t\_5 \cdot \left(t\_0 \cdot \left(\log x.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)\right), \mathsf{fma}\left(t\_5, t\_0 \cdot \tan^{-1}_* \frac{x.im}{x.re}, t\_0 \cdot \left(\log x.im \cdot t\_3\right)\right)\right), t\_0 \cdot t\_3\right)
\end{array}
\end{array}
Initial program 38.0%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6434.1
Applied rewrites34.1%
Taylor expanded in y.re around 0
Applied rewrites21.0%
Final simplification21.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (log x.im)))
(t_1 (cos t_0))
(t_2 (sin t_0))
(t_3 (* t_2 (pow (atan2 x.im x.re) 2.0)))
(t_4 (exp (* (- y.im) (atan2 x.im x.re))))
(t_5 (pow (log x.im) 2.0)))
(fma
y.re
(*
(pow y.re 2.0)
(fma
-1.0
(/
(fma
-1.0
(fma
-0.5
(* t_4 t_3)
(fma
0.5
(* t_4 (* t_5 t_2))
(* t_1 (* t_4 (* (log x.im) (atan2 x.im x.re))))))
(/
(fma t_1 (* t_4 (atan2 x.im x.re)) (* t_4 (* (log x.im) t_2)))
(- y.re)))
y.re)
(fma
-0.5
(* t_4 (* (log x.im) t_3))
(fma
-0.16666666666666666
(* t_1 (* t_4 (pow (atan2 x.im x.re) 3.0)))
(fma
0.16666666666666666
(* t_4 (* (pow (log x.im) 3.0) t_2))
(* 0.5 (* t_1 (* t_4 (* t_5 (atan2 x.im x.re))))))))))
(* t_4 t_2))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * log(x_46_im);
double t_1 = cos(t_0);
double t_2 = sin(t_0);
double t_3 = t_2 * pow(atan2(x_46_im, x_46_re), 2.0);
double t_4 = exp((-y_46_im * atan2(x_46_im, x_46_re)));
double t_5 = pow(log(x_46_im), 2.0);
return fma(y_46_re, (pow(y_46_re, 2.0) * fma(-1.0, (fma(-1.0, fma(-0.5, (t_4 * t_3), fma(0.5, (t_4 * (t_5 * t_2)), (t_1 * (t_4 * (log(x_46_im) * atan2(x_46_im, x_46_re)))))), (fma(t_1, (t_4 * atan2(x_46_im, x_46_re)), (t_4 * (log(x_46_im) * t_2))) / -y_46_re)) / y_46_re), fma(-0.5, (t_4 * (log(x_46_im) * t_3)), fma(-0.16666666666666666, (t_1 * (t_4 * pow(atan2(x_46_im, x_46_re), 3.0))), fma(0.16666666666666666, (t_4 * (pow(log(x_46_im), 3.0) * t_2)), (0.5 * (t_1 * (t_4 * (t_5 * atan2(x_46_im, x_46_re)))))))))), (t_4 * t_2));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * log(x_46_im)) t_1 = cos(t_0) t_2 = sin(t_0) t_3 = Float64(t_2 * (atan(x_46_im, x_46_re) ^ 2.0)) t_4 = exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) t_5 = log(x_46_im) ^ 2.0 return fma(y_46_re, Float64((y_46_re ^ 2.0) * fma(-1.0, Float64(fma(-1.0, fma(-0.5, Float64(t_4 * t_3), fma(0.5, Float64(t_4 * Float64(t_5 * t_2)), Float64(t_1 * Float64(t_4 * Float64(log(x_46_im) * atan(x_46_im, x_46_re)))))), Float64(fma(t_1, Float64(t_4 * atan(x_46_im, x_46_re)), Float64(t_4 * Float64(log(x_46_im) * t_2))) / Float64(-y_46_re))) / y_46_re), fma(-0.5, Float64(t_4 * Float64(log(x_46_im) * t_3)), fma(-0.16666666666666666, Float64(t_1 * Float64(t_4 * (atan(x_46_im, x_46_re) ^ 3.0))), fma(0.16666666666666666, Float64(t_4 * Float64((log(x_46_im) ^ 3.0) * t_2)), Float64(0.5 * Float64(t_1 * Float64(t_4 * Float64(t_5 * atan(x_46_im, x_46_re)))))))))), Float64(t_4 * t_2)) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Sin[t$95$0], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Log[x$46$im], $MachinePrecision], 2.0], $MachinePrecision]}, N[(y$46$re * N[(N[Power[y$46$re, 2.0], $MachinePrecision] * N[(-1.0 * N[(N[(-1.0 * N[(-0.5 * N[(t$95$4 * t$95$3), $MachinePrecision] + N[(0.5 * N[(t$95$4 * N[(t$95$5 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(t$95$4 * N[(N[Log[x$46$im], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * N[(t$95$4 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(t$95$4 * N[(N[Log[x$46$im], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-y$46$re)), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision] + N[(-0.5 * N[(t$95$4 * N[(N[Log[x$46$im], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(t$95$1 * N[(t$95$4 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * N[(t$95$4 * N[(N[Power[N[Log[x$46$im], $MachinePrecision], 3.0], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(t$95$1 * N[(t$95$4 * N[(t$95$5 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \log x.im\\
t_1 := \cos t\_0\\
t_2 := \sin t\_0\\
t_3 := t\_2 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\\
t_4 := e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_5 := {\log x.im}^{2}\\
\mathsf{fma}\left(y.re, {y.re}^{2} \cdot \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \mathsf{fma}\left(-0.5, t\_4 \cdot t\_3, \mathsf{fma}\left(0.5, t\_4 \cdot \left(t\_5 \cdot t\_2\right), t\_1 \cdot \left(t\_4 \cdot \left(\log x.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right), \frac{\mathsf{fma}\left(t\_1, t\_4 \cdot \tan^{-1}_* \frac{x.im}{x.re}, t\_4 \cdot \left(\log x.im \cdot t\_2\right)\right)}{-y.re}\right)}{y.re}, \mathsf{fma}\left(-0.5, t\_4 \cdot \left(\log x.im \cdot t\_3\right), \mathsf{fma}\left(-0.16666666666666666, t\_1 \cdot \left(t\_4 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{3}\right), \mathsf{fma}\left(0.16666666666666666, t\_4 \cdot \left({\log x.im}^{3} \cdot t\_2\right), 0.5 \cdot \left(t\_1 \cdot \left(t\_4 \cdot \left(t\_5 \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)\right)\right)\right), t\_4 \cdot t\_2\right)
\end{array}
\end{array}
Initial program 38.0%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6434.1
Applied rewrites34.1%
Taylor expanded in y.re around 0
Applied rewrites21.0%
Taylor expanded in y.re around -inf
Applied rewrites13.5%
Final simplification13.5%
herbie shell --seed 2025057
(FPCore (x.re x.im y.re y.im)
:name "powComplex, imaginary part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))