
(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)));
}
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))) * 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 20 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)));
}
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))) * 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 (log (hypot 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 (<= y.re -4.4e+49)
(* t_1 (cos (* t_0 y.im)))
(if (<= y.re 1.7e-16)
(/
(*
(pow (hypot x.im x.re) y.re)
(cos (fma y.im t_0 (* (atan2 x.im x.re) y.re))))
(pow (exp y.im) (atan2 x.im x.re)))
(*
t_1
(sin (fma y.im t_0 (fma (atan2 x.im x.re) y.re (/ (PI) 2.0)))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
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}\;y.re \leq -4.4 \cdot 10^{+49}:\\
\;\;\;\;t\_1 \cdot \cos \left(t\_0 \cdot y.im\right)\\
\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{-16}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\mathsf{fma}\left(y.im, t\_0, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sin \left(\mathsf{fma}\left(y.im, t\_0, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)\\
\end{array}
\end{array}
if y.re < -4.4000000000000001e49Initial program 35.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6489.3
Applied rewrites89.3%
if -4.4000000000000001e49 < y.re < 1.7e-16Initial program 43.5%
lift-*.f64N/A
lift-exp.f64N/A
lift--.f64N/A
exp-diffN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites84.5%
if 1.7e-16 < y.re Initial program 32.8%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites69.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.re))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2 (exp (- (* t_1 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= (* t_2 (cos (+ (* t_1 y.im) t_0))) INFINITY)
(* t_2 (cos t_0))
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (- y.re) (atan2 x.im x.re) (/ (PI) 2.0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_1 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := e^{t\_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;t\_2 \cdot \cos \left(t\_1 \cdot y.im + t\_0\right) \leq \infty:\\
\;\;\;\;t\_2 \cdot \cos t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(-y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 78.7%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6476.8
Applied rewrites76.8%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6461.8
Applied rewrites61.8%
Applied rewrites64.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (PI) 2.0))
(t_1 (log (hypot x.im x.re)))
(t_2
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))))
(if (<= y.re -2.2e-12)
(* t_2 (cos (* t_1 y.im)))
(if (<= y.re 15000000.0)
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(sin (fma (log (hypot x.re x.im)) (- y.im) t_0)))
(* t_2 (sin (fma y.im t_1 (fma (atan2 x.im x.re) y.re t_0))))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{2}\\
t_1 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_2 := 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}\;y.re \leq -2.2 \cdot 10^{-12}:\\
\;\;\;\;t\_2 \cdot \cos \left(t\_1 \cdot y.im\right)\\
\mathbf{elif}\;y.re \leq 15000000:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -y.im, t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \sin \left(\mathsf{fma}\left(y.im, t\_1, \mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, t\_0\right)\right)\right)\\
\end{array}
\end{array}
if y.re < -2.19999999999999992e-12Initial program 36.0%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6484.1
Applied rewrites84.1%
if -2.19999999999999992e-12 < y.re < 1.5e7Initial program 44.0%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6483.6
Applied rewrites83.6%
Applied rewrites85.1%
if 1.5e7 < y.re Initial program 31.7%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites70.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -2.2e-12) (not (<= y.re 15000000.0)))
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos (* (log (hypot x.im x.re)) y.im)))
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(sin (fma (log (hypot x.re x.im)) (- y.im) (/ (PI) 2.0))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.2 \cdot 10^{-12} \lor \neg \left(y.re \leq 15000000\right):\\
\;\;\;\;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 \cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -y.im, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\end{array}
\end{array}
if y.re < -2.19999999999999992e-12 or 1.5e7 < y.re Initial program 34.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6476.4
Applied rewrites76.4%
if -2.19999999999999992e-12 < y.re < 1.5e7Initial program 44.0%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6483.6
Applied rewrites83.6%
Applied rewrites85.1%
Final simplification80.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (PI) 2.0)))
(if (<= y.re -2.95e-16)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos (* (atan2 x.im x.re) y.re)))
(if (<= y.re 9.5e+58)
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(sin (fma (log (hypot x.re x.im)) (- y.im) t_0)))
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (atan2 x.im x.re) y.re t_0)))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{PI}\left(\right)}{2}\\
\mathbf{if}\;y.re \leq -2.95 \cdot 10^{-16}:\\
\;\;\;\;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 \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{elif}\;y.re \leq 9.5 \cdot 10^{+58}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), -y.im, t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, t\_0\right)\right)\\
\end{array}
\end{array}
if y.re < -2.95000000000000011e-16Initial program 36.4%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6479.3
Applied rewrites79.3%
if -2.95000000000000011e-16 < y.re < 9.5000000000000002e58Initial program 44.0%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.0
Applied rewrites81.0%
Applied rewrites81.6%
if 9.5000000000000002e58 < y.re Initial program 28.6%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6453.2
Applied rewrites53.2%
Applied rewrites65.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -1.6) (not (<= y.re 9.5e+58)))
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0))))
(/
(cos (* y.im (log (hypot x.re x.im))))
(pow (exp y.im) (atan2 x.im x.re)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.6 \lor \neg \left(y.re \leq 9.5 \cdot 10^{+58}\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\end{array}
\end{array}
if y.re < -1.6000000000000001 or 9.5000000000000002e58 < y.re Initial program 33.3%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6466.8
Applied rewrites66.8%
Applied rewrites74.1%
if -1.6000000000000001 < y.re < 9.5000000000000002e58Initial program 43.8%
lift-*.f64N/A
lift-exp.f64N/A
lift--.f64N/A
exp-diffN/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites78.5%
Taylor expanded in y.re around 0
lower-cos.f64N/A
lower-*.f64N/A
lower-log.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.7
Applied rewrites80.7%
Final simplification77.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -1.6) (not (<= y.re 9.5e+58)))
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0))))
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(cos (* (log (hypot x.im x.re)) y.im)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.6 \lor \neg \left(y.re \leq 9.5 \cdot 10^{+58}\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)\\
\end{array}
\end{array}
if y.re < -1.6000000000000001 or 9.5000000000000002e58 < y.re Initial program 33.3%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6466.8
Applied rewrites66.8%
Applied rewrites74.1%
if -1.6000000000000001 < y.re < 9.5000000000000002e58Initial program 43.8%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.7
Applied rewrites80.7%
Final simplification77.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -3.5e+105)
(*
(pow (fma y.im (- (* 0.5 y.im) 1.0) 1.0) (atan2 x.im x.re))
(cos (* (log (hypot x.im x.re)) y.im)))
(if (<= y.im 3.7e+55)
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0))))
(* (cos (* y.im (log x.im))) (exp (* (- y.im) (atan2 x.im x.re)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.5 \cdot 10^{+105}:\\
\;\;\;\;{\left(\mathsf{fma}\left(y.im, 0.5 \cdot y.im - 1, 1\right)\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)\\
\mathbf{elif}\;y.im \leq 3.7 \cdot 10^{+55}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log x.im\right) \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < -3.49999999999999991e105Initial program 39.9%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.4
Applied rewrites63.4%
Taylor expanded in y.im around 0
Applied rewrites64.1%
if -3.49999999999999991e105 < y.im < 3.7000000000000002e55Initial program 42.3%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6476.8
Applied rewrites76.8%
Applied rewrites79.3%
if 3.7000000000000002e55 < y.im Initial program 28.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in x.re around 0
Applied rewrites44.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.8e+206)
(*
(pow (fma -1.0 y.im 1.0) (atan2 x.im x.re))
(cos (* (log (hypot x.im x.re)) y.im)))
(if (<= y.im 3.7e+55)
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0))))
(* (cos (* y.im (log x.im))) (exp (* (- y.im) (atan2 x.im x.re)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.8 \cdot 10^{+206}:\\
\;\;\;\;{\left(\mathsf{fma}\left(-1, y.im, 1\right)\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)\\
\mathbf{elif}\;y.im \leq 3.7 \cdot 10^{+55}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log x.im\right) \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < -1.80000000000000014e206Initial program 44.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6478.0
Applied rewrites78.0%
Taylor expanded in y.im around 0
Applied rewrites72.8%
if -1.80000000000000014e206 < y.im < 3.7000000000000002e55Initial program 41.5%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6471.4
Applied rewrites71.4%
Applied rewrites75.8%
if 3.7000000000000002e55 < y.im Initial program 28.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in x.re around 0
Applied rewrites44.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im 3.7e+55)
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0))))
(* (cos (* y.im (log x.im))) (exp (* (- y.im) (atan2 x.im x.re))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq 3.7 \cdot 10^{+55}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log x.im\right) \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < 3.7000000000000002e55Initial program 41.8%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6468.0
Applied rewrites68.0%
Applied rewrites72.0%
if 3.7000000000000002e55 < y.im Initial program 28.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in x.re around 0
Applied rewrites44.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im 3.7e+55) (* (pow (hypot x.im x.re) y.re) (cos (* (atan2 x.im x.re) y.re))) (* (cos (* y.im (log x.im))) (exp (* (- y.im) (atan2 x.im x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= 3.7e+55) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * cos((atan2(x_46_im, x_46_re) * y_46_re));
} else {
tmp = cos((y_46_im * log(x_46_im))) * exp((-y_46_im * 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 tmp;
if (y_46_im <= 3.7e+55) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re) * Math.cos((Math.atan2(x_46_im, x_46_re) * y_46_re));
} else {
tmp = Math.cos((y_46_im * Math.log(x_46_im))) * Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= 3.7e+55: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) * math.cos((math.atan2(x_46_im, x_46_re) * y_46_re)) else: tmp = math.cos((y_46_im * math.log(x_46_im))) * math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= 3.7e+55) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * cos(Float64(atan(x_46_im, x_46_re) * y_46_re))); else tmp = Float64(cos(Float64(y_46_im * log(x_46_im))) * exp(Float64(Float64(-y_46_im) * 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) tmp = 0.0; if (y_46_im <= 3.7e+55) tmp = (hypot(x_46_im, x_46_re) ^ y_46_re) * cos((atan2(x_46_im, x_46_re) * y_46_re)); else tmp = cos((y_46_im * log(x_46_im))) * exp((-y_46_im * 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_] := If[LessEqual[y$46$im, 3.7e+55], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq 3.7 \cdot 10^{+55}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log x.im\right) \cdot e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < 3.7000000000000002e55Initial program 41.8%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6468.0
Applied rewrites68.0%
if 3.7000000000000002e55 < y.im Initial program 28.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in x.re around 0
Applied rewrites44.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* (atan2 x.im x.re) y.re))))
(if (<= y.im 1.82e+55)
(* (pow (hypot x.im x.re) y.re) t_0)
(* (pow (* x.im (* (/ 0.5 x.im) (/ (* x.re x.re) x.im))) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_im <= 1.82e+55) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * t_0;
} else {
tmp = pow((x_46_im * ((0.5 / x_46_im) * ((x_46_re * x_46_re) / x_46_im))), y_46_re) * t_0;
}
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.cos((Math.atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_im <= 1.82e+55) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re) * t_0;
} else {
tmp = Math.pow((x_46_im * ((0.5 / x_46_im) * ((x_46_re * x_46_re) / x_46_im))), y_46_re) * t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((math.atan2(x_46_im, x_46_re) * y_46_re)) tmp = 0 if y_46_im <= 1.82e+55: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) * t_0 else: tmp = math.pow((x_46_im * ((0.5 / x_46_im) * ((x_46_re * x_46_re) / x_46_im))), y_46_re) * t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) tmp = 0.0 if (y_46_im <= 1.82e+55) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * t_0); else tmp = Float64((Float64(x_46_im * Float64(Float64(0.5 / x_46_im) * Float64(Float64(x_46_re * x_46_re) / x_46_im))) ^ y_46_re) * t_0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((atan2(x_46_im, x_46_re) * y_46_re)); tmp = 0.0; if (y_46_im <= 1.82e+55) tmp = (hypot(x_46_im, x_46_re) ^ y_46_re) * t_0; else tmp = ((x_46_im * ((0.5 / x_46_im) * ((x_46_re * x_46_re) / x_46_im))) ^ y_46_re) * t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, 1.82e+55], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Power[N[(x$46$im * N[(N[(0.5 / x$46$im), $MachinePrecision] * N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;y.im \leq 1.82 \cdot 10^{+55}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(x.im \cdot \left(\frac{0.5}{x.im} \cdot \frac{x.re \cdot x.re}{x.im}\right)\right)}^{y.re} \cdot t\_0\\
\end{array}
\end{array}
if y.im < 1.82e55Initial program 41.8%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6468.0
Applied rewrites68.0%
if 1.82e55 < y.im Initial program 28.1%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6427.3
Applied rewrites27.3%
Taylor expanded in x.im around inf
Applied rewrites24.0%
Taylor expanded in x.re around inf
Applied rewrites36.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* (atan2 x.im x.re) y.re))))
(if (<= y.re -0.5)
(* (pow (fma 0.5 (/ (* x.im x.im) x.re) x.re) y.re) t_0)
(if (<= y.re 1.7e-16)
(fma (log (exp (- y.im))) (atan2 x.im x.re) 1.0)
(* (pow (fma 0.5 (/ (* x.re x.re) x.im) x.im) y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_re <= -0.5) {
tmp = pow(fma(0.5, ((x_46_im * x_46_im) / x_46_re), x_46_re), y_46_re) * t_0;
} else if (y_46_re <= 1.7e-16) {
tmp = fma(log(exp(-y_46_im)), atan2(x_46_im, x_46_re), 1.0);
} else {
tmp = pow(fma(0.5, ((x_46_re * x_46_re) / x_46_im), x_46_im), y_46_re) * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) tmp = 0.0 if (y_46_re <= -0.5) tmp = Float64((fma(0.5, Float64(Float64(x_46_im * x_46_im) / x_46_re), x_46_re) ^ y_46_re) * t_0); elseif (y_46_re <= 1.7e-16) tmp = fma(log(exp(Float64(-y_46_im))), atan(x_46_im, x_46_re), 1.0); else tmp = Float64((fma(0.5, Float64(Float64(x_46_re * x_46_re) / x_46_im), x_46_im) ^ y_46_re) * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -0.5], N[(N[Power[N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision] + x$46$re), $MachinePrecision], y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.7e-16], N[(N[Log[N[Exp[(-y$46$im)], $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + 1.0), $MachinePrecision], N[(N[Power[N[(0.5 * N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision] + x$46$im), $MachinePrecision], y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -0.5:\\
\;\;\;\;{\left(\mathsf{fma}\left(0.5, \frac{x.im \cdot x.im}{x.re}, x.re\right)\right)}^{y.re} \cdot t\_0\\
\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(e^{-y.im}\right), \tan^{-1}_* \frac{x.im}{x.re}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{fma}\left(0.5, \frac{x.re \cdot x.re}{x.im}, x.im\right)\right)}^{y.re} \cdot t\_0\\
\end{array}
\end{array}
if y.re < -0.5Initial program 36.5%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6475.8
Applied rewrites75.8%
Taylor expanded in x.im around 0
Applied rewrites75.9%
if -0.5 < y.re < 1.7e-16Initial program 43.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6484.1
Applied rewrites84.1%
Taylor expanded in y.im around 0
Applied rewrites52.7%
Applied rewrites58.4%
if 1.7e-16 < y.re Initial program 32.8%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6450.6
Applied rewrites50.6%
Taylor expanded in x.re around 0
Applied rewrites48.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* (atan2 x.im x.re) y.re))))
(if (<= y.re -0.5)
(* (pow (fma 0.5 (/ (* x.im x.im) x.re) x.re) y.re) t_0)
(if (<= y.re 3.2e+22)
(fma (log (exp (- y.im))) (atan2 x.im x.re) 1.0)
(* (pow x.re y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_re <= -0.5) {
tmp = pow(fma(0.5, ((x_46_im * x_46_im) / x_46_re), x_46_re), y_46_re) * t_0;
} else if (y_46_re <= 3.2e+22) {
tmp = fma(log(exp(-y_46_im)), atan2(x_46_im, x_46_re), 1.0);
} else {
tmp = pow(x_46_re, y_46_re) * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) tmp = 0.0 if (y_46_re <= -0.5) tmp = Float64((fma(0.5, Float64(Float64(x_46_im * x_46_im) / x_46_re), x_46_re) ^ y_46_re) * t_0); elseif (y_46_re <= 3.2e+22) tmp = fma(log(exp(Float64(-y_46_im))), atan(x_46_im, x_46_re), 1.0); else tmp = Float64((x_46_re ^ y_46_re) * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -0.5], N[(N[Power[N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision] + x$46$re), $MachinePrecision], y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 3.2e+22], N[(N[Log[N[Exp[(-y$46$im)], $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + 1.0), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -0.5:\\
\;\;\;\;{\left(\mathsf{fma}\left(0.5, \frac{x.im \cdot x.im}{x.re}, x.re\right)\right)}^{y.re} \cdot t\_0\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(e^{-y.im}\right), \tan^{-1}_* \frac{x.im}{x.re}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot t\_0\\
\end{array}
\end{array}
if y.re < -0.5Initial program 36.5%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6475.8
Applied rewrites75.8%
Taylor expanded in x.im around 0
Applied rewrites75.9%
if -0.5 < y.re < 3.2e22Initial program 43.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6482.4
Applied rewrites82.4%
Taylor expanded in y.im around 0
Applied rewrites50.9%
Applied rewrites57.2%
if 3.2e22 < y.re Initial program 31.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6451.9
Applied rewrites51.9%
Taylor expanded in x.im around 0
Applied rewrites48.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -1.6) (not (<= y.re 1.7e-16))) (* (pow x.im y.re) (cos (* (atan2 x.im x.re) y.re))) (fma (log (exp (- y.im))) (atan2 x.im x.re) 1.0)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -1.6) || !(y_46_re <= 1.7e-16)) {
tmp = pow(x_46_im, y_46_re) * cos((atan2(x_46_im, x_46_re) * y_46_re));
} else {
tmp = fma(log(exp(-y_46_im)), atan2(x_46_im, x_46_re), 1.0);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -1.6) || !(y_46_re <= 1.7e-16)) tmp = Float64((x_46_im ^ y_46_re) * cos(Float64(atan(x_46_im, x_46_re) * y_46_re))); else tmp = fma(log(exp(Float64(-y_46_im))), atan(x_46_im, x_46_re), 1.0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -1.6], N[Not[LessEqual[y$46$re, 1.7e-16]], $MachinePrecision]], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[Exp[(-y$46$im)], $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.6 \lor \neg \left(y.re \leq 1.7 \cdot 10^{-16}\right):\\
\;\;\;\;{x.im}^{y.re} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(e^{-y.im}\right), \tan^{-1}_* \frac{x.im}{x.re}, 1\right)\\
\end{array}
\end{array}
if y.re < -1.6000000000000001 or 1.7e-16 < y.re Initial program 34.8%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6464.1
Applied rewrites64.1%
Taylor expanded in x.re around 0
Applied rewrites51.9%
if -1.6000000000000001 < y.re < 1.7e-16Initial program 43.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6484.1
Applied rewrites84.1%
Taylor expanded in y.im around 0
Applied rewrites52.7%
Applied rewrites58.4%
Final simplification54.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* (atan2 x.im x.re) y.re))))
(if (<= y.re -3300.0)
(* (pow (- x.im) y.re) t_0)
(if (<= y.re 3.2e+22)
(fma (log (exp (- y.im))) (atan2 x.im x.re) 1.0)
(* (pow x.re y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_re <= -3300.0) {
tmp = pow(-x_46_im, y_46_re) * t_0;
} else if (y_46_re <= 3.2e+22) {
tmp = fma(log(exp(-y_46_im)), atan2(x_46_im, x_46_re), 1.0);
} else {
tmp = pow(x_46_re, y_46_re) * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) tmp = 0.0 if (y_46_re <= -3300.0) tmp = Float64((Float64(-x_46_im) ^ y_46_re) * t_0); elseif (y_46_re <= 3.2e+22) tmp = fma(log(exp(Float64(-y_46_im))), atan(x_46_im, x_46_re), 1.0); else tmp = Float64((x_46_re ^ y_46_re) * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -3300.0], N[(N[Power[(-x$46$im), y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 3.2e+22], N[(N[Log[N[Exp[(-y$46$im)], $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + 1.0), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -3300:\\
\;\;\;\;{\left(-x.im\right)}^{y.re} \cdot t\_0\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(e^{-y.im}\right), \tan^{-1}_* \frac{x.im}{x.re}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot t\_0\\
\end{array}
\end{array}
if y.re < -3300Initial program 37.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6475.5
Applied rewrites75.5%
Taylor expanded in x.im around -inf
Applied rewrites63.3%
if -3300 < y.re < 3.2e22Initial program 43.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.8
Applied rewrites81.8%
Taylor expanded in y.im around 0
Applied rewrites50.5%
Applied rewrites56.7%
if 3.2e22 < y.re Initial program 31.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6451.9
Applied rewrites51.9%
Taylor expanded in x.im around 0
Applied rewrites48.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* (atan2 x.im x.re) y.re))))
(if (<= y.re -1.6)
(* (pow x.im y.re) t_0)
(if (<= y.re 3.2e+22)
(fma (log (exp (- y.im))) (atan2 x.im x.re) 1.0)
(* (pow x.re y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_re <= -1.6) {
tmp = pow(x_46_im, y_46_re) * t_0;
} else if (y_46_re <= 3.2e+22) {
tmp = fma(log(exp(-y_46_im)), atan2(x_46_im, x_46_re), 1.0);
} else {
tmp = pow(x_46_re, y_46_re) * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) tmp = 0.0 if (y_46_re <= -1.6) tmp = Float64((x_46_im ^ y_46_re) * t_0); elseif (y_46_re <= 3.2e+22) tmp = fma(log(exp(Float64(-y_46_im))), atan(x_46_im, x_46_re), 1.0); else tmp = Float64((x_46_re ^ y_46_re) * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1.6], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 3.2e+22], N[(N[Log[N[Exp[(-y$46$im)], $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + 1.0), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -1.6:\\
\;\;\;\;{x.im}^{y.re} \cdot t\_0\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(e^{-y.im}\right), \tan^{-1}_* \frac{x.im}{x.re}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot t\_0\\
\end{array}
\end{array}
if y.re < -1.6000000000000001Initial program 36.5%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6475.8
Applied rewrites75.8%
Taylor expanded in x.re around 0
Applied rewrites62.4%
if -1.6000000000000001 < y.re < 3.2e22Initial program 43.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6482.4
Applied rewrites82.4%
Taylor expanded in y.im around 0
Applied rewrites50.9%
Applied rewrites57.2%
if 3.2e22 < y.re Initial program 31.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6451.9
Applied rewrites51.9%
Taylor expanded in x.im around 0
Applied rewrites48.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (fma (log (exp (- y.im))) (atan2 x.im x.re) 1.0))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return fma(log(exp(-y_46_im)), atan2(x_46_im, x_46_re), 1.0);
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return fma(log(exp(Float64(-y_46_im))), atan(x_46_im, x_46_re), 1.0) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Log[N[Exp[(-y$46$im)], $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\log \left(e^{-y.im}\right), \tan^{-1}_* \frac{x.im}{x.re}, 1\right)
\end{array}
Initial program 38.8%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6456.3
Applied rewrites56.3%
Taylor expanded in y.im around 0
Applied rewrites25.9%
Applied rewrites34.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -510000.0) (* (- y.im) (- (atan2 x.im x.re) (pow (* y.im y.im) -0.5))) (* (- y.im) (/ -1.0 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 <= -510000.0) {
tmp = -y_46_im * (atan2(x_46_im, x_46_re) - pow((y_46_im * y_46_im), -0.5));
} else {
tmp = -y_46_im * (-1.0 / y_46_im);
}
return tmp;
}
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) :: tmp
if (y_46re <= (-510000.0d0)) then
tmp = -y_46im * (atan2(x_46im, x_46re) - ((y_46im * y_46im) ** (-0.5d0)))
else
tmp = -y_46im * ((-1.0d0) / 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 <= -510000.0) {
tmp = -y_46_im * (Math.atan2(x_46_im, x_46_re) - Math.pow((y_46_im * y_46_im), -0.5));
} else {
tmp = -y_46_im * (-1.0 / 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 <= -510000.0: tmp = -y_46_im * (math.atan2(x_46_im, x_46_re) - math.pow((y_46_im * y_46_im), -0.5)) else: tmp = -y_46_im * (-1.0 / 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 <= -510000.0) tmp = Float64(Float64(-y_46_im) * Float64(atan(x_46_im, x_46_re) - (Float64(y_46_im * y_46_im) ^ -0.5))); else tmp = Float64(Float64(-y_46_im) * Float64(-1.0 / 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 <= -510000.0) tmp = -y_46_im * (atan2(x_46_im, x_46_re) - ((y_46_im * y_46_im) ^ -0.5)); else tmp = -y_46_im * (-1.0 / y_46_im); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -510000.0], N[((-y$46$im) * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] - N[Power[N[(y$46$im * y$46$im), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-y$46$im) * N[(-1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -510000:\\
\;\;\;\;\left(-y.im\right) \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} - {\left(y.im \cdot y.im\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-y.im\right) \cdot \frac{-1}{y.im}\\
\end{array}
\end{array}
if y.re < -5.1e5Initial program 37.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6429.4
Applied rewrites29.4%
Taylor expanded in y.im around 0
Applied rewrites2.6%
Taylor expanded in y.im around -inf
Applied rewrites2.6%
Applied rewrites13.3%
if -5.1e5 < y.re Initial program 39.2%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6466.8
Applied rewrites66.8%
Taylor expanded in y.im around 0
Applied rewrites35.1%
Taylor expanded in y.im around -inf
Applied rewrites35.0%
Taylor expanded in y.im around 0
Applied rewrites35.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (- y.im) (/ -1.0 y.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return -y_46_im * (-1.0 / y_46_im);
}
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
code = -y_46im * ((-1.0d0) / y_46im)
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return -y_46_im * (-1.0 / y_46_im);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return -y_46_im * (-1.0 / y_46_im)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(-y_46_im) * Float64(-1.0 / y_46_im)) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = -y_46_im * (-1.0 / y_46_im); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[((-y$46$im) * N[(-1.0 / y$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-y.im\right) \cdot \frac{-1}{y.im}
\end{array}
Initial program 38.8%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6456.3
Applied rewrites56.3%
Taylor expanded in y.im around 0
Applied rewrites25.9%
Taylor expanded in y.im around -inf
Applied rewrites25.9%
Taylor expanded in y.im around 0
Applied rewrites26.0%
herbie shell --seed 2025017
(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)))))