
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (exp (fma t_0 y.re (* (- (atan2 x.im x.re)) y.im)))))
(if (<= y.im -1.06e+17)
(* t_1 (sin (* y.re (atan2 x.im x.re))))
(* t_1 (sin (fma t_0 y.im (* (atan2 x.im x.re) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = exp(fma(t_0, y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_im <= -1.06e+17) {
tmp = t_1 * sin((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = t_1 * sin(fma(t_0, y_46_im, (atan2(x_46_im, x_46_re) * y_46_re)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = exp(fma(t_0, y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) tmp = 0.0 if (y_46_im <= -1.06e+17) tmp = Float64(t_1 * sin(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64(t_1 * sin(fma(t_0, y_46_im, Float64(atan(x_46_im, 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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -1.06e+17], N[(t$95$1 * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sin[N[(t$95$0 * y$46$im + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := e^{\mathsf{fma}\left(t\_0, y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)}\\
\mathbf{if}\;y.im \leq -1.06 \cdot 10^{+17}:\\
\;\;\;\;t\_1 \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sin \left(\mathsf{fma}\left(t\_0, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\end{array}
\end{array}
if y.im < -1.06e17Initial program 37.5%
Applied rewrites65.2%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6473.7
Applied rewrites73.7%
if -1.06e17 < y.im Initial program 44.7%
Applied rewrites83.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (or (<= y.im -2.25e+14) (not (<= y.im 1.2e-8)))
(*
(exp (fma t_0 y.re (* (- (atan2 x.im x.re)) y.im)))
(sin (* y.re (atan2 x.im x.re))))
(*
(pow (hypot x.im x.re) y.re)
(sin (fma t_0 y.im (* (atan2 x.im x.re) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double tmp;
if ((y_46_im <= -2.25e+14) || !(y_46_im <= 1.2e-8)) {
tmp = exp(fma(t_0, y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im))) * sin((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * sin(fma(t_0, y_46_im, (atan2(x_46_im, x_46_re) * y_46_re)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if ((y_46_im <= -2.25e+14) || !(y_46_im <= 1.2e-8)) tmp = Float64(exp(fma(t_0, y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) * sin(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * sin(fma(t_0, y_46_im, Float64(atan(x_46_im, 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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y$46$im, -2.25e+14], N[Not[LessEqual[y$46$im, 1.2e-8]], $MachinePrecision]], N[(N[Exp[N[(t$95$0 * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Sin[N[(t$95$0 * y$46$im + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -2.25 \cdot 10^{+14} \lor \neg \left(y.im \leq 1.2 \cdot 10^{-8}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(t\_0, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\end{array}
\end{array}
if y.im < -2.25e14 or 1.19999999999999999e-8 < y.im Initial program 43.3%
Applied rewrites70.9%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6474.4
Applied rewrites74.4%
if -2.25e14 < y.im < 1.19999999999999999e-8Initial program 42.5%
Applied rewrites85.2%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lift-hypot.f64N/A
lift-pow.f6484.8
Applied rewrites84.8%
Final simplification79.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -5.3e+24) (not (<= y.im 1.9e-15)))
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(sin (* y.re (atan2 x.im x.re))))
(*
(pow (hypot x.im x.re) y.re)
(sin (fma (log (hypot x.re x.im)) 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 tmp;
if ((y_46_im <= -5.3e+24) || !(y_46_im <= 1.9e-15)) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, (atan2(x_46_im, x_46_re) * y_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 <= -5.3e+24) || !(y_46_im <= 1.9e-15)) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, Float64(atan(x_46_im, x_46_re) * y_46_re)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -5.3e+24], N[Not[LessEqual[y$46$im, 1.9e-15]], $MachinePrecision]], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Sin[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -5.3 \cdot 10^{+24} \lor \neg \left(y.im \leq 1.9 \cdot 10^{-15}\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 \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\end{array}
\end{array}
if y.im < -5.2999999999999999e24 or 1.9000000000000001e-15 < y.im Initial program 43.3%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6462.0
Applied rewrites62.0%
if -5.2999999999999999e24 < y.im < 1.9000000000000001e-15Initial program 42.5%
Applied rewrites85.4%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lift-hypot.f64N/A
lift-pow.f6485.0
Applied rewrites85.0%
Final simplification74.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.re)))
(if (<= x.re -2e+126)
(* (pow (hypot x.im x.re) y.re) (sin (fma (log (- x.re)) y.im t_0)))
(if (<= x.re 8e-156)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(sin (* y.re (atan2 x.im x.re))))
(* (pow x.re y.re) (sin (fma (log (hypot x.re x.im)) y.im t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_re;
double tmp;
if (x_46_re <= -2e+126) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * sin(fma(log(-x_46_re), y_46_im, t_0));
} else if (x_46_re <= 8e-156) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = pow(x_46_re, y_46_re) * sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_re) tmp = 0.0 if (x_46_re <= -2e+126) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * sin(fma(log(Float64(-x_46_re)), y_46_im, t_0))); elseif (x_46_re <= 8e-156) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64((x_46_re ^ y_46_re) * sin(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]}, If[LessEqual[x$46$re, -2e+126], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Sin[N[(N[Log[(-x$46$re)], $MachinePrecision] * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 8e-156], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[Sin[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{+126}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(-x.re\right), y.im, t\_0\right)\right)\\
\mathbf{elif}\;x.re \leq 8 \cdot 10^{-156}:\\
\;\;\;\;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 \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_0\right)\right)\\
\end{array}
\end{array}
if x.re < -1.99999999999999985e126Initial program 13.5%
Taylor expanded in y.im around 0
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6410.9
Applied rewrites10.9%
lift-+.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-log.f64N/A
lift-*.f64N/A
lift-atan2.f64N/A
lower-fma.f64N/A
Applied rewrites67.9%
Taylor expanded in x.re around -inf
lower-*.f6463.8
Applied rewrites63.8%
if -1.99999999999999985e126 < x.re < 8.00000000000000032e-156Initial program 53.4%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6467.5
Applied rewrites67.5%
if 8.00000000000000032e-156 < x.re Initial program 39.9%
Taylor expanded in y.im around 0
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6431.7
Applied rewrites31.7%
lift-+.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-log.f64N/A
lift-*.f64N/A
lift-atan2.f64N/A
lower-fma.f64N/A
Applied rewrites63.2%
Taylor expanded in x.re around inf
Applied rewrites62.1%
Final simplification65.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (sin (* y.re (atan2 x.im x.re)))))
(if (or (<= y.re -7.6e-17) (not (<= y.re 8.5e-7)))
(* t_0 (pow (hypot x.im x.re) y.re))
(* (exp (* (- y.im) (atan2 x.im x.re))) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = sin((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if ((y_46_re <= -7.6e-17) || !(y_46_re <= 8.5e-7)) {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp((-y_46_im * atan2(x_46_im, x_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.sin((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if ((y_46_re <= -7.6e-17) || !(y_46_re <= 8.5e-7)) {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if (y_46_re <= -7.6e-17) or not (y_46_re <= 8.5e-7): tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sin(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if ((y_46_re <= -7.6e-17) || !(y_46_re <= 8.5e-7)) tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_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 = sin((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if ((y_46_re <= -7.6e-17) || ~((y_46_re <= 8.5e-7))) tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = exp((-y_46_im * atan2(x_46_im, x_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[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y$46$re, -7.6e-17], N[Not[LessEqual[y$46$re, 8.5e-7]], $MachinePrecision]], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.re \leq -7.6 \cdot 10^{-17} \lor \neg \left(y.re \leq 8.5 \cdot 10^{-7}\right):\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_0\\
\end{array}
\end{array}
if y.re < -7.6000000000000002e-17 or 8.50000000000000014e-7 < y.re Initial program 38.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6471.9
Applied rewrites71.9%
if -7.6000000000000002e-17 < y.re < 8.50000000000000014e-7Initial program 48.0%
Applied rewrites79.8%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6451.5
Applied rewrites51.5%
Taylor expanded in y.re around 0
lower-*.f64N/A
lift-atan2.f64N/A
lift-*.f6451.5
Applied rewrites51.5%
Final simplification62.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -3.2e-120) (not (<= y.re 4.3e-137))) (* (sin (* y.re (atan2 x.im x.re))) (pow (hypot x.im x.re) y.re)) (* (exp (* (- y.im) (atan2 x.im x.re))) (sin (* y.im (log x.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 <= -3.2e-120) || !(y_46_re <= 4.3e-137)) {
tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin((y_46_im * log(x_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_re <= -3.2e-120) || !(y_46_re <= 4.3e-137)) {
tmp = Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * Math.sin((y_46_im * Math.log(x_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -3.2e-120) or not (y_46_re <= 4.3e-137): tmp = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * math.sin((y_46_im * math.log(x_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -3.2e-120) || !(y_46_re <= 4.3e-137)) tmp = Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * sin(Float64(y_46_im * log(x_46_im)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_re <= -3.2e-120) || ~((y_46_re <= 4.3e-137))) tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin((y_46_im * log(x_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -3.2e-120], N[Not[LessEqual[y$46$re, 4.3e-137]], $MachinePrecision]], N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.2 \cdot 10^{-120} \lor \neg \left(y.re \leq 4.3 \cdot 10^{-137}\right):\\
\;\;\;\;\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(y.im \cdot \log x.im\right)\\
\end{array}
\end{array}
if y.re < -3.1999999999999999e-120 or 4.2999999999999998e-137 < y.re Initial program 39.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6462.1
Applied rewrites62.1%
if -3.1999999999999999e-120 < y.re < 4.2999999999999998e-137Initial program 51.6%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6437.8
Applied rewrites37.8%
Taylor expanded in y.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-log.f6430.8
Applied rewrites30.8%
Final simplification53.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.re 2.8e-78)
(* (sin t_0) (pow (hypot x.im x.re) y.re))
(* (pow x.re y.re) (sin (fma y.im (log x.re) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 2.8e-78) {
tmp = sin(t_0) * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = pow(x_46_re, y_46_re) * sin(fma(y_46_im, log(x_46_re), t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= 2.8e-78) tmp = Float64(sin(t_0) * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64((x_46_re ^ y_46_re) * sin(fma(y_46_im, log(x_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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, 2.8e-78], N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$re], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq 2.8 \cdot 10^{-78}:\\
\;\;\;\;\sin t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.re, t\_0\right)\right)\\
\end{array}
\end{array}
if x.re < 2.80000000000000024e-78Initial program 48.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6452.4
Applied rewrites52.4%
if 2.80000000000000024e-78 < x.re Initial program 29.5%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6461.9
Applied rewrites61.9%
Taylor expanded in y.im around 0
lower-pow.f6456.5
Applied rewrites56.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.im 4.5e-51)
(* t_0 (pow (hypot x.im x.re) y.re))
(* (pow x.im y.re) (sin (fma y.im (log x.im) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= 4.5e-51) {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = pow(x_46_im, y_46_re) * sin(fma(y_46_im, log(x_46_im), t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_im <= 4.5e-51) tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64((x_46_im ^ y_46_re) * sin(fma(y_46_im, log(x_46_im), t_0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 4.5e-51], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq 4.5 \cdot 10^{-51}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_0\right)\right)\\
\end{array}
\end{array}
if x.im < 4.49999999999999974e-51Initial program 46.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6446.8
Applied rewrites46.8%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6447.4
Applied rewrites47.4%
if 4.49999999999999974e-51 < x.im Initial program 35.6%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6472.2
Applied rewrites72.2%
Taylor expanded in y.im around 0
lower-pow.f6462.7
Applied rewrites62.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (sin (* y.re (atan2 x.im x.re)))))
(if (<= y.im -2e+66)
(* t_0 (pow (* 0.5 (/ (* x.im x.im) x.re)) y.re))
(* t_0 (pow (hypot 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 = sin((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_im <= -2e+66) {
tmp = t_0 * pow((0.5 * ((x_46_im * x_46_im) / x_46_re)), y_46_re);
} else {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_im <= -2e+66) {
tmp = t_0 * Math.pow((0.5 * ((x_46_im * x_46_im) / x_46_re)), y_46_re);
} else {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if y_46_im <= -2e+66: tmp = t_0 * math.pow((0.5 * ((x_46_im * x_46_im) / x_46_re)), y_46_re) else: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sin(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (y_46_im <= -2e+66) tmp = Float64(t_0 * (Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / x_46_re)) ^ y_46_re)); else tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sin((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (y_46_im <= -2e+66) tmp = t_0 * ((0.5 * ((x_46_im * x_46_im) / x_46_re)) ^ y_46_re); else tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -2e+66], N[(t$95$0 * N[Power[N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.im \leq -2 \cdot 10^{+66}:\\
\;\;\;\;t\_0 \cdot {\left(0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -1.99999999999999989e66Initial program 39.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6428.1
Applied rewrites28.1%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6433.4
Applied rewrites33.4%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6440.2
Applied rewrites40.2%
if -1.99999999999999989e66 < y.im Initial program 43.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6453.7
Applied rewrites53.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.im -9e+147)
(*
t_0
(pow (* x.re (+ 1.0 (* 0.5 (/ (* x.im x.im) (* x.re x.re))))) y.re))
(if (<= y.im -1.55e+34)
(* (sin t_0) (pow (* 0.5 (/ (* x.re x.re) x.im)) y.re))
(* t_0 (pow (hypot 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -9e+147) {
tmp = t_0 * pow((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))), y_46_re);
} else if (y_46_im <= -1.55e+34) {
tmp = sin(t_0) * pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -9e+147) {
tmp = t_0 * Math.pow((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))), y_46_re);
} else if (y_46_im <= -1.55e+34) {
tmp = Math.sin(t_0) * Math.pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if y_46_im <= -9e+147: tmp = t_0 * math.pow((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))), y_46_re) elif y_46_im <= -1.55e+34: tmp = math.sin(t_0) * math.pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re) else: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -9e+147) tmp = Float64(t_0 * (Float64(x_46_re * Float64(1.0 + Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / Float64(x_46_re * x_46_re))))) ^ y_46_re)); elseif (y_46_im <= -1.55e+34) tmp = Float64(sin(t_0) * (Float64(0.5 * Float64(Float64(x_46_re * x_46_re) / x_46_im)) ^ y_46_re)); else tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (y_46_im <= -9e+147) tmp = t_0 * ((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))) ^ y_46_re); elseif (y_46_im <= -1.55e+34) tmp = sin(t_0) * ((0.5 * ((x_46_re * x_46_re) / x_46_im)) ^ y_46_re); else tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -9e+147], N[(t$95$0 * N[Power[N[(x$46$re * N[(1.0 + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, -1.55e+34], N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[N[(0.5 * N[(N[(x$46$re * x$46$re), $MachinePrecision] / x$46$im), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -9 \cdot 10^{+147}:\\
\;\;\;\;t\_0 \cdot {\left(x.re \cdot \left(1 + 0.5 \cdot \frac{x.im \cdot x.im}{x.re \cdot x.re}\right)\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq -1.55 \cdot 10^{+34}:\\
\;\;\;\;\sin t\_0 \cdot {\left(0.5 \cdot \frac{x.re \cdot x.re}{x.im}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -9.00000000000000016e147Initial program 32.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6431.0
Applied rewrites31.0%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6439.3
Applied rewrites39.3%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6436.1
Applied rewrites36.1%
if -9.00000000000000016e147 < y.im < -1.54999999999999989e34Initial program 46.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6436.1
Applied rewrites36.1%
Taylor expanded in x.im around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6431.8
Applied rewrites31.8%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6447.0
Applied rewrites47.0%
if -1.54999999999999989e34 < y.im Initial program 44.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6453.6
Applied rewrites53.6%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6454.1
Applied rewrites54.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.im -0.002)
(* (sin t_0) (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re))
(* t_0 (pow (hypot 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -0.002) {
tmp = sin(t_0) * pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re);
} else {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -0.002) tmp = Float64(sin(t_0) * (sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re)); else tmp = Float64(t_0 * (hypot(x_46_im, 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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -0.002], N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -0.002:\\
\;\;\;\;\sin t\_0 \cdot {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -2e-3Initial program 36.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6435.5
Applied rewrites35.5%
lift-hypot.f64N/A
pow2N/A
pow2N/A
lower-sqrt.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6439.4
Applied rewrites39.4%
if -2e-3 < y.im Initial program 45.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6454.3
Applied rewrites54.3%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6455.4
Applied rewrites55.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.im -1.7e+68)
(* (sin t_0) (pow (* 0.5 (/ (* x.im x.im) x.re)) y.re))
(* t_0 (pow (hypot 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -1.7e+68) {
tmp = sin(t_0) * pow((0.5 * ((x_46_im * x_46_im) / x_46_re)), y_46_re);
} else {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -1.7e+68) {
tmp = Math.sin(t_0) * Math.pow((0.5 * ((x_46_im * x_46_im) / x_46_re)), y_46_re);
} else {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if y_46_im <= -1.7e+68: tmp = math.sin(t_0) * math.pow((0.5 * ((x_46_im * x_46_im) / x_46_re)), y_46_re) else: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -1.7e+68) tmp = Float64(sin(t_0) * (Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / x_46_re)) ^ y_46_re)); else tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (y_46_im <= -1.7e+68) tmp = sin(t_0) * ((0.5 * ((x_46_im * x_46_im) / x_46_re)) ^ y_46_re); else tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+68], N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+68}:\\
\;\;\;\;\sin t\_0 \cdot {\left(0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -1.70000000000000008e68Initial program 39.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6428.1
Applied rewrites28.1%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6433.4
Applied rewrites33.4%
Taylor expanded in x.re around 0
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6440.2
Applied rewrites40.2%
if -1.70000000000000008e68 < y.im Initial program 43.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6453.7
Applied rewrites53.7%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6452.7
Applied rewrites52.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(*
t_0
(pow
(* x.im (+ 1.0 (* 0.5 (* (/ x.re x.im) (/ x.re x.im)))))
y.re))))
(if (<= y.re -0.00022)
t_1
(if (<= y.re 1.15e-62)
t_0
(if (<= y.re 3.2e+87) t_1 (* (sin t_0) (pow x.im y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = t_0 * pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re);
double tmp;
if (y_46_re <= -0.00022) {
tmp = t_1;
} else if (y_46_re <= 1.15e-62) {
tmp = t_0;
} else if (y_46_re <= 3.2e+87) {
tmp = t_1;
} else {
tmp = sin(t_0) * pow(x_46_im, y_46_re);
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = t_0 * ((x_46im * (1.0d0 + (0.5d0 * ((x_46re / x_46im) * (x_46re / x_46im))))) ** y_46re)
if (y_46re <= (-0.00022d0)) then
tmp = t_1
else if (y_46re <= 1.15d-62) then
tmp = t_0
else if (y_46re <= 3.2d+87) then
tmp = t_1
else
tmp = sin(t_0) * (x_46im ** y_46re)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = t_0 * Math.pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re);
double tmp;
if (y_46_re <= -0.00022) {
tmp = t_1;
} else if (y_46_re <= 1.15e-62) {
tmp = t_0;
} else if (y_46_re <= 3.2e+87) {
tmp = t_1;
} else {
tmp = Math.sin(t_0) * Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = t_0 * math.pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re) tmp = 0 if y_46_re <= -0.00022: tmp = t_1 elif y_46_re <= 1.15e-62: tmp = t_0 elif y_46_re <= 3.2e+87: tmp = t_1 else: tmp = math.sin(t_0) * math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = Float64(t_0 * (Float64(x_46_im * Float64(1.0 + Float64(0.5 * Float64(Float64(x_46_re / x_46_im) * Float64(x_46_re / x_46_im))))) ^ y_46_re)) tmp = 0.0 if (y_46_re <= -0.00022) tmp = t_1; elseif (y_46_re <= 1.15e-62) tmp = t_0; elseif (y_46_re <= 3.2e+87) tmp = t_1; else tmp = Float64(sin(t_0) * (x_46_im ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = t_0 * ((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))) ^ y_46_re); tmp = 0.0; if (y_46_re <= -0.00022) tmp = t_1; elseif (y_46_re <= 1.15e-62) tmp = t_0; elseif (y_46_re <= 3.2e+87) tmp = t_1; else tmp = sin(t_0) * (x_46_im ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Power[N[(x$46$im * N[(1.0 + N[(0.5 * N[(N[(x$46$re / x$46$im), $MachinePrecision] * N[(x$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -0.00022], t$95$1, If[LessEqual[y$46$re, 1.15e-62], t$95$0, If[LessEqual[y$46$re, 3.2e+87], t$95$1, N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := t\_0 \cdot {\left(x.im \cdot \left(1 + 0.5 \cdot \left(\frac{x.re}{x.im} \cdot \frac{x.re}{x.im}\right)\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -0.00022:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq 1.15 \cdot 10^{-62}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin t\_0 \cdot {x.im}^{y.re}\\
\end{array}
\end{array}
if y.re < -2.20000000000000008e-4 or 1.15e-62 < y.re < 3.2e87Initial program 35.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6471.1
Applied rewrites71.1%
Taylor expanded in x.im around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6470.0
Applied rewrites70.0%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6470.0
Applied rewrites70.0%
if -2.20000000000000008e-4 < y.re < 1.15e-62Initial program 48.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6423.2
Applied rewrites23.2%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6422.3
Applied rewrites22.3%
if 3.2e87 < y.re Initial program 45.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6462.6
Applied rewrites62.6%
Taylor expanded in x.re around 0
Applied rewrites56.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (sin t_0)))
(if (<= x.re -0.15)
(*
t_0
(pow (* x.im (+ 1.0 (* 0.5 (* (/ x.re x.im) (/ x.re x.im))))) y.re))
(if (<= x.re 5e-84) (* t_1 (pow x.im y.re)) (* t_1 (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 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = sin(t_0);
double tmp;
if (x_46_re <= -0.15) {
tmp = t_0 * pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re);
} else if (x_46_re <= 5e-84) {
tmp = t_1 * pow(x_46_im, y_46_re);
} else {
tmp = t_1 * pow(x_46_re, y_46_re);
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = sin(t_0)
if (x_46re <= (-0.15d0)) then
tmp = t_0 * ((x_46im * (1.0d0 + (0.5d0 * ((x_46re / x_46im) * (x_46re / x_46im))))) ** y_46re)
else if (x_46re <= 5d-84) then
tmp = t_1 * (x_46im ** y_46re)
else
tmp = t_1 * (x_46re ** y_46re)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.sin(t_0);
double tmp;
if (x_46_re <= -0.15) {
tmp = t_0 * Math.pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re);
} else if (x_46_re <= 5e-84) {
tmp = t_1 * Math.pow(x_46_im, y_46_re);
} else {
tmp = t_1 * Math.pow(x_46_re, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.sin(t_0) tmp = 0 if x_46_re <= -0.15: tmp = t_0 * math.pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re) elif x_46_re <= 5e-84: tmp = t_1 * math.pow(x_46_im, y_46_re) else: tmp = t_1 * math.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 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = sin(t_0) tmp = 0.0 if (x_46_re <= -0.15) tmp = Float64(t_0 * (Float64(x_46_im * Float64(1.0 + Float64(0.5 * Float64(Float64(x_46_re / x_46_im) * Float64(x_46_re / x_46_im))))) ^ y_46_re)); elseif (x_46_re <= 5e-84) tmp = Float64(t_1 * (x_46_im ^ y_46_re)); else tmp = Float64(t_1 * (x_46_re ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = sin(t_0); tmp = 0.0; if (x_46_re <= -0.15) tmp = t_0 * ((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))) ^ y_46_re); elseif (x_46_re <= 5e-84) tmp = t_1 * (x_46_im ^ y_46_re); else tmp = t_1 * (x_46_re ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[x$46$re, -0.15], N[(t$95$0 * N[Power[N[(x$46$im * N[(1.0 + N[(0.5 * N[(N[(x$46$re / x$46$im), $MachinePrecision] * N[(x$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5e-84], N[(t$95$1 * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[x$46$re, y$46$re], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \sin t\_0\\
\mathbf{if}\;x.re \leq -0.15:\\
\;\;\;\;t\_0 \cdot {\left(x.im \cdot \left(1 + 0.5 \cdot \left(\frac{x.re}{x.im} \cdot \frac{x.re}{x.im}\right)\right)\right)}^{y.re}\\
\mathbf{elif}\;x.re \leq 5 \cdot 10^{-84}:\\
\;\;\;\;t\_1 \cdot {x.im}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot {x.re}^{y.re}\\
\end{array}
\end{array}
if x.re < -0.149999999999999994Initial program 28.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6446.7
Applied rewrites46.7%
Taylor expanded in x.im around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6442.4
Applied rewrites42.4%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6445.4
Applied rewrites45.4%
if -0.149999999999999994 < x.re < 5.0000000000000002e-84Initial program 58.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6456.4
Applied rewrites56.4%
Taylor expanded in x.re around 0
Applied rewrites52.4%
if 5.0000000000000002e-84 < x.re Initial program 31.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6439.6
Applied rewrites39.6%
Taylor expanded in x.re around inf
Applied rewrites39.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.im 4.8e-12)
(* t_0 (pow (hypot x.im x.re) y.re))
(* (sin t_0) (pow x.im y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= 4.8e-12) {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = sin(t_0) * pow(x_46_im, y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= 4.8e-12) {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.sin(t_0) * Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_im <= 4.8e-12: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.sin(t_0) * math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_im <= 4.8e-12) tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(sin(t_0) * (x_46_im ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_im <= 4.8e-12) tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = sin(t_0) * (x_46_im ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 4.8e-12], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Sin[t$95$0], $MachinePrecision] * N[Power[x$46$im, y$46$re], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq 4.8 \cdot 10^{-12}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\sin t\_0 \cdot {x.im}^{y.re}\\
\end{array}
\end{array}
if x.im < 4.79999999999999974e-12Initial program 46.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6445.7
Applied rewrites45.7%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6446.2
Applied rewrites46.2%
if 4.79999999999999974e-12 < x.im Initial program 34.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6456.9
Applied rewrites56.9%
Taylor expanded in x.re around 0
Applied rewrites56.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (or (<= y.re -0.00022) (not (<= y.re 1.15e-62)))
(*
t_0
(pow (* x.im (+ 1.0 (* 0.5 (* (/ x.re x.im) (/ 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if ((y_46_re <= -0.00022) || !(y_46_re <= 1.15e-62)) {
tmp = t_0 * pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re);
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
if ((y_46re <= (-0.00022d0)) .or. (.not. (y_46re <= 1.15d-62))) then
tmp = t_0 * ((x_46im * (1.0d0 + (0.5d0 * ((x_46re / x_46im) * (x_46re / x_46im))))) ** y_46re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if ((y_46_re <= -0.00022) || !(y_46_re <= 1.15e-62)) {
tmp = t_0 * Math.pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re);
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if (y_46_re <= -0.00022) or not (y_46_re <= 1.15e-62): tmp = t_0 * math.pow((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))), y_46_re) else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if ((y_46_re <= -0.00022) || !(y_46_re <= 1.15e-62)) tmp = Float64(t_0 * (Float64(x_46_im * Float64(1.0 + Float64(0.5 * Float64(Float64(x_46_re / x_46_im) * Float64(x_46_re / x_46_im))))) ^ y_46_re)); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if ((y_46_re <= -0.00022) || ~((y_46_re <= 1.15e-62))) tmp = t_0 * ((x_46_im * (1.0 + (0.5 * ((x_46_re / x_46_im) * (x_46_re / x_46_im))))) ^ y_46_re); else tmp = 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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y$46$re, -0.00022], N[Not[LessEqual[y$46$re, 1.15e-62]], $MachinePrecision]], N[(t$95$0 * N[Power[N[(x$46$im * N[(1.0 + N[(0.5 * N[(N[(x$46$re / x$46$im), $MachinePrecision] * N[(x$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -0.00022 \lor \neg \left(y.re \leq 1.15 \cdot 10^{-62}\right):\\
\;\;\;\;t\_0 \cdot {\left(x.im \cdot \left(1 + 0.5 \cdot \left(\frac{x.re}{x.im} \cdot \frac{x.re}{x.im}\right)\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -2.20000000000000008e-4 or 1.15e-62 < y.re Initial program 38.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6468.3
Applied rewrites68.3%
Taylor expanded in x.im around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6464.9
Applied rewrites64.9%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6462.9
Applied rewrites62.9%
if -2.20000000000000008e-4 < y.re < 1.15e-62Initial program 48.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6423.2
Applied rewrites23.2%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6422.3
Applied rewrites22.3%
Final simplification45.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (or (<= y.re -4.8e-7) (not (<= y.re 5.2e-5)))
(*
t_0
(pow (* x.re (+ 1.0 (* 0.5 (/ (* x.im x.im) (* x.re 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if ((y_46_re <= -4.8e-7) || !(y_46_re <= 5.2e-5)) {
tmp = t_0 * pow((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))), y_46_re);
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
if ((y_46re <= (-4.8d-7)) .or. (.not. (y_46re <= 5.2d-5))) then
tmp = t_0 * ((x_46re * (1.0d0 + (0.5d0 * ((x_46im * x_46im) / (x_46re * x_46re))))) ** y_46re)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if ((y_46_re <= -4.8e-7) || !(y_46_re <= 5.2e-5)) {
tmp = t_0 * Math.pow((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))), y_46_re);
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if (y_46_re <= -4.8e-7) or not (y_46_re <= 5.2e-5): tmp = t_0 * math.pow((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))), y_46_re) else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if ((y_46_re <= -4.8e-7) || !(y_46_re <= 5.2e-5)) tmp = Float64(t_0 * (Float64(x_46_re * Float64(1.0 + Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / Float64(x_46_re * x_46_re))))) ^ y_46_re)); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if ((y_46_re <= -4.8e-7) || ~((y_46_re <= 5.2e-5))) tmp = t_0 * ((x_46_re * (1.0 + (0.5 * ((x_46_im * x_46_im) / (x_46_re * x_46_re))))) ^ y_46_re); else tmp = 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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y$46$re, -4.8e-7], N[Not[LessEqual[y$46$re, 5.2e-5]], $MachinePrecision]], N[(t$95$0 * N[Power[N[(x$46$re * N[(1.0 + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -4.8 \cdot 10^{-7} \lor \neg \left(y.re \leq 5.2 \cdot 10^{-5}\right):\\
\;\;\;\;t\_0 \cdot {\left(x.re \cdot \left(1 + 0.5 \cdot \frac{x.im \cdot x.im}{x.re \cdot x.re}\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -4.79999999999999957e-7 or 5.19999999999999968e-5 < y.re Initial program 38.1%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6472.1
Applied rewrites72.1%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6453.5
Applied rewrites53.5%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6452.1
Applied rewrites52.1%
if -4.79999999999999957e-7 < y.re < 5.19999999999999968e-5Initial program 48.5%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6421.8
Applied rewrites21.8%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6421.5
Applied rewrites21.5%
Final simplification38.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (sin (* y.re (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 sin((y_46_re * atan2(x_46_im, x_46_re))) * 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 = sin((y_46re * atan2(x_46im, x_46re))) * 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 Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re))) * 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) * 1.0
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) * 1.0) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * 1.0; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot 1
\end{array}
Initial program 42.9%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6449.1
Applied rewrites49.1%
Taylor expanded in y.re around 0
Applied rewrites13.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* y.re (atan2 x.im x.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return y_46_re * atan2(x_46_im, x_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
code = y_46re * atan2(x_46im, x_46re)
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_re * Math.atan2(x_46_im, x_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return y_46_re * math.atan2(x_46_im, x_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(y_46_re * atan(x_46_im, x_46_re)) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = y_46_re * atan2(x_46_im, x_46_re); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}
\end{array}
Initial program 42.9%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f6449.1
Applied rewrites49.1%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6413.8
Applied rewrites13.8%
herbie shell --seed 2025051
(FPCore (x.re x.im y.re y.im)
:name "powComplex, imaginary part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))