
(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 17 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))))
(if (<= y.re -1.16e-14)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos (* (fma t_0 (/ y.im y.re) (atan2 x.im x.re)) y.re)))
(if (<= y.re 1.06e+60)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos (* t_0 y.im)))
(*
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0)))
(pow (hypot x.im x.re) y.re))))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.re \leq -1.16 \cdot 10^{-14}:\\
\;\;\;\;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(\mathsf{fma}\left(t\_0, \frac{y.im}{y.re}, \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.re\right)\\
\mathbf{elif}\;y.re \leq 1.06 \cdot 10^{+60}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(t\_0 \cdot y.im\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -1.16000000000000007e-14Initial program 53.6%
Taylor expanded in y.re around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lower-atan2.f6484.3
Applied rewrites84.3%
Applied rewrites86.0%
if -1.16000000000000007e-14 < y.re < 1.0599999999999999e60Initial program 41.8%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6453.5
Applied rewrites53.5%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6482.1
Applied rewrites82.1%
if 1.0599999999999999e60 < y.re Initial program 22.9%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6466.7
Applied rewrites66.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6458.4
Applied rewrites58.4%
Applied rewrites75.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -9e-15)
(*
(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 1.06e+60)
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(cos (* (log (hypot x.im x.re)) y.im)))
(*
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0)))
(pow (hypot x.im x.re) y.re)))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -9 \cdot 10^{-15}:\\
\;\;\;\;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 1.06 \cdot 10^{+60}:\\
\;\;\;\;{\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)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -8.9999999999999995e-15Initial program 53.6%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6484.5
Applied rewrites84.5%
if -8.9999999999999995e-15 < y.re < 1.0599999999999999e60Initial program 41.8%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6453.5
Applied rewrites53.5%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6482.1
Applied rewrites82.1%
if 1.0599999999999999e60 < y.re Initial program 22.9%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6466.7
Applied rewrites66.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6458.4
Applied rewrites58.4%
Applied rewrites75.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -3.3e-8) (not (<= y.im 3.2e+95)))
(*
(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)))
(* (sin (* 0.5 (PI))) (pow (hypot x.im x.re) y.re))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.3 \cdot 10^{-8} \lor \neg \left(y.im \leq 3.2 \cdot 10^{+95}\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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -3.29999999999999977e-8 or 3.2000000000000001e95 < y.im Initial program 37.3%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6455.2
Applied rewrites55.2%
if -3.29999999999999977e-8 < y.im < 3.2000000000000001e95Initial program 45.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6467.4
Applied rewrites67.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.5
Applied rewrites80.5%
Applied rewrites85.7%
Taylor expanded in y.re around 0
Applied rewrites87.2%
Final simplification71.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.95e+144)
(*
(exp (* (- y.im) (atan2 x.im x.re)))
(cos (+ (* (log (- x.im)) y.im) (* (atan2 x.im x.re) y.re))))
(if (<= y.im 4.2e+50)
(* (pow (hypot x.im x.re) y.re) (cos (* (log (hypot x.im x.re)) y.im)))
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos (* (log x.im) 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_im <= -1.95e+144) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * cos(((log(-x_46_im) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
} else if (y_46_im <= 4.2e+50) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * cos((log(hypot(x_46_im, x_46_re)) * y_46_im));
} else {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos((log(x_46_im) * y_46_im));
}
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 <= -1.95e+144) {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * Math.cos(((Math.log(-x_46_im) * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
} else if (y_46_im <= 4.2e+50) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re) * Math.cos((Math.log(Math.hypot(x_46_im, x_46_re)) * y_46_im));
} else {
tmp = Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re)) * Math.cos((Math.log(x_46_im) * y_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -1.95e+144: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * math.cos(((math.log(-x_46_im) * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re))) elif y_46_im <= 4.2e+50: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) * math.cos((math.log(math.hypot(x_46_im, x_46_re)) * y_46_im)) else: tmp = math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) * math.cos((math.log(x_46_im) * 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_im <= -1.95e+144) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * cos(Float64(Float64(log(Float64(-x_46_im)) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))); elseif (y_46_im <= 4.2e+50) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * cos(Float64(log(hypot(x_46_im, x_46_re)) * y_46_im))); else tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos(Float64(log(x_46_im) * 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_im <= -1.95e+144) tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * cos(((log(-x_46_im) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); elseif (y_46_im <= 4.2e+50) tmp = (hypot(x_46_im, x_46_re) ^ y_46_re) * cos((log(hypot(x_46_im, x_46_re)) * y_46_im)); else tmp = (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)) * cos((log(x_46_im) * 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$im, -1.95e+144], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[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[y$46$im, 4.2e+50], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[Log[x$46$im], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.95 \cdot 10^{+144}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\log \left(-x.im\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{elif}\;y.im \leq 4.2 \cdot 10^{+50}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \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 \cos \left(\log x.im \cdot y.im\right)\\
\end{array}
\end{array}
if y.im < -1.95000000000000009e144Initial program 37.1%
Taylor expanded in x.re around -inf
mul-1-negN/A
lower-neg.f6419.5
Applied rewrites19.5%
Taylor expanded in x.im around -inf
mul-1-negN/A
lower-neg.f6419.6
Applied rewrites19.6%
Taylor expanded in y.re around 0
mul-1-negN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-atan2.f6447.0
Applied rewrites47.0%
if -1.95000000000000009e144 < y.im < 4.1999999999999999e50Initial program 47.6%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6441.7
Applied rewrites41.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.2
Applied rewrites81.2%
if 4.1999999999999999e50 < y.im Initial program 25.4%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6410.5
Applied rewrites10.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6426.8
Applied rewrites26.8%
Taylor expanded in x.re around 0
Applied rewrites14.8%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6444.8
Applied rewrites44.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.9e+243)
(*
(pow (- 1.0 y.im) (atan2 x.im x.re))
(cos (fma (log x.re) y.im (* (atan2 x.im x.re) y.re))))
(if (<= y.im -2.7e+144)
(*
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0)))
(pow (fma 0.5 (/ (* x.im x.im) x.re) x.re) y.re))
(if (<= y.im 4.2e+50)
(* (pow (hypot x.im x.re) y.re) (cos (* (log (hypot x.im x.re)) y.im)))
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos (* (log x.im) y.im)))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.9 \cdot 10^{+243}:\\
\;\;\;\;{\left(1 - y.im\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\mathsf{fma}\left(\log x.re, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\mathbf{elif}\;y.im \leq -2.7 \cdot 10^{+144}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot {\left(\mathsf{fma}\left(0.5, \frac{x.im \cdot x.im}{x.re}, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq 4.2 \cdot 10^{+50}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \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 \cos \left(\log x.im \cdot y.im\right)\\
\end{array}
\end{array}
if y.im < -2.90000000000000006e243Initial program 36.8%
Taylor expanded in x.im around 0
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6432.0
Applied rewrites32.0%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6442.4
Applied rewrites42.4%
Taylor expanded in y.im around 0
Applied rewrites42.4%
if -2.90000000000000006e243 < y.im < -2.70000000000000015e144Initial program 37.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6460.3
Applied rewrites60.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6426.3
Applied rewrites26.3%
Applied rewrites26.3%
Taylor expanded in x.im around 0
Applied rewrites43.5%
if -2.70000000000000015e144 < y.im < 4.1999999999999999e50Initial program 47.6%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6441.7
Applied rewrites41.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.2
Applied rewrites81.2%
if 4.1999999999999999e50 < y.im Initial program 25.4%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6410.5
Applied rewrites10.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6426.8
Applied rewrites26.8%
Taylor expanded in x.re around 0
Applied rewrites14.8%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6444.8
Applied rewrites44.8%
Final simplification67.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -4.1e+154)
(*
(exp (* (- y.im) (atan2 x.im x.re)))
(cos (fma (log x.re) y.im (* (atan2 x.im x.re) y.re))))
(if (<= y.im 4.2e+50)
(* (pow (hypot x.im x.re) y.re) (cos (* (log (hypot x.im x.re)) y.im)))
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos (* (log x.im) 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_im <= -4.1e+154) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * cos(fma(log(x_46_re), y_46_im, (atan2(x_46_im, x_46_re) * y_46_re)));
} else if (y_46_im <= 4.2e+50) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * cos((log(hypot(x_46_im, x_46_re)) * y_46_im));
} else {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos((log(x_46_im) * 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_im <= -4.1e+154) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * cos(fma(log(x_46_re), y_46_im, Float64(atan(x_46_im, x_46_re) * y_46_re)))); elseif (y_46_im <= 4.2e+50) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * cos(Float64(log(hypot(x_46_im, x_46_re)) * y_46_im))); else tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos(Float64(log(x_46_im) * y_46_im))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -4.1e+154], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[Log[x$46$re], $MachinePrecision] * y$46$im + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 4.2e+50], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[Log[x$46$im], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -4.1 \cdot 10^{+154}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(\mathsf{fma}\left(\log x.re, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\mathbf{elif}\;y.im \leq 4.2 \cdot 10^{+50}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \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 \cos \left(\log x.im \cdot y.im\right)\\
\end{array}
\end{array}
if y.im < -4.1e154Initial program 37.4%
Taylor expanded in x.im around 0
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f6429.9
Applied rewrites29.9%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6440.3
Applied rewrites40.3%
Applied rewrites40.2%
if -4.1e154 < y.im < 4.1999999999999999e50Initial program 47.3%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6440.9
Applied rewrites40.9%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6480.4
Applied rewrites80.4%
if 4.1999999999999999e50 < y.im Initial program 25.4%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6410.5
Applied rewrites10.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6426.8
Applied rewrites26.8%
Taylor expanded in x.re around 0
Applied rewrites14.8%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6444.8
Applied rewrites44.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.7e+144)
(*
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0)))
(pow (fma 0.5 (/ (* x.im x.im) x.re) x.re) y.re))
(if (<= y.im 4.2e+50)
(* (pow (hypot x.im x.re) y.re) (cos (* (log (hypot x.im x.re)) y.im)))
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos (* (log x.im) y.im))))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.7 \cdot 10^{+144}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot {\left(\mathsf{fma}\left(0.5, \frac{x.im \cdot x.im}{x.re}, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq 4.2 \cdot 10^{+50}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \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 \cos \left(\log x.im \cdot y.im\right)\\
\end{array}
\end{array}
if y.im < -2.70000000000000015e144Initial program 37.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6452.2
Applied rewrites52.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6417.8
Applied rewrites17.8%
Applied rewrites17.8%
Taylor expanded in x.im around 0
Applied rewrites31.6%
if -2.70000000000000015e144 < y.im < 4.1999999999999999e50Initial program 47.6%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6441.7
Applied rewrites41.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6481.2
Applied rewrites81.2%
if 4.1999999999999999e50 < y.im Initial program 25.4%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6410.5
Applied rewrites10.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6426.8
Applied rewrites26.8%
Taylor expanded in x.re around 0
Applied rewrites14.8%
Taylor expanded in y.re around 0
distribute-lft-neg-inN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lower-atan2.f6444.8
Applied rewrites44.8%
Final simplification65.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0))))
(t_1 (pow (hypot x.im x.re) y.re)))
(if (<= y.im -2.7e+144)
(* t_0 (pow (fma 0.5 (/ (* x.im x.im) x.re) x.re) y.re))
(if (<= y.im 3.6e-183)
(* t_1 (cos (* (log (hypot x.im x.re)) y.im)))
(* t_0 t_1)))))\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.im \leq -2.7 \cdot 10^{+144}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{fma}\left(0.5, \frac{x.im \cdot x.im}{x.re}, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq 3.6 \cdot 10^{-183}:\\
\;\;\;\;t\_1 \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\end{array}
\end{array}
if y.im < -2.70000000000000015e144Initial program 37.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6452.2
Applied rewrites52.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6417.8
Applied rewrites17.8%
Applied rewrites17.8%
Taylor expanded in x.im around 0
Applied rewrites31.6%
if -2.70000000000000015e144 < y.im < 3.6000000000000001e-183Initial program 49.0%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6442.9
Applied rewrites42.9%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6482.2
Applied rewrites82.2%
if 3.6000000000000001e-183 < y.im Initial program 32.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6455.5
Applied rewrites55.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6449.7
Applied rewrites49.7%
Applied rewrites55.2%
Final simplification64.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -7.5e+145)
(*
(sin (fma (atan2 x.im x.re) y.re (/ (PI) 2.0)))
(pow (fma 0.5 (/ (* x.im x.im) x.re) x.re) y.re))
(* (sin (* 0.5 (PI))) (pow (hypot x.im x.re) y.re))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -7.5 \cdot 10^{+145}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, \frac{\mathsf{PI}\left(\right)}{2}\right)\right) \cdot {\left(\mathsf{fma}\left(0.5, \frac{x.im \cdot x.im}{x.re}, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -7.50000000000000006e145Initial program 37.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6452.2
Applied rewrites52.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6417.8
Applied rewrites17.8%
Applied rewrites17.8%
Taylor expanded in x.im around 0
Applied rewrites31.6%
if -7.50000000000000006e145 < y.im Initial program 42.2%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6466.0
Applied rewrites66.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6464.7
Applied rewrites64.7%
Applied rewrites67.5%
Taylor expanded in y.re around 0
Applied rewrites68.4%
Final simplification62.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.65e+142)
(*
(cos (* (atan2 x.im x.re) y.re))
(pow (fma (/ (* x.im x.im) x.re) 0.5 x.re) y.re))
(* (sin (* 0.5 (PI))) (pow (hypot x.im x.re) y.re))))\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.65 \cdot 10^{+142}:\\
\;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot {\left(\mathsf{fma}\left(\frac{x.im \cdot x.im}{x.re}, 0.5, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -1.6500000000000001e142Initial program 37.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6452.2
Applied rewrites52.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6417.8
Applied rewrites17.8%
Taylor expanded in x.im around 0
Applied rewrites29.2%
if -1.6500000000000001e142 < y.im Initial program 42.2%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6466.0
Applied rewrites66.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6464.7
Applied rewrites64.7%
Applied rewrites67.5%
Taylor expanded in y.re around 0
Applied rewrites68.4%
Final simplification62.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -480000000.0) (not (<= y.re 1.46e+16))) (* (cos (* (atan2 x.im x.re) y.re)) (pow x.im y.re)) (fma y.re (log (hypot x.re x.im)) 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 <= -480000000.0) || !(y_46_re <= 1.46e+16)) {
tmp = cos((atan2(x_46_im, x_46_re) * y_46_re)) * pow(x_46_im, y_46_re);
} else {
tmp = fma(y_46_re, log(hypot(x_46_re, x_46_im)), 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 <= -480000000.0) || !(y_46_re <= 1.46e+16)) tmp = Float64(cos(Float64(atan(x_46_im, x_46_re) * y_46_re)) * (x_46_im ^ y_46_re)); else tmp = fma(y_46_re, log(hypot(x_46_re, x_46_im)), 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, -480000000.0], N[Not[LessEqual[y$46$re, 1.46e+16]], $MachinePrecision]], N[(N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision] * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision], N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -480000000 \lor \neg \left(y.re \leq 1.46 \cdot 10^{+16}\right):\\
\;\;\;\;\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot {x.im}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), 1\right)\\
\end{array}
\end{array}
if y.re < -4.8e8 or 1.46e16 < y.re Initial program 39.8%
Taylor expanded in y.re around 0
*-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
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6466.3
Applied rewrites66.3%
Taylor expanded in x.re around 0
Applied rewrites55.5%
if -4.8e8 < y.re < 1.46e16Initial program 42.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6451.7
Applied rewrites51.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6449.4
Applied rewrites49.4%
Taylor expanded in y.re around 0
Applied rewrites45.5%
Taylor expanded in y.re around 0
Applied rewrites45.8%
Final simplification50.3%
(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 -480000000.0)
(* t_0 (pow x.im y.re))
(if (<= y.re 5e+21)
(fma y.re (log (hypot x.re x.im)) 1.0)
(* t_0 (pow 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 = cos((atan2(x_46_im, x_46_re) * y_46_re));
double tmp;
if (y_46_re <= -480000000.0) {
tmp = t_0 * pow(x_46_im, y_46_re);
} else if (y_46_re <= 5e+21) {
tmp = fma(y_46_re, log(hypot(x_46_re, x_46_im)), 1.0);
} else {
tmp = t_0 * pow(x_46_re, y_46_re);
}
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 <= -480000000.0) tmp = Float64(t_0 * (x_46_im ^ y_46_re)); elseif (y_46_re <= 5e+21) tmp = fma(y_46_re, log(hypot(x_46_re, x_46_im)), 1.0); else tmp = Float64(t_0 * (x_46_re ^ y_46_re)); 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, -480000000.0], N[(t$95$0 * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 5e+21], N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision], N[(t$95$0 * N[Power[x$46$re, y$46$re], $MachinePrecision]), $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 -480000000:\\
\;\;\;\;t\_0 \cdot {x.im}^{y.re}\\
\mathbf{elif}\;y.re \leq 5 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {x.re}^{y.re}\\
\end{array}
\end{array}
if y.re < -4.8e8Initial program 55.7%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6485.3
Applied rewrites85.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6475.7
Applied rewrites75.7%
Taylor expanded in x.re around 0
Applied rewrites64.4%
if -4.8e8 < y.re < 5e21Initial program 43.1%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6452.0
Applied rewrites52.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6449.1
Applied rewrites49.1%
Taylor expanded in y.re around 0
Applied rewrites45.2%
Taylor expanded in y.re around 0
Applied rewrites45.5%
if 5e21 < y.re Initial program 21.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6469.7
Applied rewrites69.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6457.3
Applied rewrites57.3%
Taylor expanded in x.im around 0
Applied rewrites46.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -5e-310) (* (fma (* -0.5 (* y.re y.re)) (pow (atan2 x.im x.re) 2.0) 1.0) 1.0) (* (pow x.im y.re) (cos (* (log x.im) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -5e-310) {
tmp = fma((-0.5 * (y_46_re * y_46_re)), pow(atan2(x_46_im, x_46_re), 2.0), 1.0) * 1.0;
} else {
tmp = pow(x_46_im, y_46_re) * cos((log(x_46_im) * y_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= -5e-310) tmp = Float64(fma(Float64(-0.5 * Float64(y_46_re * y_46_re)), (atan(x_46_im, x_46_re) ^ 2.0), 1.0) * 1.0); else tmp = Float64((x_46_im ^ y_46_re) * cos(Float64(log(x_46_im) * y_46_im))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -5e-310], N[(N[(N[(-0.5 * N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[Cos[N[(N[Log[x$46$im], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot \left(y.re \cdot y.re\right), {\tan^{-1}_* \frac{x.im}{x.re}}^{2}, 1\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re} \cdot \cos \left(\log x.im \cdot y.im\right)\\
\end{array}
\end{array}
if x.im < -4.999999999999985e-310Initial program 39.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6465.4
Applied rewrites65.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6452.5
Applied rewrites52.5%
Taylor expanded in y.re around 0
Applied rewrites23.3%
Taylor expanded in y.re around 0
Applied rewrites27.6%
if -4.999999999999985e-310 < x.im Initial program 43.2%
Taylor expanded in y.im around 0
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6434.5
Applied rewrites34.5%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6462.6
Applied rewrites62.6%
Taylor expanded in x.re around 0
Applied rewrites61.9%
Taylor expanded in x.re around 0
Applied rewrites56.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (sin (* 0.5 (PI))) (pow (hypot x.im x.re) y.re)))
\begin{array}{l}
\\
\sin \left(0.5 \cdot \mathsf{PI}\left(\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 41.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6457.2
Applied rewrites57.2%
Applied rewrites59.5%
Taylor expanded in y.re around 0
Applied rewrites59.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (fma (* -0.5 (* y.re y.re)) (pow (atan2 x.im x.re) 2.0) 1.0) 1.0))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return fma((-0.5 * (y_46_re * y_46_re)), pow(atan2(x_46_im, x_46_re), 2.0), 1.0) * 1.0;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(fma(Float64(-0.5 * Float64(y_46_re * y_46_re)), (atan(x_46_im, x_46_re) ^ 2.0), 1.0) * 1.0) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(-0.5 * N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5 \cdot \left(y.re \cdot y.re\right), {\tan^{-1}_* \frac{x.im}{x.re}}^{2}, 1\right) \cdot 1
\end{array}
Initial program 41.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6457.2
Applied rewrites57.2%
Taylor expanded in y.re around 0
Applied rewrites25.7%
Taylor expanded in y.re around 0
Applied rewrites31.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (fma y.re (log (hypot x.re x.im)) 1.0))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return fma(y_46_re, log(hypot(x_46_re, x_46_im)), 1.0);
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return fma(y_46_re, log(hypot(x_46_re, x_46_im)), 1.0) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y.re, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), 1\right)
\end{array}
Initial program 41.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6457.2
Applied rewrites57.2%
Taylor expanded in y.re around 0
Applied rewrites25.7%
Taylor expanded in y.re around 0
Applied rewrites25.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 1.0)
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0
function code(x_46_re, x_46_im, y_46_re, y_46_im) return 1.0 end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 41.4%
Taylor expanded in y.re around 0
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6463.8
Applied rewrites63.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-atan2.f64N/A
lower-pow.f64N/A
unpow2N/A
unpow2N/A
lower-hypot.f6457.2
Applied rewrites57.2%
Taylor expanded in y.re around 0
Applied rewrites25.7%
Taylor expanded in y.re around 0
Applied rewrites25.7%
herbie shell --seed 2024347
(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)))))