
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.re))
(t_1 (log (hypot x.re x.im)))
(t_2 (exp (- (* t_1 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re -9.6e-74)
(* t_2 (cos t_0))
(if (<= y.re 3.2e+22) (* t_2 (cos (+ (* t_1 y.im) t_0))) (* t_2 1.0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_re;
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = exp(((t_1 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -9.6e-74) {
tmp = t_2 * cos(t_0);
} else if (y_46_re <= 3.2e+22) {
tmp = t_2 * cos(((t_1 * y_46_im) + t_0));
} else {
tmp = t_2 * 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.atan2(x_46_im, x_46_re) * y_46_re;
double t_1 = Math.log(Math.hypot(x_46_re, x_46_im));
double t_2 = Math.exp(((t_1 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -9.6e-74) {
tmp = t_2 * Math.cos(t_0);
} else if (y_46_re <= 3.2e+22) {
tmp = t_2 * Math.cos(((t_1 * y_46_im) + t_0));
} else {
tmp = t_2 * 1.0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_re t_1 = math.log(math.hypot(x_46_re, x_46_im)) t_2 = math.exp(((t_1 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if y_46_re <= -9.6e-74: tmp = t_2 * math.cos(t_0) elif y_46_re <= 3.2e+22: tmp = t_2 * math.cos(((t_1 * y_46_im) + t_0)) else: tmp = t_2 * 1.0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_re) t_1 = log(hypot(x_46_re, x_46_im)) t_2 = exp(Float64(Float64(t_1 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= -9.6e-74) tmp = Float64(t_2 * cos(t_0)); elseif (y_46_re <= 3.2e+22) tmp = Float64(t_2 * cos(Float64(Float64(t_1 * y_46_im) + t_0))); else tmp = Float64(t_2 * 1.0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_re; t_1 = log(hypot(x_46_re, x_46_im)); t_2 = exp(((t_1 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (y_46_re <= -9.6e-74) tmp = t_2 * cos(t_0); elseif (y_46_re <= 3.2e+22) tmp = t_2 * cos(((t_1 * y_46_im) + t_0)); else tmp = t_2 * 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t$95$1 * 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, -9.6e-74], N[(t$95$2 * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3.2e+22], N[(t$95$2 * N[Cos[N[(N[(t$95$1 * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * 1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := e^{t\_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -9.6 \cdot 10^{-74}:\\
\;\;\;\;t\_2 \cdot \cos t\_0\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{+22}:\\
\;\;\;\;t\_2 \cdot \cos \left(t\_1 \cdot y.im + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot 1\\
\end{array}
\end{array}
if y.re < -9.5999999999999996e-74Initial program 41.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6441.3
Applied rewrites41.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6484.8
Applied rewrites84.8%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6484.9
Applied rewrites84.9%
if -9.5999999999999996e-74 < y.re < 3.2e22Initial program 40.9%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6440.9
Applied rewrites40.9%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6482.4
Applied rewrites82.4%
if 3.2e22 < y.re Initial program 36.7%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6436.7
Applied rewrites36.7%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6467.7
Applied rewrites67.7%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6468.2
Applied rewrites68.2%
Taylor expanded in y.re around 0
Applied rewrites76.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.im 2e-31) (* t_0 (cos (* (atan2 x.im x.re) y.re))) (* 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 = 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 (x_46_im <= 2e-31) {
tmp = t_0 * cos((atan2(x_46_im, x_46_re) * y_46_re));
} else {
tmp = t_0 * 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.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_im <= 2e-31) {
tmp = t_0 * Math.cos((Math.atan2(x_46_im, x_46_re) * y_46_re));
} else {
tmp = t_0 * 1.0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if x_46_im <= 2e-31: tmp = t_0 * math.cos((math.atan2(x_46_im, x_46_re) * y_46_re)) else: tmp = t_0 * 1.0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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 (x_46_im <= 2e-31) tmp = Float64(t_0 * cos(Float64(atan(x_46_im, x_46_re) * y_46_re))); else tmp = Float64(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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (x_46_im <= 2e-31) tmp = t_0 * cos((atan2(x_46_im, x_46_re) * y_46_re)); else tmp = 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[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[x$46$im, 2e-31], N[(t$95$0 * N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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}\;x.im \leq 2 \cdot 10^{-31}:\\
\;\;\;\;t\_0 \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot 1\\
\end{array}
\end{array}
if x.im < 2e-31Initial program 42.7%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6442.7
Applied rewrites42.7%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6479.3
Applied rewrites79.3%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6479.1
Applied rewrites79.1%
if 2e-31 < x.im Initial program 32.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6432.3
Applied rewrites32.3%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6480.4
Applied rewrites80.4%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6479.3
Applied rewrites79.3%
Taylor expanded in y.re around 0
Applied rewrites81.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.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) t_0))))
(if (<= (* t_3 (cos (+ (* t_2 y.im) t_1))) INFINITY)
(* t_3 (cos t_1))
(* (exp (- (* (log (hypot x.re x.im)) y.re) 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 = atan2(x_46_im, x_46_re) * y_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) - t_0));
double tmp;
if ((t_3 * cos(((t_2 * y_46_im) + t_1))) <= ((double) INFINITY)) {
tmp = t_3 * cos(t_1);
} else {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * 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.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 t_2 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = Math.exp(((t_2 * y_46_re) - t_0));
double tmp;
if ((t_3 * Math.cos(((t_2 * y_46_im) + t_1))) <= Double.POSITIVE_INFINITY) {
tmp = t_3 * Math.cos(t_1);
} else {
tmp = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * 1.0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.atan2(x_46_im, x_46_re) * y_46_re t_2 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) t_3 = math.exp(((t_2 * y_46_re) - t_0)) tmp = 0 if (t_3 * math.cos(((t_2 * y_46_im) + t_1))) <= math.inf: tmp = t_3 * math.cos(t_1) else: tmp = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * 1.0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_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) - t_0)) tmp = 0.0 if (Float64(t_3 * cos(Float64(Float64(t_2 * y_46_im) + t_1))) <= Inf) tmp = Float64(t_3 * cos(t_1)); else tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - 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 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = atan2(x_46_im, x_46_re) * y_46_re; t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); t_3 = exp(((t_2 * y_46_re) - t_0)); tmp = 0.0; if ((t_3 * cos(((t_2 * y_46_im) + t_1))) <= Inf) tmp = t_3 * cos(t_1); else tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $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] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(t$95$2 * y$46$im), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], 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] * 1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
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 - t\_0}\\
\mathbf{if}\;t\_3 \cdot \cos \left(t\_2 \cdot y.im + t\_1\right) \leq \infty:\\
\;\;\;\;t\_3 \cdot \cos t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t\_0} \cdot 1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 80.7%
Taylor expanded in y.re around inf
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6480.4
Applied rewrites80.4%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f640.0
Applied rewrites0.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6478.5
Applied rewrites78.5%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6477.9
Applied rewrites77.9%
Taylor expanded in y.re around 0
Applied rewrites80.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2 (exp (- (* t_1 y.re) t_0))))
(if (<=
(* t_2 (cos (+ (* t_1 y.im) (* (atan2 x.im x.re) y.re))))
0.9784376342958079)
(* t_2 (cos (* (log (sqrt (fma x.im x.im (* x.re x.re)))) y.im)))
(* (exp (- (* (log (hypot x.re x.im)) y.re) 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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = exp(((t_1 * y_46_re) - t_0));
double tmp;
if ((t_2 * cos(((t_1 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)))) <= 0.9784376342958079) {
tmp = t_2 * cos((log(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re)))) * y_46_im));
} else {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * 1.0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_2 = exp(Float64(Float64(t_1 * y_46_re) - t_0)) tmp = 0.0 if (Float64(t_2 * cos(Float64(Float64(t_1 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) <= 0.9784376342958079) tmp = Float64(t_2 * cos(Float64(log(sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re)))) * y_46_im))); else tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * 1.0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = 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$2 = N[Exp[N[(N[(t$95$1 * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 * N[Cos[N[(N[(t$95$1 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.9784376342958079], N[(t$95$2 * N[Cos[N[(N[Log[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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] * 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := e^{t\_1 \cdot y.re - t\_0}\\
\mathbf{if}\;t\_2 \cdot \cos \left(t\_1 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \leq 0.9784376342958079:\\
\;\;\;\;t\_2 \cdot \cos \left(\log \left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right) \cdot y.im\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t\_0} \cdot 1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < 0.97843763429580788Initial program 78.9%
Taylor expanded in y.re around 0
*-commutativeN/A
+-commutativeN/A
pow2N/A
pow2N/A
lower-sqrt.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-log.f64N/A
lift-*.f6481.9
Applied rewrites81.9%
if 0.97843763429580788 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 25.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6425.0
Applied rewrites25.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6479.9
Applied rewrites79.9%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6479.5
Applied rewrites79.5%
Taylor expanded in y.re around 0
Applied rewrites81.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.1e+43)
(*
(pow (sqrt (fma x.im x.im (* x.re x.re))) y.re)
(cos (* (atan2 x.im x.re) y.re)))
(*
(exp (- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))
1.0)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.1e+43) {
tmp = pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * cos((atan2(x_46_im, x_46_re) * y_46_re));
} else {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -1.1e+43) tmp = Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * cos(Float64(atan(x_46_im, x_46_re) * y_46_re))); else tmp = 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))) * 1.0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1.1e+43], N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.1 \cdot 10^{+43}:\\
\;\;\;\;{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{else}:\\
\;\;\;\;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 1\\
\end{array}
\end{array}
if y.re < -1.1e43Initial program 41.6%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.0%
if -1.1e43 < y.re Initial program 39.6%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6439.6
Applied rewrites39.6%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6477.9
Applied rewrites77.9%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6477.2
Applied rewrites77.2%
Taylor expanded in y.re around 0
Applied rewrites79.6%
(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))) 1.0))
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))) * 1.0;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * 1.0
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))) * 1.0) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * 1.0; 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] * 1.0), $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 1
\end{array}
Initial program 40.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6440.0
Applied rewrites40.0%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6479.6
Applied rewrites79.6%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6479.1
Applied rewrites79.1%
Taylor expanded in y.re around 0
Applied rewrites80.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.75)
(* (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re) 1.0)
(if (<= y.re 1.35)
(* (exp (* (- (atan2 x.im x.re)) y.im)) 1.0)
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.75) {
tmp = pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * 1.0;
} else if (y_46_re <= 1.35) {
tmp = exp((-atan2(x_46_im, x_46_re) * y_46_im)) * 1.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))) * 1.0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -1.75) tmp = Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * 1.0); elseif (y_46_re <= 1.35) tmp = Float64(exp(Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im)) * 1.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))) * 1.0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1.75], N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[y$46$re, 1.35], N[(N[Exp[N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]], $MachinePrecision] * 1.0), $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] * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.75:\\
\;\;\;\;{\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot 1\\
\mathbf{elif}\;y.re \leq 1.35:\\
\;\;\;\;e^{\left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im} \cdot 1\\
\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 1\\
\end{array}
\end{array}
if y.re < -1.75Initial program 41.2%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.4%
Taylor expanded in y.re around 0
Applied rewrites79.3%
if -1.75 < y.re < 1.3500000000000001Initial program 41.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6441.1
Applied rewrites41.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6482.5
Applied rewrites82.5%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6481.3
Applied rewrites81.3%
Taylor expanded in y.re around 0
Applied rewrites80.8%
Taylor expanded in y.re around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-atan2.f6479.8
Applied rewrites79.8%
if 1.3500000000000001 < y.re Initial program 36.7%
Taylor expanded in y.im around 0
Applied rewrites55.6%
Taylor expanded in y.re around 0
Applied rewrites72.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re) 1.0)))
(if (<= y.re -1.75)
t_0
(if (<= y.re 14.2) (* (exp (* (- (atan2 x.im x.re)) y.im)) 1.0) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * 1.0;
double tmp;
if (y_46_re <= -1.75) {
tmp = t_0;
} else if (y_46_re <= 14.2) {
tmp = exp((-atan2(x_46_im, x_46_re) * y_46_im)) * 1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * 1.0) tmp = 0.0 if (y_46_re <= -1.75) tmp = t_0; elseif (y_46_re <= 14.2) tmp = Float64(exp(Float64(Float64(-atan(x_46_im, x_46_re)) * y_46_im)) * 1.0); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[y$46$re, -1.75], t$95$0, If[LessEqual[y$46$re, 14.2], N[(N[Exp[N[((-N[ArcTan[x$46$im / x$46$re], $MachinePrecision]) * y$46$im), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot 1\\
\mathbf{if}\;y.re \leq -1.75:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 14.2:\\
\;\;\;\;e^{\left(-\tan^{-1}_* \frac{x.im}{x.re}\right) \cdot y.im} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.75 or 14.199999999999999 < y.re Initial program 38.9%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.7%
Taylor expanded in y.re around 0
Applied rewrites73.5%
if -1.75 < y.re < 14.199999999999999Initial program 41.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6441.1
Applied rewrites41.1%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lower-hypot.f6482.5
Applied rewrites82.5%
Taylor expanded in y.im around 0
lower-cos.f64N/A
*-commutativeN/A
lift-atan2.f64N/A
lift-*.f6481.3
Applied rewrites81.3%
Taylor expanded in y.re around 0
Applied rewrites80.8%
Taylor expanded in y.re around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-atan2.f6479.8
Applied rewrites79.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (* (pow (sqrt (fma x.im x.im (* x.re x.re))) y.re) 1.0))) (if (<= y.re -8.5e-33) t_0 (if (<= y.re 6e-18) 1.0 t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(sqrt(fma(x_46_im, x_46_im, (x_46_re * x_46_re))), y_46_re) * 1.0;
double tmp;
if (y_46_re <= -8.5e-33) {
tmp = t_0;
} else if (y_46_re <= 6e-18) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64((sqrt(fma(x_46_im, x_46_im, Float64(x_46_re * x_46_re))) ^ y_46_re) * 1.0) tmp = 0.0 if (y_46_re <= -8.5e-33) tmp = t_0; elseif (y_46_re <= 6e-18) tmp = 1.0; else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Power[N[Sqrt[N[(x$46$im * x$46$im + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[y$46$re, -8.5e-33], t$95$0, If[LessEqual[y$46$re, 6e-18], 1.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\sqrt{\mathsf{fma}\left(x.im, x.im, x.re \cdot x.re\right)}\right)}^{y.re} \cdot 1\\
\mathbf{if}\;y.re \leq -8.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 6 \cdot 10^{-18}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -8.49999999999999945e-33 or 5.99999999999999966e-18 < y.re Initial program 39.1%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites67.4%
Taylor expanded in y.re around 0
Applied rewrites70.7%
if -8.49999999999999945e-33 < y.re < 5.99999999999999966e-18Initial program 41.1%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.8%
Taylor expanded in y.re around 0
Applied rewrites50.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -1.95e-179) (* (pow (/ -1.0 x.im) (- y.re)) 1.0) (if (<= x.im 2.2e-247) (* (pow x.re y.re) 1.0) (* (pow x.im y.re) 1.0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -1.95e-179) {
tmp = pow((-1.0 / x_46_im), -y_46_re) * 1.0;
} else if (x_46_im <= 2.2e-247) {
tmp = pow(x_46_re, y_46_re) * 1.0;
} else {
tmp = pow(x_46_im, y_46_re) * 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) :: tmp
if (x_46im <= (-1.95d-179)) then
tmp = (((-1.0d0) / x_46im) ** -y_46re) * 1.0d0
else if (x_46im <= 2.2d-247) then
tmp = (x_46re ** y_46re) * 1.0d0
else
tmp = (x_46im ** y_46re) * 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 tmp;
if (x_46_im <= -1.95e-179) {
tmp = Math.pow((-1.0 / x_46_im), -y_46_re) * 1.0;
} else if (x_46_im <= 2.2e-247) {
tmp = Math.pow(x_46_re, y_46_re) * 1.0;
} else {
tmp = Math.pow(x_46_im, y_46_re) * 1.0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_im <= -1.95e-179: tmp = math.pow((-1.0 / x_46_im), -y_46_re) * 1.0 elif x_46_im <= 2.2e-247: tmp = math.pow(x_46_re, y_46_re) * 1.0 else: tmp = math.pow(x_46_im, y_46_re) * 1.0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= -1.95e-179) tmp = Float64((Float64(-1.0 / x_46_im) ^ Float64(-y_46_re)) * 1.0); elseif (x_46_im <= 2.2e-247) tmp = Float64((x_46_re ^ y_46_re) * 1.0); else tmp = Float64((x_46_im ^ y_46_re) * 1.0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= -1.95e-179) tmp = ((-1.0 / x_46_im) ^ -y_46_re) * 1.0; elseif (x_46_im <= 2.2e-247) tmp = (x_46_re ^ y_46_re) * 1.0; else tmp = (x_46_im ^ y_46_re) * 1.0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -1.95e-179], N[(N[Power[N[(-1.0 / x$46$im), $MachinePrecision], (-y$46$re)], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x$46$im, 2.2e-247], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.95 \cdot 10^{-179}:\\
\;\;\;\;{\left(\frac{-1}{x.im}\right)}^{\left(-y.re\right)} \cdot 1\\
\mathbf{elif}\;x.im \leq 2.2 \cdot 10^{-247}:\\
\;\;\;\;{x.re}^{y.re} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re} \cdot 1\\
\end{array}
\end{array}
if x.im < -1.9500000000000001e-179Initial program 40.1%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.9%
Taylor expanded in x.re around 0
lower-pow.f6427.0
Applied rewrites27.0%
Taylor expanded in y.re around 0
Applied rewrites28.7%
lift-pow.f64N/A
remove-double-divN/A
unpow-1N/A
pow-unpowN/A
mul-1-negN/A
lower-pow.f64N/A
remove-double-divN/A
inv-powN/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
metadata-evalN/A
pow-flipN/A
inv-powN/A
remove-double-divN/A
metadata-evalN/A
frac-2negN/A
lower-/.f64N/A
lower-neg.f6454.2
Applied rewrites54.2%
if -1.9500000000000001e-179 < x.im < 2.19999999999999992e-247Initial program 38.8%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites56.2%
Taylor expanded in x.re around 0
lower-pow.f6427.2
Applied rewrites27.2%
Taylor expanded in y.re around 0
Applied rewrites27.1%
Taylor expanded in x.re around inf
associate-*r*N/A
log-pow-revN/A
rem-exp-logN/A
pow-unpowN/A
unpow-1N/A
remove-double-divN/A
lower-pow.f6452.1
Applied rewrites52.1%
if 2.19999999999999992e-247 < x.im Initial program 40.4%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.2%
Taylor expanded in x.re around 0
lower-pow.f6451.4
Applied rewrites51.4%
Taylor expanded in y.re around 0
Applied rewrites53.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (pow x.im y.re) 1.0)))
(if (<= y.re -1.55e+99)
t_0
(if (<= y.re -57000000000.0)
(* (pow x.re y.re) 1.0)
(if (<= y.re 0.68) 1.0 t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(x_46_im, y_46_re) * 1.0;
double tmp;
if (y_46_re <= -1.55e+99) {
tmp = t_0;
} else if (y_46_re <= -57000000000.0) {
tmp = pow(x_46_re, y_46_re) * 1.0;
} else if (y_46_re <= 0.68) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46im ** y_46re) * 1.0d0
if (y_46re <= (-1.55d+99)) then
tmp = t_0
else if (y_46re <= (-57000000000.0d0)) then
tmp = (x_46re ** y_46re) * 1.0d0
else if (y_46re <= 0.68d0) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(x_46_im, y_46_re) * 1.0;
double tmp;
if (y_46_re <= -1.55e+99) {
tmp = t_0;
} else if (y_46_re <= -57000000000.0) {
tmp = Math.pow(x_46_re, y_46_re) * 1.0;
} else if (y_46_re <= 0.68) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(x_46_im, y_46_re) * 1.0 tmp = 0 if y_46_re <= -1.55e+99: tmp = t_0 elif y_46_re <= -57000000000.0: tmp = math.pow(x_46_re, y_46_re) * 1.0 elif y_46_re <= 0.68: tmp = 1.0 else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64((x_46_im ^ y_46_re) * 1.0) tmp = 0.0 if (y_46_re <= -1.55e+99) tmp = t_0; elseif (y_46_re <= -57000000000.0) tmp = Float64((x_46_re ^ y_46_re) * 1.0); elseif (y_46_re <= 0.68) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_im ^ y_46_re) * 1.0; tmp = 0.0; if (y_46_re <= -1.55e+99) tmp = t_0; elseif (y_46_re <= -57000000000.0) tmp = (x_46_re ^ y_46_re) * 1.0; elseif (y_46_re <= 0.68) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[y$46$re, -1.55e+99], t$95$0, If[LessEqual[y$46$re, -57000000000.0], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[y$46$re, 0.68], 1.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x.im}^{y.re} \cdot 1\\
\mathbf{if}\;y.re \leq -1.55 \cdot 10^{+99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq -57000000000:\\
\;\;\;\;{x.re}^{y.re} \cdot 1\\
\mathbf{elif}\;y.re \leq 0.68:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.55e99 or 0.680000000000000049 < y.re Initial program 38.7%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.9%
Taylor expanded in x.re around 0
lower-pow.f6450.9
Applied rewrites50.9%
Taylor expanded in y.re around 0
Applied rewrites53.8%
if -1.55e99 < y.re < -5.7e10Initial program 39.2%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.3%
Taylor expanded in x.re around 0
lower-pow.f6450.2
Applied rewrites50.2%
Taylor expanded in y.re around 0
Applied rewrites54.0%
Taylor expanded in x.re around inf
associate-*r*N/A
log-pow-revN/A
rem-exp-logN/A
pow-unpowN/A
unpow-1N/A
remove-double-divN/A
lower-pow.f6459.6
Applied rewrites59.6%
if -5.7e10 < y.re < 0.680000000000000049Initial program 41.3%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.2%
Taylor expanded in y.re around 0
Applied rewrites47.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (* (pow x.im y.re) 1.0))) (if (<= y.re -1e-19) t_0 (if (<= y.re 0.68) 1.0 t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(x_46_im, y_46_re) * 1.0;
double tmp;
if (y_46_re <= -1e-19) {
tmp = t_0;
} else if (y_46_re <= 0.68) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46im ** y_46re) * 1.0d0
if (y_46re <= (-1d-19)) then
tmp = t_0
else if (y_46re <= 0.68d0) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(x_46_im, y_46_re) * 1.0;
double tmp;
if (y_46_re <= -1e-19) {
tmp = t_0;
} else if (y_46_re <= 0.68) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(x_46_im, y_46_re) * 1.0 tmp = 0 if y_46_re <= -1e-19: tmp = t_0 elif y_46_re <= 0.68: tmp = 1.0 else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64((x_46_im ^ y_46_re) * 1.0) tmp = 0.0 if (y_46_re <= -1e-19) tmp = t_0; elseif (y_46_re <= 0.68) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_im ^ y_46_re) * 1.0; tmp = 0.0; if (y_46_re <= -1e-19) tmp = t_0; elseif (y_46_re <= 0.68) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[y$46$re, -1e-19], t$95$0, If[LessEqual[y$46$re, 0.68], 1.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x.im}^{y.re} \cdot 1\\
\mathbf{if}\;y.re \leq -1 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 0.68:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -9.9999999999999998e-20 or 0.680000000000000049 < y.re Initial program 39.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.9%
Taylor expanded in x.re around 0
lower-pow.f6449.8
Applied rewrites49.8%
Taylor expanded in y.re around 0
Applied rewrites52.4%
if -9.9999999999999998e-20 < y.re < 0.680000000000000049Initial program 41.1%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites33.9%
Taylor expanded in y.re around 0
Applied rewrites49.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 1.0)
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = 1.0d0
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0
function code(x_46_re, x_46_im, y_46_re, y_46_im) return 1.0 end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 40.0%
Taylor expanded in y.im around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.3%
Taylor expanded in y.re around 0
Applied rewrites25.2%
herbie shell --seed 2025130
(FPCore (x.re x.im y.re y.im)
:name "powComplex, real part"
:precision binary64
(* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))