
(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 16 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 (* (atan2 x.im x.re) y.re))
(t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_3 (exp (- (* t_2 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= (* t_3 (sin (+ (* t_2 y.im) t_1))) INFINITY)
(* t_3 (fma y.im (log (hypot x.im x.re)) (* y.re (atan2 x.im x.re))))
(*
(exp (fma t_0 y.re (* (- (atan2 x.im x.re)) y.im)))
(sin (fma t_0 y.im t_1))))))
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 = atan2(x_46_im, x_46_re) * y_46_re;
double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = exp(((t_2 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((t_3 * sin(((t_2 * y_46_im) + t_1))) <= ((double) INFINITY)) {
tmp = t_3 * fma(y_46_im, log(hypot(x_46_im, x_46_re)), (y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = exp(fma(t_0, y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im))) * sin(fma(t_0, y_46_im, t_1));
}
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 = Float64(atan(x_46_im, x_46_re) * y_46_re) t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_3 = exp(Float64(Float64(t_2 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (Float64(t_3 * sin(Float64(Float64(t_2 * y_46_im) + t_1))) <= Inf) tmp = Float64(t_3 * fma(y_46_im, log(hypot(x_46_im, x_46_re)), Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64(exp(fma(t_0, y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) * sin(fma(t_0, y_46_im, t_1))); 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(t$95$2 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Sin[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(t$95$0 * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$0 * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{t\_2 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;t\_3 \cdot \sin \left(t\_2 \cdot y.im + t\_1\right) \leq \infty:\\
\;\;\;\;t\_3 \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)} \cdot \sin \left(\mathsf{fma}\left(t\_0, y.im, t\_1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 81.1%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites41.8%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6488.5
Applied rewrites88.5%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (sin.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
Applied rewrites77.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (or (<= y.im -1.5e+51) (not (<= y.im 1.2e+29)))
(*
(exp (fma (log (hypot x.re x.im)) y.re (* (- (atan2 x.im x.re)) y.im)))
(sin t_0))
(* (pow (hypot x.im x.re) y.re) (fma y.im (log (hypot 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if ((y_46_im <= -1.5e+51) || !(y_46_im <= 1.2e+29)) {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (-atan2(x_46_im, x_46_re) * y_46_im))) * sin(t_0);
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * fma(y_46_im, log(hypot(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 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if ((y_46_im <= -1.5e+51) || !(y_46_im <= 1.2e+29)) tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im))) * sin(t_0)); else tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * fma(y_46_im, log(hypot(x_46_im, 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[Or[LessEqual[y$46$im, -1.5e+51], N[Not[LessEqual[y$46$im, 1.2e+29]], $MachinePrecision]], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $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.5 \cdot 10^{+51} \lor \neg \left(y.im \leq 1.2 \cdot 10^{+29}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im\right)} \cdot \sin t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\\
\end{array}
\end{array}
if y.im < -1.5e51 or 1.2e29 < y.im Initial program 32.2%
Applied rewrites69.5%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6473.3
Applied rewrites73.3%
if -1.5e51 < y.im < 1.2e29Initial program 46.7%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites54.9%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6474.9
Applied rewrites74.9%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6489.1
Applied rewrites89.1%
Final simplification83.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (fma y.im (log (hypot x.im x.re)) t_0)))
(if (<= y.re -0.086)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
t_0)
(if (<= y.re 1.55e-18)
(* (exp (* (- y.im) (atan2 x.im x.re))) t_1)
(* (pow (hypot x.im x.re) y.re) t_1)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0);
double tmp;
if (y_46_re <= -0.086) {
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))) * t_0;
} else if (y_46_re <= 1.55e-18) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_1;
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * t_1;
}
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 = fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0) tmp = 0.0 if (y_46_re <= -0.086) 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))) * t_0); elseif (y_46_re <= 1.55e-18) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * t_1); else tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * t_1); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[y$46$re, -0.086], 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] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.55e-18], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\\
\mathbf{if}\;y.re \leq -0.086:\\
\;\;\;\;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 t\_0\\
\mathbf{elif}\;y.re \leq 1.55 \cdot 10^{-18}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot t\_1\\
\end{array}
\end{array}
if y.re < -0.085999999999999993Initial program 32.4%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites54.9%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6483.2
Applied rewrites83.2%
if -0.085999999999999993 < y.re < 1.55000000000000003e-18Initial program 49.5%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites16.3%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6459.1
Applied rewrites59.1%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
lift-atan2.f6487.5
Applied rewrites87.5%
if 1.55000000000000003e-18 < y.re Initial program 37.0%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites41.2%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6470.0
Applied rewrites70.0%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6468.6
Applied rewrites68.6%
Final simplification80.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.im -7.2e+185)
(* (exp (* (- y.im) (atan2 x.im x.re))) (sin t_0))
(if (<= y.im 1.06e-29)
(* (pow (hypot x.im x.re) y.re) (fma y.im (log (hypot x.im x.re)) t_0))
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -7.2e+185) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin(t_0);
} else if (y_46_im <= 1.06e-29) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0);
} else {
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))) * 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_im <= -7.2e+185) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * sin(t_0)); elseif (y_46_im <= 1.06e-29) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0)); else 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))) * 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[y$46$im, -7.2e+185], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.06e-29], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]), $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] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -7.2 \cdot 10^{+185}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin t\_0\\
\mathbf{elif}\;y.im \leq 1.06 \cdot 10^{-29}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;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 t\_0\\
\end{array}
\end{array}
if y.im < -7.20000000000000058e185Initial program 47.8%
Applied rewrites69.6%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6482.6
Applied rewrites82.6%
Taylor expanded in y.re around 0
lower-*.f64N/A
lower-*.f64N/A
lift-atan2.f6465.5
Applied rewrites65.5%
if -7.20000000000000058e185 < y.im < 1.05999999999999995e-29Initial program 47.2%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites49.0%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6471.8
Applied rewrites71.8%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6484.0
Applied rewrites84.0%
if 1.05999999999999995e-29 < y.im Initial program 22.6%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites6.3%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6468.7
Applied rewrites68.7%
Final simplification78.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.re 9e+27)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
t_0)
(* (pow (hypot x.im 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 <= 9e+27) {
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))) * t_0;
} else {
tmp = pow(hypot(x_46_im, 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 <= 9e+27) 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))) * t_0); else tmp = Float64((hypot(x_46_im, 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, 9e+27], 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] * t$95$0), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], 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 9 \cdot 10^{+27}:\\
\;\;\;\;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 t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.re, t\_0\right)\right)\\
\end{array}
\end{array}
if x.re < 8.9999999999999998e27Initial program 47.2%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites34.9%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6462.3
Applied rewrites62.3%
if 8.9999999999999998e27 < x.re Initial program 21.0%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites31.5%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6458.7
Applied rewrites58.7%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6476.4
Applied rewrites76.4%
Taylor expanded in x.im around 0
lower-sin.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lift-atan2.f64N/A
lift-*.f6477.5
Applied rewrites77.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= x.re 9e+41)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
t_0)
(* (pow x.re y.re) (fma y.im (log (hypot 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 9e+41) {
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))) * t_0;
} else {
tmp = pow(x_46_re, y_46_re) * fma(y_46_im, log(hypot(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 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= 9e+41) 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))) * t_0); else tmp = Float64((x_46_re ^ y_46_re) * fma(y_46_im, log(hypot(x_46_im, 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, 9e+41], 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] * t$95$0), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $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 9 \cdot 10^{+41}:\\
\;\;\;\;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 t\_0\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\\
\end{array}
\end{array}
if x.re < 9.0000000000000002e41Initial program 47.3%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites35.2%
Taylor expanded in y.im around 0
lift-atan2.f64N/A
lift-*.f6462.5
Applied rewrites62.5%
if 9.0000000000000002e41 < x.re Initial program 18.9%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites30.2%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6457.5
Applied rewrites57.5%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6476.5
Applied rewrites76.5%
Taylor expanded in x.re around inf
Applied rewrites75.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.re -1.5e+134)
(* t_0 (pow (+ x.re (* 0.5 (/ (* x.im x.im) x.re))) y.re))
(if (<= y.re 1.85e-8)
(* (exp (* (- y.im) (atan2 x.im x.re))) (sin t_0))
(*
(pow (hypot x.im x.re) y.re)
(fma y.im (log (sqrt (fma x.im x.im (* x.re 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 (y_46_re <= -1.5e+134) {
tmp = t_0 * pow((x_46_re + (0.5 * ((x_46_im * x_46_im) / x_46_re))), y_46_re);
} else if (y_46_re <= 1.85e-8) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin(t_0);
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * fma(y_46_im, log(sqrt(fma(x_46_im, x_46_im, (x_46_re * 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 (y_46_re <= -1.5e+134) tmp = Float64(t_0 * (Float64(x_46_re + Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / x_46_re))) ^ y_46_re)); elseif (y_46_re <= 1.85e-8) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * sin(t_0)); else tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * fma(y_46_im, log(sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * 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[y$46$re, -1.5e+134], N[(t$95$0 * N[Power[N[(x$46$re + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.85e-8], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -1.5 \cdot 10^{+134}:\\
\;\;\;\;t\_0 \cdot {\left(x.re + 0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 1.85 \cdot 10^{-8}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin t\_0\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right), t\_0\right)\\
\end{array}
\end{array}
if y.re < -1.49999999999999998e134Initial program 37.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.f6485.4
Applied rewrites85.4%
Taylor expanded in x.im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6485.5
Applied rewrites85.5%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6495.9
Applied rewrites95.9%
if -1.49999999999999998e134 < y.re < 1.85e-8Initial program 43.5%
Applied rewrites84.6%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6458.0
Applied rewrites58.0%
Taylor expanded in y.re around 0
lower-*.f64N/A
lower-*.f64N/A
lift-atan2.f6454.3
Applied rewrites54.3%
if 1.85e-8 < y.re Initial program 39.1%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites43.5%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6472.5
Applied rewrites72.5%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6468.3
Applied rewrites68.3%
lift-hypot.f64N/A
pow2N/A
pow2N/A
lower-sqrt.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6465.4
Applied rewrites65.4%
Final simplification65.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.re -1.5e+134)
(* t_0 (pow (+ x.re (* 0.5 (/ (* x.im x.im) x.re))) y.re))
(if (<= y.re 1.4e-12)
(* (exp (* (- y.im) (atan2 x.im x.re))) (sin t_0))
(* (pow x.im y.re) (fma y.im (log (hypot 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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -1.5e+134) {
tmp = t_0 * pow((x_46_re + (0.5 * ((x_46_im * x_46_im) / x_46_re))), y_46_re);
} else if (y_46_re <= 1.4e-12) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin(t_0);
} else {
tmp = pow(x_46_im, y_46_re) * fma(y_46_im, log(hypot(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 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -1.5e+134) tmp = Float64(t_0 * (Float64(x_46_re + Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / x_46_re))) ^ y_46_re)); elseif (y_46_re <= 1.4e-12) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * sin(t_0)); else tmp = Float64((x_46_im ^ y_46_re) * fma(y_46_im, log(hypot(x_46_im, 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[y$46$re, -1.5e+134], N[(t$95$0 * N[Power[N[(x$46$re + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.4e-12], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -1.5 \cdot 10^{+134}:\\
\;\;\;\;t\_0 \cdot {\left(x.re + 0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 1.4 \cdot 10^{-12}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin t\_0\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\\
\end{array}
\end{array}
if y.re < -1.49999999999999998e134Initial program 37.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.f6485.4
Applied rewrites85.4%
Taylor expanded in x.im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6485.5
Applied rewrites85.5%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6495.9
Applied rewrites95.9%
if -1.49999999999999998e134 < y.re < 1.4000000000000001e-12Initial program 43.8%
Applied rewrites84.5%
Taylor expanded in y.re around inf
lift-atan2.f64N/A
lift-*.f6457.7
Applied rewrites57.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
lower-*.f64N/A
lift-atan2.f6454.2
Applied rewrites54.2%
if 1.4000000000000001e-12 < y.re Initial program 38.6%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites42.9%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6471.6
Applied rewrites71.6%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6468.7
Applied rewrites68.7%
Taylor expanded in x.re around 0
Applied rewrites61.8%
Final simplification64.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= y.im -7.2e+185)
(* (sin t_1) (pow (* 0.5 (/ (* x.re x.re) x.im)) y.re))
(if (<= y.im -2.6e-177)
(* (pow x.re y.re) (fma y.im (log (hypot x.im x.re)) t_1))
(if (<= y.im 1.45e+29) (* t_1 t_0) (* t_0 (sin (log 1.0))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -7.2e+185) {
tmp = sin(t_1) * pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else if (y_46_im <= -2.6e-177) {
tmp = pow(x_46_re, y_46_re) * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1);
} else if (y_46_im <= 1.45e+29) {
tmp = t_1 * t_0;
} else {
tmp = t_0 * sin(log(1.0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -7.2e+185) tmp = Float64(sin(t_1) * (Float64(0.5 * Float64(Float64(x_46_re * x_46_re) / x_46_im)) ^ y_46_re)); elseif (y_46_im <= -2.6e-177) tmp = Float64((x_46_re ^ y_46_re) * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1)); elseif (y_46_im <= 1.45e+29) tmp = Float64(t_1 * t_0); else tmp = Float64(t_0 * sin(log(1.0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -7.2e+185], N[(N[Sin[t$95$1], $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], If[LessEqual[y$46$im, -2.6e-177], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.45e+29], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$0 * N[Sin[N[Log[1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -7.2 \cdot 10^{+185}:\\
\;\;\;\;\sin t\_1 \cdot {\left(0.5 \cdot \frac{x.re \cdot x.re}{x.im}\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-177}:\\
\;\;\;\;{x.re}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_1\right)\\
\mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+29}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sin \log 1\\
\end{array}
\end{array}
if y.im < -7.20000000000000058e185Initial program 47.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.f6431.2
Applied rewrites31.2%
Taylor expanded in x.im around inf
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6435.6
Applied rewrites35.6%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.4
Applied rewrites48.4%
if -7.20000000000000058e185 < y.im < -2.6000000000000001e-177Initial program 40.2%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites25.6%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6462.7
Applied rewrites62.7%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6469.9
Applied rewrites69.9%
Taylor expanded in x.re around inf
Applied rewrites54.0%
if -2.6000000000000001e-177 < y.im < 1.45e29Initial program 48.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.f6465.3
Applied rewrites65.3%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6470.4
Applied rewrites70.4%
if 1.45e29 < y.im Initial program 24.5%
Taylor expanded in y.re around 0
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f640.0
Applied rewrites0.0%
Taylor expanded in y.im around 0
Applied rewrites50.3%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6459.7
Applied rewrites59.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= y.im -1.3e+158)
(* (sin t_1) (pow (* 0.5 (/ (* x.re x.re) x.im)) y.re))
(if (<= y.im -2.2e-115)
(* (pow x.im y.re) (fma y.im (log (hypot x.im x.re)) t_1))
(if (<= y.im 1.45e+29) (* t_1 t_0) (* t_0 (sin (log 1.0))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -1.3e+158) {
tmp = sin(t_1) * pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else if (y_46_im <= -2.2e-115) {
tmp = pow(x_46_im, y_46_re) * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1);
} else if (y_46_im <= 1.45e+29) {
tmp = t_1 * t_0;
} else {
tmp = t_0 * sin(log(1.0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -1.3e+158) tmp = Float64(sin(t_1) * (Float64(0.5 * Float64(Float64(x_46_re * x_46_re) / x_46_im)) ^ y_46_re)); elseif (y_46_im <= -2.2e-115) tmp = Float64((x_46_im ^ y_46_re) * fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1)); elseif (y_46_im <= 1.45e+29) tmp = Float64(t_1 * t_0); else tmp = Float64(t_0 * sin(log(1.0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1.3e+158], N[(N[Sin[t$95$1], $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], If[LessEqual[y$46$im, -2.2e-115], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 1.45e+29], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$0 * N[Sin[N[Log[1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -1.3 \cdot 10^{+158}:\\
\;\;\;\;\sin t\_1 \cdot {\left(0.5 \cdot \frac{x.re \cdot x.re}{x.im}\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq -2.2 \cdot 10^{-115}:\\
\;\;\;\;{x.im}^{y.re} \cdot \mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_1\right)\\
\mathbf{elif}\;y.im \leq 1.45 \cdot 10^{+29}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sin \log 1\\
\end{array}
\end{array}
if y.im < -1.3e158Initial program 43.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.f6430.9
Applied rewrites30.9%
Taylor expanded in x.im around inf
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6434.1
Applied rewrites34.1%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6447.1
Applied rewrites47.1%
if -1.3e158 < y.im < -2.1999999999999999e-115Initial program 35.9%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites17.0%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6453.4
Applied rewrites53.4%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6462.5
Applied rewrites62.5%
Taylor expanded in x.re around 0
Applied rewrites44.9%
if -2.1999999999999999e-115 < y.im < 1.45e29Initial program 49.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.f6463.7
Applied rewrites63.7%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6469.0
Applied rewrites69.0%
if 1.45e29 < y.im Initial program 24.5%
Taylor expanded in y.re around 0
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f640.0
Applied rewrites0.0%
Taylor expanded in y.im around 0
Applied rewrites50.3%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6459.7
Applied rewrites59.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (pow (hypot x.im x.re) y.re))) (if (<= x.re 4.5e-267) (* t_0 t_1) (* t_1 (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 t_1 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_re <= 4.5e-267) {
tmp = t_0 * t_1;
} else {
tmp = t_1 * 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)) t_1 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (x_46_re <= 4.5e-267) tmp = Float64(t_0 * t_1); else tmp = Float64(t_1 * 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]}, Block[{t$95$1 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[x$46$re, 4.5e-267], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$1 * N[(y$46$im * N[Log[x$46$re], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;x.re \leq 4.5 \cdot 10^{-267}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(y.im, \log x.re, t\_0\right)\\
\end{array}
\end{array}
if x.re < 4.4999999999999999e-267Initial program 39.6%
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.5
Applied rewrites49.5%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6450.3
Applied rewrites50.3%
if 4.4999999999999999e-267 < x.re Initial program 42.7%
Taylor expanded in y.re around 0
lower-+.f64N/A
lower-sin.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f64N/A
lower-*.f64N/A
Applied rewrites36.6%
Taylor expanded in y.im around 0
lower-fma.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-hypot.f64N/A
lift-atan2.f64N/A
lift-*.f6469.8
Applied rewrites69.8%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6471.1
Applied rewrites71.1%
Taylor expanded in x.re around inf
Applied rewrites67.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= y.im -7.2e+185)
(* (sin t_1) (pow (* 0.5 (/ (* x.re x.re) x.im)) y.re))
(if (<= y.im 9.5e+27) (* t_1 t_0) (* t_0 (sin (log 1.0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -7.2e+185) {
tmp = sin(t_1) * pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else if (y_46_im <= 9.5e+27) {
tmp = t_1 * t_0;
} else {
tmp = t_0 * sin(log(1.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.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -7.2e+185) {
tmp = Math.sin(t_1) * Math.pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else if (y_46_im <= 9.5e+27) {
tmp = t_1 * t_0;
} else {
tmp = t_0 * Math.sin(Math.log(1.0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_1 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if y_46_im <= -7.2e+185: tmp = math.sin(t_1) * math.pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re) elif y_46_im <= 9.5e+27: tmp = t_1 * t_0 else: tmp = t_0 * math.sin(math.log(1.0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -7.2e+185) tmp = Float64(sin(t_1) * (Float64(0.5 * Float64(Float64(x_46_re * x_46_re) / x_46_im)) ^ y_46_re)); elseif (y_46_im <= 9.5e+27) tmp = Float64(t_1 * t_0); else tmp = Float64(t_0 * sin(log(1.0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re; t_1 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (y_46_im <= -7.2e+185) tmp = sin(t_1) * ((0.5 * ((x_46_re * x_46_re) / x_46_im)) ^ y_46_re); elseif (y_46_im <= 9.5e+27) tmp = t_1 * t_0; else tmp = t_0 * sin(log(1.0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -7.2e+185], N[(N[Sin[t$95$1], $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], If[LessEqual[y$46$im, 9.5e+27], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$0 * N[Sin[N[Log[1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -7.2 \cdot 10^{+185}:\\
\;\;\;\;\sin t\_1 \cdot {\left(0.5 \cdot \frac{x.re \cdot x.re}{x.im}\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq 9.5 \cdot 10^{+27}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sin \log 1\\
\end{array}
\end{array}
if y.im < -7.20000000000000058e185Initial program 47.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.f6431.2
Applied rewrites31.2%
Taylor expanded in x.im around inf
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6435.6
Applied rewrites35.6%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.4
Applied rewrites48.4%
if -7.20000000000000058e185 < y.im < 9.4999999999999997e27Initial program 45.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.f6455.3
Applied rewrites55.3%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6459.8
Applied rewrites59.8%
if 9.4999999999999997e27 < y.im Initial program 23.6%
Taylor expanded in y.re around 0
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
pow2N/A
pow2N/A
lower-hypot.f640.0
Applied rewrites0.0%
Taylor expanded in y.im around 0
Applied rewrites48.5%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-hypot.f6457.6
Applied rewrites57.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.im -7.2e+185)
(* (sin t_0) (pow (* 0.5 (/ (* x.re x.re) x.im)) y.re))
(if (<= y.im 1.05e-31)
(* t_0 (pow (hypot x.im x.re) y.re))
(* t_0 (pow (+ x.re (* 0.5 (/ (* x.im 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 <= -7.2e+185) {
tmp = sin(t_0) * pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else if (y_46_im <= 1.05e-31) {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_0 * pow((x_46_re + (0.5 * ((x_46_im * 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 <= -7.2e+185) {
tmp = Math.sin(t_0) * Math.pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re);
} else if (y_46_im <= 1.05e-31) {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_0 * Math.pow((x_46_re + (0.5 * ((x_46_im * 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 <= -7.2e+185: tmp = math.sin(t_0) * math.pow((0.5 * ((x_46_re * x_46_re) / x_46_im)), y_46_re) elif y_46_im <= 1.05e-31: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = t_0 * math.pow((x_46_re + (0.5 * ((x_46_im * 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 <= -7.2e+185) tmp = Float64(sin(t_0) * (Float64(0.5 * Float64(Float64(x_46_re * x_46_re) / x_46_im)) ^ y_46_re)); elseif (y_46_im <= 1.05e-31) tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(t_0 * (Float64(x_46_re + Float64(0.5 * Float64(Float64(x_46_im * 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 <= -7.2e+185) tmp = sin(t_0) * ((0.5 * ((x_46_re * x_46_re) / x_46_im)) ^ y_46_re); elseif (y_46_im <= 1.05e-31) tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = t_0 * ((x_46_re + (0.5 * ((x_46_im * 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, -7.2e+185], 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], If[LessEqual[y$46$im, 1.05e-31], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[(x$46$re + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision]), $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 -7.2 \cdot 10^{+185}:\\
\;\;\;\;\sin t\_0 \cdot {\left(0.5 \cdot \frac{x.re \cdot x.re}{x.im}\right)}^{y.re}\\
\mathbf{elif}\;y.im \leq 1.05 \cdot 10^{-31}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(x.re + 0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -7.20000000000000058e185Initial program 47.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.f6431.2
Applied rewrites31.2%
Taylor expanded in x.im around inf
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6435.6
Applied rewrites35.6%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6448.4
Applied rewrites48.4%
if -7.20000000000000058e185 < y.im < 1.04999999999999996e-31Initial program 47.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.7
Applied rewrites56.7%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6459.6
Applied rewrites59.6%
if 1.04999999999999996e-31 < y.im Initial program 22.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.f6429.1
Applied rewrites29.1%
Taylor expanded in x.im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6436.8
Applied rewrites36.8%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6446.1
Applied rewrites46.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 1.05e-31)
(* t_0 (pow (hypot x.im x.re) y.re))
(* t_0 (pow (+ x.re (* 0.5 (/ (* x.im 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.05e-31) {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_0 * pow((x_46_re + (0.5 * ((x_46_im * 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.05e-31) {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_0 * Math.pow((x_46_re + (0.5 * ((x_46_im * 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.05e-31: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = t_0 * math.pow((x_46_re + (0.5 * ((x_46_im * 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.05e-31) tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(t_0 * (Float64(x_46_re + Float64(0.5 * Float64(Float64(x_46_im * 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.05e-31) tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = t_0 * ((x_46_re + (0.5 * ((x_46_im * 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.05e-31], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[(x$46$re + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision]), $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.05 \cdot 10^{-31}:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(x.re + 0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < 1.04999999999999996e-31Initial program 47.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.f6453.6
Applied rewrites53.6%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6455.2
Applied rewrites55.2%
if 1.04999999999999996e-31 < y.im Initial program 22.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.f6429.1
Applied rewrites29.1%
Taylor expanded in x.im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6436.8
Applied rewrites36.8%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6446.1
Applied rewrites46.1%
(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 -7400000000000.0) (not (<= y.re 0.00046)))
(* t_0 (pow (+ x.re (* 0.5 (/ (* x.im x.im) x.re))) y.re))
(* (sin t_0) 1.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 <= -7400000000000.0) || !(y_46_re <= 0.00046)) {
tmp = t_0 * pow((x_46_re + (0.5 * ((x_46_im * x_46_im) / x_46_re))), y_46_re);
} else {
tmp = sin(t_0) * 1.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 <= (-7400000000000.0d0)) .or. (.not. (y_46re <= 0.00046d0))) then
tmp = t_0 * ((x_46re + (0.5d0 * ((x_46im * x_46im) / x_46re))) ** y_46re)
else
tmp = sin(t_0) * 1.0d0
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 <= -7400000000000.0) || !(y_46_re <= 0.00046)) {
tmp = t_0 * Math.pow((x_46_re + (0.5 * ((x_46_im * x_46_im) / x_46_re))), y_46_re);
} else {
tmp = Math.sin(t_0) * 1.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 <= -7400000000000.0) or not (y_46_re <= 0.00046): tmp = t_0 * math.pow((x_46_re + (0.5 * ((x_46_im * x_46_im) / x_46_re))), y_46_re) else: tmp = math.sin(t_0) * 1.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 <= -7400000000000.0) || !(y_46_re <= 0.00046)) tmp = Float64(t_0 * (Float64(x_46_re + Float64(0.5 * Float64(Float64(x_46_im * x_46_im) / x_46_re))) ^ y_46_re)); else tmp = Float64(sin(t_0) * 1.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 <= -7400000000000.0) || ~((y_46_re <= 0.00046))) tmp = t_0 * ((x_46_re + (0.5 * ((x_46_im * x_46_im) / x_46_re))) ^ y_46_re); else tmp = sin(t_0) * 1.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, -7400000000000.0], N[Not[LessEqual[y$46$re, 0.00046]], $MachinePrecision]], N[(t$95$0 * N[Power[N[(x$46$re + N[(0.5 * N[(N[(x$46$im * x$46$im), $MachinePrecision] / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(N[Sin[t$95$0], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -7400000000000 \lor \neg \left(y.re \leq 0.00046\right):\\
\;\;\;\;t\_0 \cdot {\left(x.re + 0.5 \cdot \frac{x.im \cdot x.im}{x.re}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\sin t\_0 \cdot 1\\
\end{array}
\end{array}
if y.re < -7.4e12 or 4.6000000000000001e-4 < y.re Initial program 36.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.f6464.2
Applied rewrites64.2%
Taylor expanded in x.im around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6462.0
Applied rewrites62.0%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6468.6
Applied rewrites68.6%
if -7.4e12 < y.re < 4.6000000000000001e-4Initial program 47.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.f6428.6
Applied rewrites28.6%
Taylor expanded in y.re around 0
Applied rewrites26.7%
Final simplification49.0%
(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 41.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.f6447.5
Applied rewrites47.5%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6416.0
Applied rewrites16.0%
herbie shell --seed 2025061
(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)))))