
(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}
Herbie found 14 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.im x.re)))
(t_1
(exp (- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im))))
(t_2 (* y.re (atan2 x.im x.re))))
(if (<= y.re -150000000.0)
(* t_1 (sin (* y.im t_0)))
(if (<= y.re 1.7e-214)
(* t_1 (sin (* y.im (+ t_0 (/ t_2 y.im)))))
(*
t_1
(+
(sin t_2)
(* y.im (* (sin (fma y.re (atan2 x.im x.re) (/ PI 2.0))) t_0))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_im, x_46_re));
double t_1 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -150000000.0) {
tmp = t_1 * sin((y_46_im * t_0));
} else if (y_46_re <= 1.7e-214) {
tmp = t_1 * sin((y_46_im * (t_0 + (t_2 / y_46_im))));
} else {
tmp = t_1 * (sin(t_2) + (y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * t_0)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_im, x_46_re)) t_1 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -150000000.0) tmp = Float64(t_1 * sin(Float64(y_46_im * t_0))); elseif (y_46_re <= 1.7e-214) tmp = Float64(t_1 * sin(Float64(y_46_im * Float64(t_0 + Float64(t_2 / y_46_im))))); else tmp = Float64(t_1 * Float64(sin(t_2) + Float64(y_46_im * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * t_0)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -150000000.0], N[(t$95$1 * N[Sin[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.7e-214], N[(t$95$1 * N[Sin[N[(y$46$im * N[(t$95$0 + N[(t$95$2 / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Sin[t$95$2], $MachinePrecision] + N[(y$46$im * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -150000000:\\
\;\;\;\;t\_1 \cdot \sin \left(y.im \cdot t\_0\right)\\
\mathbf{elif}\;y.re \leq 1.7 \cdot 10^{-214}:\\
\;\;\;\;t\_1 \cdot \sin \left(y.im \cdot \left(t\_0 + \frac{t\_2}{y.im}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\sin t\_2 + y.im \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if y.re < -1.5e8Initial program 41.8%
Applied rewrites69.2%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites84.7%
Taylor expanded in y.im around inf
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-+.f64N/A
lower-log.f64N/A
unpow1/2N/A
lower-hypot.f64N/A
lower-/.f64N/A
lift-atan2.f64N/A
lift-*.f6467.3
Applied rewrites67.3%
Taylor expanded in y.re around 0
pow2N/A
pow2N/A
lift-hypot.f64N/A
lift-log.f6485.4
Applied rewrites85.4%
if -1.5e8 < y.re < 1.7e-214Initial program 42.1%
Applied rewrites82.9%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites83.2%
Taylor expanded in y.im around inf
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-+.f64N/A
lower-log.f64N/A
unpow1/2N/A
lower-hypot.f64N/A
lower-/.f64N/A
lift-atan2.f64N/A
lift-*.f6483.2
Applied rewrites83.2%
if 1.7e-214 < y.re Initial program 39.8%
Applied rewrites65.4%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites75.0%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-*.f64N/A
Applied rewrites74.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.re 1e-50)
(* t_1 (sin (fma t_0 y.im (* (atan2 x.im x.re) y.re))))
(*
t_1
(+
(sin (* y.re (atan2 x.im x.re)))
(*
y.im
(*
(sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
(log (hypot x.im x.re)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= 1e-50) {
tmp = t_1 * sin(fma(t_0, y_46_im, (atan2(x_46_im, x_46_re) * y_46_re)));
} else {
tmp = t_1 * (sin((y_46_re * atan2(x_46_im, x_46_re))) + (y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(hypot(x_46_im, x_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(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_re <= 1e-50) tmp = Float64(t_1 * sin(fma(t_0, y_46_im, Float64(atan(x_46_im, x_46_re) * y_46_re)))); else tmp = Float64(t_1 * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) + Float64(y_46_im * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log(hypot(x_46_im, x_46_re)))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[x$46$re, 1e-50], 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], N[(t$95$1 * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(y$46$im * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $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^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.re \leq 10^{-50}:\\
\;\;\;\;t\_1 \cdot \sin \left(\mathsf{fma}\left(t\_0, y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) + y.im \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right)\\
\end{array}
\end{array}
if x.re < 1.00000000000000001e-50Initial program 44.4%
Applied rewrites72.4%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites81.4%
if 1.00000000000000001e-50 < x.re Initial program 32.9%
Applied rewrites71.5%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites76.7%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-*.f64N/A
Applied rewrites75.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re -6.5e-26)
(* t_1 (sin (* y.im t_0)))
(*
t_1
(+
(sin (* y.re (atan2 x.im x.re)))
(* y.im (* (sin (fma y.re (atan2 x.im x.re) (/ PI 2.0))) t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_im, x_46_re));
double t_1 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -6.5e-26) {
tmp = t_1 * sin((y_46_im * t_0));
} else {
tmp = t_1 * (sin((y_46_re * atan2(x_46_im, x_46_re))) + (y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * t_0)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_im, x_46_re)) t_1 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= -6.5e-26) tmp = Float64(t_1 * sin(Float64(y_46_im * t_0))); else tmp = Float64(t_1 * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) + Float64(y_46_im * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * t_0)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -6.5e-26], N[(t$95$1 * N[Sin[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(y$46$im * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -6.5 \cdot 10^{-26}:\\
\;\;\;\;t\_1 \cdot \sin \left(y.im \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) + y.im \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if y.re < -6.5e-26Initial program 42.2%
Applied rewrites70.4%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites84.7%
Taylor expanded in y.im around inf
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-+.f64N/A
lower-log.f64N/A
unpow1/2N/A
lower-hypot.f64N/A
lower-/.f64N/A
lift-atan2.f64N/A
lift-*.f6469.0
Applied rewrites69.0%
Taylor expanded in y.re around 0
pow2N/A
pow2N/A
lift-hypot.f64N/A
lift-log.f6482.0
Applied rewrites82.0%
if -6.5e-26 < y.re Initial program 40.6%
Applied rewrites72.8%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites78.4%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-*.f64N/A
Applied rewrites76.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(*
(exp (- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))
(+
(sin (* y.re (atan2 x.im x.re)))
(*
y.im
(*
(sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
(log (hypot x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((log(hypot(x_46_re, 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))) + (y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(hypot(x_46_im, x_46_re)))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) + Float64(y_46_im * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log(hypot(x_46_im, x_46_re)))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(y$46$im * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) + y.im \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right)
\end{array}
Initial program 41.1%
Applied rewrites72.2%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites80.1%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-*.f64N/A
Applied rewrites79.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (sin (* y.re (atan2 x.im x.re))))
(t_2 (sin (* 0.5 PI)))
(t_3
(exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_0)))
(t_4 (log (hypot x.im x.re))))
(if (<= y.re -2e+32)
(* t_3 (* y.re (* t_2 (atan2 x.im x.re))))
(if (<= y.re 4.6e+86)
(*
(exp (- (* (log (hypot x.re x.im)) y.re) t_0))
(+
t_1
(fma
y.im
(* t_4 t_2)
(*
y.re
(fma
-0.5
(* y.im (* y.re (* t_4 (* t_2 (pow (atan2 x.im x.re) 2.0)))))
(*
y.im
(* (sin (fma 0.5 PI (/ PI 2.0))) (* t_4 (atan2 x.im x.re)))))))))
(*
t_3
(-
t_1
(*
(- y.im)
(*
(sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
(log (pow (fma x.im x.im (* x.re x.re)) 0.5))))))))))
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_im;
double t_1 = sin((y_46_re * atan2(x_46_im, x_46_re)));
double t_2 = sin((0.5 * ((double) M_PI)));
double t_3 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0));
double t_4 = log(hypot(x_46_im, x_46_re));
double tmp;
if (y_46_re <= -2e+32) {
tmp = t_3 * (y_46_re * (t_2 * atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 4.6e+86) {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * (t_1 + fma(y_46_im, (t_4 * t_2), (y_46_re * fma(-0.5, (y_46_im * (y_46_re * (t_4 * (t_2 * pow(atan2(x_46_im, x_46_re), 2.0))))), (y_46_im * (sin(fma(0.5, ((double) M_PI), (((double) M_PI) / 2.0))) * (t_4 * atan2(x_46_im, x_46_re))))))));
} else {
tmp = t_3 * (t_1 - (-y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5)))));
}
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_im) t_1 = sin(Float64(y_46_re * atan(x_46_im, x_46_re))) t_2 = sin(Float64(0.5 * pi)) t_3 = exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_0)) t_4 = log(hypot(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -2e+32) tmp = Float64(t_3 * Float64(y_46_re * Float64(t_2 * atan(x_46_im, x_46_re)))); elseif (y_46_re <= 4.6e+86) tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * Float64(t_1 + fma(y_46_im, Float64(t_4 * t_2), Float64(y_46_re * fma(-0.5, Float64(y_46_im * Float64(y_46_re * Float64(t_4 * Float64(t_2 * (atan(x_46_im, x_46_re) ^ 2.0))))), Float64(y_46_im * Float64(sin(fma(0.5, pi, Float64(pi / 2.0))) * Float64(t_4 * atan(x_46_im, x_46_re))))))))); else tmp = Float64(t_3 * Float64(t_1 - Float64(Float64(-y_46_im) * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5)))))); 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$im), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = 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] - t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -2e+32], N[(t$95$3 * N[(y$46$re * N[(t$95$2 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 4.6e+86], N[(N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 + N[(y$46$im * N[(t$95$4 * t$95$2), $MachinePrecision] + N[(y$46$re * N[(-0.5 * N[(y$46$im * N[(y$46$re * N[(t$95$4 * N[(t$95$2 * N[Power[N[ArcTan[x$46$im / x$46$re], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[(N[Sin[N[(0.5 * Pi + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$4 * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[(t$95$1 - N[((-y$46$im) * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_2 := \sin \left(0.5 \cdot \pi\right)\\
t_3 := e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t\_0}\\
t_4 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.re \leq -2 \cdot 10^{+32}:\\
\;\;\;\;t\_3 \cdot \left(y.re \cdot \left(t\_2 \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\mathbf{elif}\;y.re \leq 4.6 \cdot 10^{+86}:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t\_0} \cdot \left(t\_1 + \mathsf{fma}\left(y.im, t\_4 \cdot t\_2, y.re \cdot \mathsf{fma}\left(-0.5, y.im \cdot \left(y.re \cdot \left(t\_4 \cdot \left(t\_2 \cdot {\tan^{-1}_* \frac{x.im}{x.re}}^{2}\right)\right)\right), y.im \cdot \left(\sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right) \cdot \left(t\_4 \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)\\
\end{array}
\end{array}
if y.re < -2.00000000000000011e32Initial program 42.0%
Taylor expanded in y.re around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites21.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-atan2.f6483.0
Applied rewrites83.0%
if -2.00000000000000011e32 < y.re < 4.59999999999999979e86Initial program 41.9%
Applied rewrites79.1%
lift-/.f64N/A
lift-exp.f64N/A
lift-log.f64N/A
lift-hypot.f64N/A
lower-*.f64N/A
lift-exp.f64N/A
div-expN/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
Applied rewrites82.0%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-*.f64N/A
pow1/2N/A
pow2N/A
pow2N/A
lower-*.f64N/A
Applied rewrites79.9%
Taylor expanded in y.re around 0
Applied rewrites78.8%
if 4.59999999999999979e86 < y.re Initial program 37.1%
Taylor expanded in y.im around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites57.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im))))
(t_2 (* t_1 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
(if (<= t_2 INFINITY) t_2 (* t_1 (sin (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_2 = t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
double tmp;
if (t_2 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = t_1 * sin((y_46_re * atan2(x_46_im, x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_1 = Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double t_2 = t_1 * Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
double tmp;
if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = t_1 * Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re)));
}
return tmp;
}
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)))) t_1 = math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) t_2 = t_1 * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re))) tmp = 0 if t_2 <= math.inf: tmp = t_2 else: tmp = t_1 * math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) t_2 = Float64(t_1 * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) tmp = 0.0 if (t_2 <= Inf) tmp = t_2; else tmp = Float64(t_1 * sin(Float64(y_46_re * atan(x_46_im, x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); t_2 = t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); tmp = 0.0; if (t_2 <= Inf) tmp = t_2; else tmp = t_1 * sin((y_46_re * atan2(x_46_im, x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 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]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[(t$95$1 * 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]}, If[LessEqual[t$95$2, Infinity], t$95$2, N[(t$95$1 * N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$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)\\
t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_2 := t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;t\_2 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\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 80.0%
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%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6442.5
Applied rewrites42.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im))))
(t_1 (* (atan2 x.im x.re) y.re)))
(if (<= x.im -5e-309)
(* t_0 (sin (+ (* (log (pow (/ -1.0 x.im) -1.0)) y.im) t_1)))
(* t_0 (sin (+ (* (log x.im) 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 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_1 = atan2(x_46_im, x_46_re) * y_46_re;
double tmp;
if (x_46_im <= -5e-309) {
tmp = t_0 * sin(((log(pow((-1.0 / x_46_im), -1.0)) * y_46_im) + t_1));
} else {
tmp = t_0 * sin(((log(x_46_im) * y_46_im) + t_1));
}
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 = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
t_1 = atan2(x_46im, x_46re) * y_46re
if (x_46im <= (-5d-309)) then
tmp = t_0 * sin(((log((((-1.0d0) / x_46im) ** (-1.0d0))) * y_46im) + t_1))
else
tmp = t_0 * sin(((log(x_46im) * y_46im) + t_1))
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 = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double t_1 = Math.atan2(x_46_im, x_46_re) * y_46_re;
double tmp;
if (x_46_im <= -5e-309) {
tmp = t_0 * Math.sin(((Math.log(Math.pow((-1.0 / x_46_im), -1.0)) * y_46_im) + t_1));
} else {
tmp = t_0 * Math.sin(((Math.log(x_46_im) * y_46_im) + t_1));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) t_1 = math.atan2(x_46_im, x_46_re) * y_46_re tmp = 0 if x_46_im <= -5e-309: tmp = t_0 * math.sin(((math.log(math.pow((-1.0 / x_46_im), -1.0)) * y_46_im) + t_1)) else: tmp = t_0 * math.sin(((math.log(x_46_im) * y_46_im) + t_1)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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_1 = Float64(atan(x_46_im, x_46_re) * y_46_re) tmp = 0.0 if (x_46_im <= -5e-309) tmp = Float64(t_0 * sin(Float64(Float64(log((Float64(-1.0 / x_46_im) ^ -1.0)) * y_46_im) + t_1))); else tmp = Float64(t_0 * sin(Float64(Float64(log(x_46_im) * y_46_im) + t_1))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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_1 = atan2(x_46_im, x_46_re) * y_46_re; tmp = 0.0; if (x_46_im <= -5e-309) tmp = t_0 * sin(((log(((-1.0 / x_46_im) ^ -1.0)) * y_46_im) + t_1)); else tmp = t_0 * sin(((log(x_46_im) * y_46_im) + t_1)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = 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]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]}, If[LessEqual[x$46$im, -5e-309], N[(t$95$0 * N[Sin[N[(N[(N[Log[N[Power[N[(-1.0 / x$46$im), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Sin[N[(N[(N[Log[x$46$im], $MachinePrecision] * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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}\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
\mathbf{if}\;x.im \leq -5 \cdot 10^{-309}:\\
\;\;\;\;t\_0 \cdot \sin \left(\log \left({\left(\frac{-1}{x.im}\right)}^{-1}\right) \cdot y.im + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sin \left(\log x.im \cdot y.im + t\_1\right)\\
\end{array}
\end{array}
if x.im < -4.9999999999999995e-309Initial program 41.0%
Taylor expanded in x.im around -inf
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
lower-/.f6457.8
Applied rewrites57.8%
if -4.9999999999999995e-309 < x.im Initial program 41.1%
Taylor expanded in x.re around 0
Applied rewrites57.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im))))
(t_2 (sin (* y.re (atan2 x.im x.re)))))
(if (<= (* t_1 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re)))) INFINITY)
(*
t_1
(-
t_2
(*
(- y.im)
(*
(sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
(log (pow (fma x.im x.im (* x.re x.re)) 0.5))))))
(* t_1 t_2))))
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))));
double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_2 = sin((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if ((t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)))) <= ((double) INFINITY)) {
tmp = t_1 * (t_2 - (-y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5)))));
} else {
tmp = t_1 * t_2;
}
return tmp;
}
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)))) t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) t_2 = sin(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (Float64(t_1 * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) <= Inf) tmp = Float64(t_1 * Float64(t_2 - Float64(Float64(-y_46_im) * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5)))))); else tmp = Float64(t_1 * t_2); 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[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 * 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], Infinity], N[(t$95$1 * N[(t$95$2 - N[((-y$46$im) * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_2 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(t\_2 - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\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 80.0%
Taylor expanded in y.im around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites78.6%
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%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6442.5
Applied rewrites42.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= (* t_1 (sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re)))) INFINITY)
(*
t_1
(-
(sin (* y.re (atan2 x.im x.re)))
(*
(- y.im)
(*
(sin (fma y.re (atan2 x.im x.re) (/ PI 2.0)))
(log (pow (fma x.im x.im (* x.re x.re)) 0.5))))))
(* t_1 (* y.re (* (sin (* 0.5 PI)) (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_1 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((t_1 * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)))) <= ((double) INFINITY)) {
tmp = t_1 * (sin((y_46_re * atan2(x_46_im, x_46_re))) - (-y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(pow(fma(x_46_im, x_46_im, (x_46_re * x_46_re)), 0.5)))));
} else {
tmp = t_1 * (y_46_re * (sin((0.5 * ((double) M_PI))) * atan2(x_46_im, x_46_re)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_1 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (Float64(t_1 * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) <= Inf) tmp = Float64(t_1 * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) - Float64(Float64(-y_46_im) * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log((fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)) ^ 0.5)))))); else tmp = Float64(t_1 * Float64(y_46_re * Float64(sin(Float64(0.5 * pi)) * atan(x_46_im, x_46_re)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[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$1 = 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]}, If[LessEqual[N[(t$95$1 * 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], Infinity], N[(t$95$1 * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[((-y$46$im) * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[N[Power[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(y$46$re * N[(N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$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)\\
t_1 := e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;t\_1 \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log \left({\left(\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)\right)}^{0.5}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(y.re \cdot \left(\sin \left(0.5 \cdot \pi\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\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 80.0%
Taylor expanded in y.im around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites78.6%
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%
Taylor expanded in y.re around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites0.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-atan2.f6441.0
Applied rewrites41.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.re 7.5e-166)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(* y.re (* (sin (* 0.5 PI)) (atan2 x.im x.re))))
(*
(/ (exp (* y.re (log x.re))) (exp (* y.im (atan2 x.im x.re))))
(sin (fma y.im (log x.re) (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 7.5e-166) {
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))) * (y_46_re * (sin((0.5 * ((double) M_PI))) * atan2(x_46_im, x_46_re)));
} else {
tmp = (exp((y_46_re * log(x_46_re))) / exp((y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_re), (y_46_re * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_re <= 7.5e-166) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * Float64(y_46_re * Float64(sin(Float64(0.5 * pi)) * atan(x_46_im, x_46_re)))); else tmp = Float64(Float64(exp(Float64(y_46_re * log(x_46_re))) / exp(Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_re), Float64(y_46_re * atan(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$re, 7.5e-166], 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[(y$46$re * N[(N[Sin[N[(0.5 * Pi), $MachinePrecision]], $MachinePrecision] * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$re], $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 7.5 \cdot 10^{-166}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(y.re \cdot \left(\sin \left(0.5 \cdot \pi\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{y.re \cdot \log x.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.re, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\end{array}
\end{array}
if x.re < 7.49999999999999947e-166Initial program 42.5%
Taylor expanded in y.re around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
Applied rewrites16.2%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-PI.f64N/A
lift-atan2.f6455.8
Applied rewrites55.8%
if 7.49999999999999947e-166 < x.re Initial program 38.7%
Taylor expanded in x.im around 0
lower-*.f64N/A
exp-diffN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
Applied rewrites61.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (exp (* y.im (atan2 x.im x.re)))))
(if (<= x.re 8.2e-274)
(* (/ (exp (* y.re (log x.im))) t_1) (sin (fma y.im (log x.im) t_0)))
(* (/ (exp (* y.re (log x.re))) t_1) (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 t_1 = exp((y_46_im * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_re <= 8.2e-274) {
tmp = (exp((y_46_re * log(x_46_im))) / t_1) * sin(fma(y_46_im, log(x_46_im), t_0));
} else {
tmp = (exp((y_46_re * log(x_46_re))) / t_1) * 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)) t_1 = exp(Float64(y_46_im * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_re <= 8.2e-274) tmp = Float64(Float64(exp(Float64(y_46_re * log(x_46_im))) / t_1) * sin(fma(y_46_im, log(x_46_im), t_0))); else tmp = Float64(Float64(exp(Float64(y_46_re * log(x_46_re))) / t_1) * 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]}, Block[{t$95$1 = N[Exp[N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, 8.2e-274], N[(N[(N[Exp[N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $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}\\
t_1 := e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;x.re \leq 8.2 \cdot 10^{-274}:\\
\;\;\;\;\frac{e^{y.re \cdot \log x.im}}{t\_1} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{y.re \cdot \log x.re}}{t\_1} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.re, t\_0\right)\right)\\
\end{array}
\end{array}
if x.re < 8.19999999999999975e-274Initial program 42.5%
Taylor expanded in x.re around 0
lower-*.f64N/A
exp-diffN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
Applied rewrites30.3%
if 8.19999999999999975e-274 < x.re Initial program 39.5%
Taylor expanded in x.im around 0
lower-*.f64N/A
exp-diffN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
Applied rewrites59.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (/ (exp (* y.re (log x.im))) (exp (* y.im (atan2 x.im x.re)))) (sin (fma y.im (log x.im) (* 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 (exp((y_46_re * log(x_46_im))) / exp((y_46_im * atan2(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), (y_46_re * atan2(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(exp(Float64(y_46_re * log(x_46_im))) / exp(Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(fma(y_46_im, log(x_46_im), Float64(y_46_re * atan(x_46_im, x_46_re))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[Exp[N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{y.re \cdot \log x.im}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
\end{array}
Initial program 41.1%
Taylor expanded in x.re around 0
lower-*.f64N/A
exp-diffN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
Applied rewrites27.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (/ (exp (* y.re (log x.im))) (exp (* y.im (atan2 x.im x.re)))) (- (sin (* y.re (atan2 x.im x.re))) (* (- y.im) (* (sin (fma y.re (atan2 x.im x.re) (/ PI 2.0))) (log x.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (exp((y_46_re * log(x_46_im))) / exp((y_46_im * atan2(x_46_im, x_46_re)))) * (sin((y_46_re * atan2(x_46_im, x_46_re))) - (-y_46_im * (sin(fma(y_46_re, atan2(x_46_im, x_46_re), (((double) M_PI) / 2.0))) * log(x_46_im))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(exp(Float64(y_46_re * log(x_46_im))) / exp(Float64(y_46_im * atan(x_46_im, x_46_re)))) * Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) - Float64(Float64(-y_46_im) * Float64(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(pi / 2.0))) * log(x_46_im))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[Exp[N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[((-y$46$im) * N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(Pi / 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{y.re \cdot \log x.im}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \left(-y.im\right) \cdot \left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \frac{\pi}{2}\right)\right) \cdot \log x.im\right)\right)
\end{array}
Initial program 41.1%
Taylor expanded in x.re around 0
lower-*.f64N/A
exp-diffN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
Applied rewrites27.7%
Taylor expanded in y.im around 0
fp-cancel-sign-sub-invN/A
lower--.f64N/A
lower-sin.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-PI.f64N/A
lower-fma.f64N/A
lift-atan2.f64N/A
lift-log.f6427.4
Applied rewrites27.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (exp y.im) (atan2 x.im x.re))))
(*
(fma
y.re
(fma
y.re
(fma
0.16666666666666666
(/ (* y.re (pow (log x.im) 3.0)) t_0)
(* 0.5 (/ (pow (log x.im) 2.0) t_0)))
(/ (log x.im) t_0))
(pow t_0 -1.0))
(sin (fma y.im (log x.im) (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(exp(y_46_im), atan2(x_46_im, x_46_re));
return fma(y_46_re, fma(y_46_re, fma(0.16666666666666666, ((y_46_re * pow(log(x_46_im), 3.0)) / t_0), (0.5 * (pow(log(x_46_im), 2.0) / t_0))), (log(x_46_im) / t_0)), pow(t_0, -1.0)) * sin(fma(y_46_im, log(x_46_im), (y_46_re * atan2(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(y_46_im) ^ atan(x_46_im, x_46_re) return Float64(fma(y_46_re, fma(y_46_re, fma(0.16666666666666666, Float64(Float64(y_46_re * (log(x_46_im) ^ 3.0)) / t_0), Float64(0.5 * Float64((log(x_46_im) ^ 2.0) / t_0))), Float64(log(x_46_im) / t_0)), (t_0 ^ -1.0)) * sin(fma(y_46_im, log(x_46_im), Float64(y_46_re * atan(x_46_im, x_46_re))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]}, N[(N[(y$46$re * N[(y$46$re * N[(0.16666666666666666 * N[(N[(y$46$re * N[Power[N[Log[x$46$im], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[x$46$im], $MachinePrecision], 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x$46$im], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, -1.0], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(y$46$im * N[Log[x$46$im], $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\mathsf{fma}\left(y.re, \mathsf{fma}\left(y.re, \mathsf{fma}\left(0.16666666666666666, \frac{y.re \cdot {\log x.im}^{3}}{t\_0}, 0.5 \cdot \frac{{\log x.im}^{2}}{t\_0}\right), \frac{\log x.im}{t\_0}\right), {t\_0}^{-1}\right) \cdot \sin \left(\mathsf{fma}\left(y.im, \log x.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
\end{array}
\end{array}
Initial program 41.1%
Taylor expanded in x.re around 0
lower-*.f64N/A
exp-diffN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-fma.f64N/A
Applied rewrites27.7%
Taylor expanded in y.re around 0
rec-expN/A
lower-fma.f64N/A
Applied rewrites23.0%
herbie shell --seed 2025093
(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)))))