
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 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)))
(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 (* y.im (log x.re)))
(t_1
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im))))
(t_2 (* y.re (atan2 x.im x.re))))
(if (<= x.re -1.2e-40)
(* t_1 (sin (+ (* (log (- x.re)) y.im) (* (atan2 x.im x.re) y.re))))
(if (<= x.re 1.22e-306)
(* t_1 (* y.im (log (sqrt (+ (* x.im x.im) (* x.re x.re))))))
(if (<= x.re 1.75e-55)
(* t_1 (sin t_2))
(if (<= x.re 4.9e+117)
(* t_1 t_0)
(*
(exp (- (* y.re (log x.re)) (* y.im (atan2 x.im x.re))))
(sin (+ t_0 t_2)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * log(x_46_re);
double t_1 = 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_2 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -1.2e-40) {
tmp = t_1 * sin(((log(-x_46_re) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
} else if (x_46_re <= 1.22e-306) {
tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.75e-55) {
tmp = t_1 * sin(t_2);
} else if (x_46_re <= 4.9e+117) {
tmp = t_1 * t_0;
} else {
tmp = exp(((y_46_re * log(x_46_re)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin((t_0 + t_2));
}
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) :: t_2
real(8) :: tmp
t_0 = y_46im * log(x_46re)
t_1 = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
t_2 = y_46re * atan2(x_46im, x_46re)
if (x_46re <= (-1.2d-40)) then
tmp = t_1 * sin(((log(-x_46re) * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
else if (x_46re <= 1.22d-306) then
tmp = t_1 * (y_46im * log(sqrt(((x_46im * x_46im) + (x_46re * x_46re)))))
else if (x_46re <= 1.75d-55) then
tmp = t_1 * sin(t_2)
else if (x_46re <= 4.9d+117) then
tmp = t_1 * t_0
else
tmp = exp(((y_46re * log(x_46re)) - (y_46im * atan2(x_46im, x_46re)))) * sin((t_0 + t_2))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.log(x_46_re);
double t_1 = 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_2 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -1.2e-40) {
tmp = t_1 * Math.sin(((Math.log(-x_46_re) * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
} else if (x_46_re <= 1.22e-306) {
tmp = t_1 * (y_46_im * Math.log(Math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.75e-55) {
tmp = t_1 * Math.sin(t_2);
} else if (x_46_re <= 4.9e+117) {
tmp = t_1 * t_0;
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - (y_46_im * Math.atan2(x_46_im, x_46_re)))) * Math.sin((t_0 + t_2));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.log(x_46_re) t_1 = 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_2 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -1.2e-40: tmp = t_1 * math.sin(((math.log(-x_46_re) * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re))) elif x_46_re <= 1.22e-306: tmp = t_1 * (y_46_im * math.log(math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))) elif x_46_re <= 1.75e-55: tmp = t_1 * math.sin(t_2) elif x_46_re <= 4.9e+117: tmp = t_1 * t_0 else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - (y_46_im * math.atan2(x_46_im, x_46_re)))) * math.sin((t_0 + t_2)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * log(x_46_re)) t_1 = 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_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -1.2e-40) tmp = Float64(t_1 * sin(Float64(Float64(log(Float64(-x_46_re)) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))); elseif (x_46_re <= 1.22e-306) tmp = Float64(t_1 * Float64(y_46_im * log(sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)))))); elseif (x_46_re <= 1.75e-55) tmp = Float64(t_1 * sin(t_2)); elseif (x_46_re <= 4.9e+117) tmp = Float64(t_1 * t_0); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(Float64(t_0 + t_2))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * log(x_46_re); t_1 = 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_2 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -1.2e-40) tmp = t_1 * sin(((log(-x_46_re) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); elseif (x_46_re <= 1.22e-306) tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))); elseif (x_46_re <= 1.75e-55) tmp = t_1 * sin(t_2); elseif (x_46_re <= 4.9e+117) tmp = t_1 * t_0; else tmp = exp(((y_46_re * log(x_46_re)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin((t_0 + t_2)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1.2e-40], N[(t$95$1 * N[Sin[N[(N[(N[Log[(-x$46$re)], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.22e-306], N[(t$95$1 * N[(y$46$im * N[Log[N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.75e-55], N[(t$95$1 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 4.9e+117], N[(t$95$1 * t$95$0), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$0 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \log x.re\\
t_1 := 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_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -1.2 \cdot 10^{-40}:\\
\;\;\;\;t\_1 \cdot \sin \left(\log \left(-x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{elif}\;x.re \leq 1.22 \cdot 10^{-306}:\\
\;\;\;\;t\_1 \cdot \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 1.75 \cdot 10^{-55}:\\
\;\;\;\;t\_1 \cdot \sin t\_2\\
\mathbf{elif}\;x.re \leq 4.9 \cdot 10^{+117}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(t\_0 + t\_2\right)\\
\end{array}
\end{array}
if x.re < -1.19999999999999996e-40Initial program 31.8%
Taylor expanded in x.re around -inf
lower-*.f6458.6
Applied rewrites58.6%
if -1.19999999999999996e-40 < x.re < 1.21999999999999995e-306Initial program 48.8%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites57.5%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6468.5
Applied rewrites68.5%
if 1.21999999999999995e-306 < x.re < 1.75000000000000013e-55Initial program 52.8%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6466.7
Applied rewrites66.7%
if 1.75000000000000013e-55 < x.re < 4.9000000000000001e117Initial program 59.8%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites67.1%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6464.7
Applied rewrites64.7%
Taylor expanded in x.re around inf
Applied rewrites82.2%
if 4.9000000000000001e117 < x.re Initial program 6.9%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6481.6
Applied rewrites81.6%
Final simplification70.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (sqrt (+ (* x.im x.im) (* x.re x.re))))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2
(*
(exp (- (* t_1 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_1 y.im) (* (atan2 x.im x.re) y.re))))))
(if (or (<= t_2 -1e-18)
(not
(or (<= t_2 -5e-289)
(not (or (<= t_2 0.0) (not (<= t_2 1e-20)))))))
(* (* y.re (atan2 x.im x.re)) (pow t_0 y.re))
(* 1.0 (sin (* y.im (log t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
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) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_1 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
double tmp;
if ((t_2 <= -1e-18) || !((t_2 <= -5e-289) || !((t_2 <= 0.0) || !(t_2 <= 1e-20)))) {
tmp = (y_46_re * atan2(x_46_im, x_46_re)) * pow(t_0, y_46_re);
} else {
tmp = 1.0 * sin((y_46_im * log(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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt(((x_46im * x_46im) + (x_46re * x_46re)))
t_1 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
t_2 = exp(((t_1 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_1 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
if ((t_2 <= (-1d-18)) .or. (.not. (t_2 <= (-5d-289)) .or. (.not. (t_2 <= 0.0d0) .or. (.not. (t_2 <= 1d-20))))) then
tmp = (y_46re * atan2(x_46im, x_46re)) * (t_0 ** y_46re)
else
tmp = 1.0d0 * sin((y_46im * log(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.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_1 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = Math.exp(((t_1 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.sin(((t_1 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
double tmp;
if ((t_2 <= -1e-18) || !((t_2 <= -5e-289) || !((t_2 <= 0.0) || !(t_2 <= 1e-20)))) {
tmp = (y_46_re * Math.atan2(x_46_im, x_46_re)) * Math.pow(t_0, y_46_re);
} else {
tmp = 1.0 * Math.sin((y_46_im * Math.log(t_0)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))) t_1 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) t_2 = math.exp(((t_1 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.sin(((t_1 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re))) tmp = 0 if (t_2 <= -1e-18) or not ((t_2 <= -5e-289) or not ((t_2 <= 0.0) or not (t_2 <= 1e-20))): tmp = (y_46_re * math.atan2(x_46_im, x_46_re)) * math.pow(t_0, y_46_re) else: tmp = 1.0 * math.sin((y_46_im * math.log(t_0))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re))) t_1 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_2 = Float64(exp(Float64(Float64(t_1 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * sin(Float64(Float64(t_1 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) tmp = 0.0 if ((t_2 <= -1e-18) || !((t_2 <= -5e-289) || !((t_2 <= 0.0) || !(t_2 <= 1e-20)))) tmp = Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) * (t_0 ^ y_46_re)); else tmp = Float64(1.0 * sin(Float64(y_46_im * log(t_0)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))); t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); t_2 = exp(((t_1 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * sin(((t_1 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); tmp = 0.0; if ((t_2 <= -1e-18) || ~(((t_2 <= -5e-289) || ~(((t_2 <= 0.0) || ~((t_2 <= 1e-20))))))) tmp = (y_46_re * atan2(x_46_im, x_46_re)) * (t_0 ^ y_46_re); else tmp = 1.0 * sin((y_46_im * log(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[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $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[(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] * N[Sin[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]}, If[Or[LessEqual[t$95$2, -1e-18], N[Not[Or[LessEqual[t$95$2, -5e-289], N[Not[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, 1e-20]], $MachinePrecision]]], $MachinePrecision]]], $MachinePrecision]], N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] * N[Power[t$95$0, y$46$re], $MachinePrecision]), $MachinePrecision], N[(1.0 * N[Sin[N[(y$46$im * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x.im \cdot x.im + x.re \cdot x.re}\\
t_1 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := e^{t\_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(t\_1 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-18} \lor \neg \left(t\_2 \leq -5 \cdot 10^{-289} \lor \neg \left(t\_2 \leq 0 \lor \neg \left(t\_2 \leq 10^{-20}\right)\right)\right):\\
\;\;\;\;\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {t\_0}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \sin \left(y.im \cdot \log t\_0\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)))) < -1.0000000000000001e-18 or -5.00000000000000029e-289 < (*.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)))) < 0.0 or 9.99999999999999945e-21 < (*.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 31.9%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6448.5
Applied rewrites48.5%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6446.6
Applied rewrites46.6%
if -1.0000000000000001e-18 < (*.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)))) < -5.00000000000000029e-289 or 0.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)))) < 9.99999999999999945e-21Initial program 99.7%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6415.9
Applied rewrites15.9%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6415.9
Applied rewrites15.9%
Taylor expanded in y.im around 0
Applied rewrites15.9%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-log.f6484.1
Applied rewrites84.1%
Final simplification50.7%
(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)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
(if (or (<= t_1 -1e-18)
(not
(or (<= t_1 -5e-289) (not (or (<= t_1 0.0) (not (<= t_1 1.0)))))))
(* (* y.re (atan2 x.im x.re)) (pow (sqrt (* x.re x.re)) y.re))
(* 1.0 (sin (* y.im (log (sqrt (+ (* x.im x.im) (* x.re 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))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
double tmp;
if ((t_1 <= -1e-18) || !((t_1 <= -5e-289) || !((t_1 <= 0.0) || !(t_1 <= 1.0)))) {
tmp = (y_46_re * atan2(x_46_im, x_46_re)) * pow(sqrt((x_46_re * x_46_re)), y_46_re);
} else {
tmp = 1.0 * sin((y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
t_1 = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
if ((t_1 <= (-1d-18)) .or. (.not. (t_1 <= (-5d-289)) .or. (.not. (t_1 <= 0.0d0) .or. (.not. (t_1 <= 1.0d0))))) then
tmp = (y_46re * atan2(x_46im, x_46re)) * (sqrt((x_46re * x_46re)) ** y_46re)
else
tmp = 1.0d0 * sin((y_46im * log(sqrt(((x_46im * x_46im) + (x_46re * x_46re))))))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 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))) * Math.sin(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
double tmp;
if ((t_1 <= -1e-18) || !((t_1 <= -5e-289) || !((t_1 <= 0.0) || !(t_1 <= 1.0)))) {
tmp = (y_46_re * Math.atan2(x_46_im, x_46_re)) * Math.pow(Math.sqrt((x_46_re * x_46_re)), y_46_re);
} else {
tmp = 1.0 * Math.sin((y_46_im * Math.log(Math.sqrt(((x_46_im * x_46_im) + (x_46_re * 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))) * math.sin(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re))) tmp = 0 if (t_1 <= -1e-18) or not ((t_1 <= -5e-289) or not ((t_1 <= 0.0) or not (t_1 <= 1.0))): tmp = (y_46_re * math.atan2(x_46_im, x_46_re)) * math.pow(math.sqrt((x_46_re * x_46_re)), y_46_re) else: tmp = 1.0 * math.sin((y_46_im * math.log(math.sqrt(((x_46_im * x_46_im) + (x_46_re * 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 = 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)))) tmp = 0.0 if ((t_1 <= -1e-18) || !((t_1 <= -5e-289) || !((t_1 <= 0.0) || !(t_1 <= 1.0)))) tmp = Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) * (sqrt(Float64(x_46_re * x_46_re)) ^ y_46_re)); else tmp = Float64(1.0 * sin(Float64(y_46_im * log(sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * 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))) * sin(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); tmp = 0.0; if ((t_1 <= -1e-18) || ~(((t_1 <= -5e-289) || ~(((t_1 <= 0.0) || ~((t_1 <= 1.0))))))) tmp = (y_46_re * atan2(x_46_im, x_46_re)) * (sqrt((x_46_re * x_46_re)) ^ y_46_re); else tmp = 1.0 * sin((y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * 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[(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]}, If[Or[LessEqual[t$95$1, -1e-18], N[Not[Or[LessEqual[t$95$1, -5e-289], N[Not[Or[LessEqual[t$95$1, 0.0], N[Not[LessEqual[t$95$1, 1.0]], $MachinePrecision]]], $MachinePrecision]]], $MachinePrecision]], N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] * N[Power[N[Sqrt[N[(x$46$re * x$46$re), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(1.0 * N[Sin[N[(y$46$im * N[Log[N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $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} \cdot \sin \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-18} \lor \neg \left(t\_1 \leq -5 \cdot 10^{-289} \lor \neg \left(t\_1 \leq 0 \lor \neg \left(t\_1 \leq 1\right)\right)\right):\\
\;\;\;\;\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{x.re \cdot x.re}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \sin \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot 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)))) < -1.0000000000000001e-18 or -5.00000000000000029e-289 < (*.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)))) < 0.0 or 1 < (*.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 31.7%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6448.7
Applied rewrites48.7%
Taylor expanded in x.re around inf
pow2N/A
lift-*.f6438.0
Applied rewrites38.0%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6437.6
Applied rewrites37.6%
if -1.0000000000000001e-18 < (*.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)))) < -5.00000000000000029e-289 or 0.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)))) < 1Initial program 94.4%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6417.7
Applied rewrites17.7%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6415.6
Applied rewrites15.6%
Taylor expanded in y.im around 0
Applied rewrites15.6%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f64N/A
lift-log.f6477.3
Applied rewrites77.3%
Final simplification42.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 (sqrt (+ (* x.im x.im) (* x.re x.re))))
(t_2 (pow t_1 y.re)))
(if (<=
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(sin (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))
1e-20)
(* t_2 (* y.im (log t_1)))
(* (sin (* y.re (atan2 x.im x.re))) 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 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_2 = pow(t_1, y_46_re);
double tmp;
if ((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)))) <= 1e-20) {
tmp = t_2 * (y_46_im * log(t_1));
} else {
tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
t_1 = sqrt(((x_46im * x_46im) + (x_46re * x_46re)))
t_2 = t_1 ** y_46re
if ((exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * sin(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))) <= 1d-20) then
tmp = t_2 * (y_46im * log(t_1))
else
tmp = sin((y_46re * atan2(x_46im, x_46re))) * t_2
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.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_1 = Math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_2 = Math.pow(t_1, y_46_re);
double tmp;
if ((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)))) <= 1e-20) {
tmp = t_2 * (y_46_im * Math.log(t_1));
} else {
tmp = Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re))) * t_2;
}
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.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))) t_2 = math.pow(t_1, y_46_re) tmp = 0 if (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)))) <= 1e-20: tmp = t_2 * (y_46_im * math.log(t_1)) else: tmp = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) * 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 = sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re))) t_2 = t_1 ^ y_46_re tmp = 0.0 if (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)))) <= 1e-20) tmp = Float64(t_2 * Float64(y_46_im * log(t_1))); else tmp = Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) * t_2); 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 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))); t_2 = t_1 ^ y_46_re; tmp = 0.0; if ((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)))) <= 1e-20) tmp = t_2 * (y_46_im * log(t_1)); else tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * t_2; 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[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, y$46$re], $MachinePrecision]}, If[LessEqual[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], 1e-20], N[(t$95$2 * N[(y$46$im * N[Log[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 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 := \sqrt{x.im \cdot x.im + x.re \cdot x.re}\\
t_2 := {t\_1}^{y.re}\\
\mathbf{if}\;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) \leq 10^{-20}:\\
\;\;\;\;t\_2 \cdot \left(y.im \cdot \log t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \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)))) < 9.99999999999999945e-21Initial program 90.5%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites90.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6487.2
Applied rewrites87.2%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6466.3
Applied rewrites66.3%
if 9.99999999999999945e-21 < (*.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 10.0%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6445.2
Applied rewrites45.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im))))
(t_2 (* y.im (log x.re)))
(t_3 (sin t_0)))
(if (<= x.re -2.1e+110)
(* (exp (* (- y.im) (atan2 x.im x.re))) t_3)
(if (<= x.re 1.22e-306)
(* t_1 (* y.im (log (sqrt (+ (* x.im x.im) (* x.re x.re))))))
(if (<= x.re 1.75e-55)
(* t_1 t_3)
(if (<= x.re 4.9e+117)
(* t_1 t_2)
(*
(exp (- (* y.re (log x.re)) (* y.im (atan2 x.im x.re))))
(sin (+ t_2 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(((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_2 = y_46_im * log(x_46_re);
double t_3 = sin(t_0);
double tmp;
if (x_46_re <= -2.1e+110) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_3;
} else if (x_46_re <= 1.22e-306) {
tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.75e-55) {
tmp = t_1 * t_3;
} else if (x_46_re <= 4.9e+117) {
tmp = t_1 * t_2;
} else {
tmp = exp(((y_46_re * log(x_46_re)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin((t_2 + 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
t_2 = y_46im * log(x_46re)
t_3 = sin(t_0)
if (x_46re <= (-2.1d+110)) then
tmp = exp((-y_46im * atan2(x_46im, x_46re))) * t_3
else if (x_46re <= 1.22d-306) then
tmp = t_1 * (y_46im * log(sqrt(((x_46im * x_46im) + (x_46re * x_46re)))))
else if (x_46re <= 1.75d-55) then
tmp = t_1 * t_3
else if (x_46re <= 4.9d+117) then
tmp = t_1 * t_2
else
tmp = exp(((y_46re * log(x_46re)) - (y_46im * atan2(x_46im, x_46re)))) * sin((t_2 + t_0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = 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_2 = y_46_im * Math.log(x_46_re);
double t_3 = Math.sin(t_0);
double tmp;
if (x_46_re <= -2.1e+110) {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * t_3;
} else if (x_46_re <= 1.22e-306) {
tmp = t_1 * (y_46_im * Math.log(Math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.75e-55) {
tmp = t_1 * t_3;
} else if (x_46_re <= 4.9e+117) {
tmp = t_1 * t_2;
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - (y_46_im * Math.atan2(x_46_im, x_46_re)))) * Math.sin((t_2 + t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = 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_2 = y_46_im * math.log(x_46_re) t_3 = math.sin(t_0) tmp = 0 if x_46_re <= -2.1e+110: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * t_3 elif x_46_re <= 1.22e-306: tmp = t_1 * (y_46_im * math.log(math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))) elif x_46_re <= 1.75e-55: tmp = t_1 * t_3 elif x_46_re <= 4.9e+117: tmp = t_1 * t_2 else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - (y_46_im * math.atan2(x_46_im, x_46_re)))) * math.sin((t_2 + 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(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_2 = Float64(y_46_im * log(x_46_re)) t_3 = sin(t_0) tmp = 0.0 if (x_46_re <= -2.1e+110) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * t_3); elseif (x_46_re <= 1.22e-306) tmp = Float64(t_1 * Float64(y_46_im * log(sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)))))); elseif (x_46_re <= 1.75e-55) tmp = Float64(t_1 * t_3); elseif (x_46_re <= 4.9e+117) tmp = Float64(t_1 * t_2); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * sin(Float64(t_2 + t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = 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_2 = y_46_im * log(x_46_re); t_3 = sin(t_0); tmp = 0.0; if (x_46_re <= -2.1e+110) tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_3; elseif (x_46_re <= 1.22e-306) tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))); elseif (x_46_re <= 1.75e-55) tmp = t_1 * t_3; elseif (x_46_re <= 4.9e+117) tmp = t_1 * t_2; else tmp = exp(((y_46_re * log(x_46_re)) - (y_46_im * atan2(x_46_im, x_46_re)))) * sin((t_2 + t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$2 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[x$46$re, -2.1e+110], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[x$46$re, 1.22e-306], N[(t$95$1 * N[(y$46$im * N[Log[N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.75e-55], N[(t$95$1 * t$95$3), $MachinePrecision], If[LessEqual[x$46$re, 4.9e+117], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(t$95$2 + 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^{\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_2 := y.im \cdot \log x.re\\
t_3 := \sin t\_0\\
\mathbf{if}\;x.re \leq -2.1 \cdot 10^{+110}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_3\\
\mathbf{elif}\;x.re \leq 1.22 \cdot 10^{-306}:\\
\;\;\;\;t\_1 \cdot \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 1.75 \cdot 10^{-55}:\\
\;\;\;\;t\_1 \cdot t\_3\\
\mathbf{elif}\;x.re \leq 4.9 \cdot 10^{+117}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(t\_2 + t\_0\right)\\
\end{array}
\end{array}
if x.re < -2.10000000000000015e110Initial program 13.5%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6447.1
Applied rewrites47.1%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6455.0
Applied rewrites55.0%
if -2.10000000000000015e110 < x.re < 1.21999999999999995e-306Initial program 50.5%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites55.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6465.4
Applied rewrites65.4%
if 1.21999999999999995e-306 < x.re < 1.75000000000000013e-55Initial program 52.8%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6466.7
Applied rewrites66.7%
if 1.75000000000000013e-55 < x.re < 4.9000000000000001e117Initial program 59.8%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites67.1%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6464.7
Applied rewrites64.7%
Taylor expanded in x.re around inf
Applied rewrites82.2%
if 4.9000000000000001e117 < x.re Initial program 6.9%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lift-atan2.f6481.6
Applied rewrites81.6%
Final simplification69.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
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im))))
(t_2 (* y.im (log x.re)))
(t_3 (sin t_0)))
(if (<= x.re -2.1e+110)
(* (exp (* (- y.im) (atan2 x.im x.re))) t_3)
(if (<= x.re 1.22e-306)
(* t_1 (* y.im (log (sqrt (+ (* x.im x.im) (* x.re x.re))))))
(if (<= x.re 1.75e-55)
(* t_1 t_3)
(if (<= x.re 1.1e+104)
(* t_1 t_2)
(* (pow x.re y.re) (sin (+ t_2 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(((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_2 = y_46_im * log(x_46_re);
double t_3 = sin(t_0);
double tmp;
if (x_46_re <= -2.1e+110) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_3;
} else if (x_46_re <= 1.22e-306) {
tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.75e-55) {
tmp = t_1 * t_3;
} else if (x_46_re <= 1.1e+104) {
tmp = t_1 * t_2;
} else {
tmp = pow(x_46_re, y_46_re) * sin((t_2 + 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
t_2 = y_46im * log(x_46re)
t_3 = sin(t_0)
if (x_46re <= (-2.1d+110)) then
tmp = exp((-y_46im * atan2(x_46im, x_46re))) * t_3
else if (x_46re <= 1.22d-306) then
tmp = t_1 * (y_46im * log(sqrt(((x_46im * x_46im) + (x_46re * x_46re)))))
else if (x_46re <= 1.75d-55) then
tmp = t_1 * t_3
else if (x_46re <= 1.1d+104) then
tmp = t_1 * t_2
else
tmp = (x_46re ** y_46re) * sin((t_2 + t_0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = 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_2 = y_46_im * Math.log(x_46_re);
double t_3 = Math.sin(t_0);
double tmp;
if (x_46_re <= -2.1e+110) {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * t_3;
} else if (x_46_re <= 1.22e-306) {
tmp = t_1 * (y_46_im * Math.log(Math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.75e-55) {
tmp = t_1 * t_3;
} else if (x_46_re <= 1.1e+104) {
tmp = t_1 * t_2;
} else {
tmp = Math.pow(x_46_re, y_46_re) * Math.sin((t_2 + t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = 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_2 = y_46_im * math.log(x_46_re) t_3 = math.sin(t_0) tmp = 0 if x_46_re <= -2.1e+110: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * t_3 elif x_46_re <= 1.22e-306: tmp = t_1 * (y_46_im * math.log(math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))) elif x_46_re <= 1.75e-55: tmp = t_1 * t_3 elif x_46_re <= 1.1e+104: tmp = t_1 * t_2 else: tmp = math.pow(x_46_re, y_46_re) * math.sin((t_2 + 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(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_2 = Float64(y_46_im * log(x_46_re)) t_3 = sin(t_0) tmp = 0.0 if (x_46_re <= -2.1e+110) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * t_3); elseif (x_46_re <= 1.22e-306) tmp = Float64(t_1 * Float64(y_46_im * log(sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)))))); elseif (x_46_re <= 1.75e-55) tmp = Float64(t_1 * t_3); elseif (x_46_re <= 1.1e+104) tmp = Float64(t_1 * t_2); else tmp = Float64((x_46_re ^ y_46_re) * sin(Float64(t_2 + t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = 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_2 = y_46_im * log(x_46_re); t_3 = sin(t_0); tmp = 0.0; if (x_46_re <= -2.1e+110) tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_3; elseif (x_46_re <= 1.22e-306) tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))); elseif (x_46_re <= 1.75e-55) tmp = t_1 * t_3; elseif (x_46_re <= 1.1e+104) tmp = t_1 * t_2; else tmp = (x_46_re ^ y_46_re) * sin((t_2 + t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$2 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sin[t$95$0], $MachinePrecision]}, If[LessEqual[x$46$re, -2.1e+110], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[x$46$re, 1.22e-306], N[(t$95$1 * N[(y$46$im * N[Log[N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.75e-55], N[(t$95$1 * t$95$3), $MachinePrecision], If[LessEqual[x$46$re, 1.1e+104], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[Sin[N[(t$95$2 + 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^{\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_2 := y.im \cdot \log x.re\\
t_3 := \sin t\_0\\
\mathbf{if}\;x.re \leq -2.1 \cdot 10^{+110}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_3\\
\mathbf{elif}\;x.re \leq 1.22 \cdot 10^{-306}:\\
\;\;\;\;t\_1 \cdot \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 1.75 \cdot 10^{-55}:\\
\;\;\;\;t\_1 \cdot t\_3\\
\mathbf{elif}\;x.re \leq 1.1 \cdot 10^{+104}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot \sin \left(t\_2 + t\_0\right)\\
\end{array}
\end{array}
if x.re < -2.10000000000000015e110Initial program 13.5%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6447.1
Applied rewrites47.1%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6455.0
Applied rewrites55.0%
if -2.10000000000000015e110 < x.re < 1.21999999999999995e-306Initial program 50.5%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites55.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6465.4
Applied rewrites65.4%
if 1.21999999999999995e-306 < x.re < 1.75000000000000013e-55Initial program 52.8%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6466.7
Applied rewrites66.7%
if 1.75000000000000013e-55 < x.re < 1.1e104Initial program 60.3%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites68.0%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6465.4
Applied rewrites65.4%
Taylor expanded in x.re around inf
Applied rewrites83.8%
if 1.1e104 < x.re Initial program 8.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
flip3-+N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
sqr-powN/A
lower-+.f64N/A
lower-pow.f64N/A
Applied rewrites0.0%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites80.3%
Taylor expanded in y.im around 0
lower-pow.f6472.2
Applied rewrites72.2%
Final simplification68.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im))))
(t_2 (* y.im (log x.re))))
(if (<= x.re -2.1e+110)
(* (exp (* (- y.im) (atan2 x.im x.re))) (sin t_0))
(if (<= x.re 2.3e-125)
(* t_1 (* y.im (log (sqrt (+ (* x.im x.im) (* x.re x.re))))))
(if (<= x.re 1.1e+104)
(* t_1 t_2)
(* (pow x.re y.re) (sin (+ t_2 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(((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_2 = y_46_im * log(x_46_re);
double tmp;
if (x_46_re <= -2.1e+110) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin(t_0);
} else if (x_46_re <= 2.3e-125) {
tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.1e+104) {
tmp = t_1 * t_2;
} else {
tmp = pow(x_46_re, y_46_re) * sin((t_2 + 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = exp(((log(sqrt(((x_46re * x_46re) + (x_46im * x_46im)))) * y_46re) - (atan2(x_46im, x_46re) * y_46im)))
t_2 = y_46im * log(x_46re)
if (x_46re <= (-2.1d+110)) then
tmp = exp((-y_46im * atan2(x_46im, x_46re))) * sin(t_0)
else if (x_46re <= 2.3d-125) then
tmp = t_1 * (y_46im * log(sqrt(((x_46im * x_46im) + (x_46re * x_46re)))))
else if (x_46re <= 1.1d+104) then
tmp = t_1 * t_2
else
tmp = (x_46re ** y_46re) * sin((t_2 + t_0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = 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_2 = y_46_im * Math.log(x_46_re);
double tmp;
if (x_46_re <= -2.1e+110) {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * Math.sin(t_0);
} else if (x_46_re <= 2.3e-125) {
tmp = t_1 * (y_46_im * Math.log(Math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)))));
} else if (x_46_re <= 1.1e+104) {
tmp = t_1 * t_2;
} else {
tmp = Math.pow(x_46_re, y_46_re) * Math.sin((t_2 + t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = 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_2 = y_46_im * math.log(x_46_re) tmp = 0 if x_46_re <= -2.1e+110: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * math.sin(t_0) elif x_46_re <= 2.3e-125: tmp = t_1 * (y_46_im * math.log(math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))) elif x_46_re <= 1.1e+104: tmp = t_1 * t_2 else: tmp = math.pow(x_46_re, y_46_re) * math.sin((t_2 + 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(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_2 = Float64(y_46_im * log(x_46_re)) tmp = 0.0 if (x_46_re <= -2.1e+110) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * sin(t_0)); elseif (x_46_re <= 2.3e-125) tmp = Float64(t_1 * Float64(y_46_im * log(sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re)))))); elseif (x_46_re <= 1.1e+104) tmp = Float64(t_1 * t_2); else tmp = Float64((x_46_re ^ y_46_re) * sin(Float64(t_2 + t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = 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_2 = y_46_im * log(x_46_re); tmp = 0.0; if (x_46_re <= -2.1e+110) tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * sin(t_0); elseif (x_46_re <= 2.3e-125) tmp = t_1 * (y_46_im * log(sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))))); elseif (x_46_re <= 1.1e+104) tmp = t_1 * t_2; else tmp = (x_46_re ^ y_46_re) * sin((t_2 + t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$2 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -2.1e+110], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2.3e-125], N[(t$95$1 * N[(y$46$im * N[Log[N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.1e+104], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[Power[x$46$re, y$46$re], $MachinePrecision] * N[Sin[N[(t$95$2 + 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^{\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_2 := y.im \cdot \log x.re\\
\mathbf{if}\;x.re \leq -2.1 \cdot 10^{+110}:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin t\_0\\
\mathbf{elif}\;x.re \leq 2.3 \cdot 10^{-125}:\\
\;\;\;\;t\_1 \cdot \left(y.im \cdot \log \left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 1.1 \cdot 10^{+104}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re} \cdot \sin \left(t\_2 + t\_0\right)\\
\end{array}
\end{array}
if x.re < -2.10000000000000015e110Initial program 13.5%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6447.1
Applied rewrites47.1%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6455.0
Applied rewrites55.0%
if -2.10000000000000015e110 < x.re < 2.2999999999999999e-125Initial program 52.0%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites54.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6459.5
Applied rewrites59.5%
if 2.2999999999999999e-125 < x.re < 1.1e104Initial program 56.7%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites60.6%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6462.5
Applied rewrites62.5%
Taylor expanded in x.re around inf
Applied rewrites82.1%
if 1.1e104 < x.re Initial program 8.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
flip3-+N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
metadata-evalN/A
metadata-evalN/A
sqr-powN/A
lower-+.f64N/A
lower-pow.f64N/A
Applied rewrites0.0%
Taylor expanded in x.im around 0
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lift-atan2.f64N/A
lift-*.f64N/A
lower-sin.f64N/A
lower-+.f64N/A
Applied rewrites80.3%
Taylor expanded in y.im around 0
lower-pow.f6472.2
Applied rewrites72.2%
Final simplification65.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (exp (* (- y.im) (atan2 x.im x.re))))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (sqrt (+ (* x.im x.im) (* x.re x.re))))
(t_3 (pow t_2 y.re))
(t_4 (* y.im (log t_2))))
(if (<= y.re -31000000000.0)
(* t_1 t_3)
(if (<= y.re -1.7e-222)
(* t_0 (sin t_1))
(if (<= y.re 3e-9) (* t_0 t_4) (* t_3 t_4))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = exp((-y_46_im * atan2(x_46_im, x_46_re)));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_3 = pow(t_2, y_46_re);
double t_4 = y_46_im * log(t_2);
double tmp;
if (y_46_re <= -31000000000.0) {
tmp = t_1 * t_3;
} else if (y_46_re <= -1.7e-222) {
tmp = t_0 * sin(t_1);
} else if (y_46_re <= 3e-9) {
tmp = t_0 * t_4;
} else {
tmp = t_3 * t_4;
}
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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = exp((-y_46im * atan2(x_46im, x_46re)))
t_1 = y_46re * atan2(x_46im, x_46re)
t_2 = sqrt(((x_46im * x_46im) + (x_46re * x_46re)))
t_3 = t_2 ** y_46re
t_4 = y_46im * log(t_2)
if (y_46re <= (-31000000000.0d0)) then
tmp = t_1 * t_3
else if (y_46re <= (-1.7d-222)) then
tmp = t_0 * sin(t_1)
else if (y_46re <= 3d-9) then
tmp = t_0 * t_4
else
tmp = t_3 * t_4
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((-y_46_im * Math.atan2(x_46_im, x_46_re)));
double t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_2 = Math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_3 = Math.pow(t_2, y_46_re);
double t_4 = y_46_im * Math.log(t_2);
double tmp;
if (y_46_re <= -31000000000.0) {
tmp = t_1 * t_3;
} else if (y_46_re <= -1.7e-222) {
tmp = t_0 * Math.sin(t_1);
} else if (y_46_re <= 3e-9) {
tmp = t_0 * t_4;
} else {
tmp = t_3 * t_4;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) t_1 = y_46_re * math.atan2(x_46_im, x_46_re) t_2 = math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))) t_3 = math.pow(t_2, y_46_re) t_4 = y_46_im * math.log(t_2) tmp = 0 if y_46_re <= -31000000000.0: tmp = t_1 * t_3 elif y_46_re <= -1.7e-222: tmp = t_0 * math.sin(t_1) elif y_46_re <= 3e-9: tmp = t_0 * t_4 else: tmp = t_3 * t_4 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re))) t_3 = t_2 ^ y_46_re t_4 = Float64(y_46_im * log(t_2)) tmp = 0.0 if (y_46_re <= -31000000000.0) tmp = Float64(t_1 * t_3); elseif (y_46_re <= -1.7e-222) tmp = Float64(t_0 * sin(t_1)); elseif (y_46_re <= 3e-9) tmp = Float64(t_0 * t_4); else tmp = Float64(t_3 * t_4); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp((-y_46_im * atan2(x_46_im, x_46_re))); t_1 = y_46_re * atan2(x_46_im, x_46_re); t_2 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))); t_3 = t_2 ^ y_46_re; t_4 = y_46_im * log(t_2); tmp = 0.0; if (y_46_re <= -31000000000.0) tmp = t_1 * t_3; elseif (y_46_re <= -1.7e-222) tmp = t_0 * sin(t_1); elseif (y_46_re <= 3e-9) tmp = t_0 * t_4; else tmp = t_3 * t_4; 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[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, y$46$re], $MachinePrecision]}, Block[{t$95$4 = N[(y$46$im * N[Log[t$95$2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -31000000000.0], N[(t$95$1 * t$95$3), $MachinePrecision], If[LessEqual[y$46$re, -1.7e-222], N[(t$95$0 * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3e-9], N[(t$95$0 * t$95$4), $MachinePrecision], N[(t$95$3 * t$95$4), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \sqrt{x.im \cdot x.im + x.re \cdot x.re}\\
t_3 := {t\_2}^{y.re}\\
t_4 := y.im \cdot \log t\_2\\
\mathbf{if}\;y.re \leq -31000000000:\\
\;\;\;\;t\_1 \cdot t\_3\\
\mathbf{elif}\;y.re \leq -1.7 \cdot 10^{-222}:\\
\;\;\;\;t\_0 \cdot \sin t\_1\\
\mathbf{elif}\;y.re \leq 3 \cdot 10^{-9}:\\
\;\;\;\;t\_0 \cdot t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot t\_4\\
\end{array}
\end{array}
if y.re < -3.1e10Initial program 34.8%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6487.9
Applied rewrites87.9%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6487.9
Applied rewrites87.9%
if -3.1e10 < y.re < -1.7000000000000001e-222Initial program 35.4%
Taylor expanded in y.re around inf
lower-*.f64N/A
lift-atan2.f6433.0
Applied rewrites33.0%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6448.3
Applied rewrites48.3%
if -1.7000000000000001e-222 < y.re < 2.99999999999999998e-9Initial program 48.8%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites56.0%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6449.9
Applied rewrites49.9%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6451.4
Applied rewrites51.4%
if 2.99999999999999998e-9 < y.re Initial program 36.4%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites53.1%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6466.7
Applied rewrites66.7%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6463.7
Applied rewrites63.7%
Final simplification63.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (sqrt (+ (* x.im x.im) (* x.re x.re))))
(t_1 (* y.im (log t_0)))
(t_2 (pow t_0 y.re)))
(if (<= y.re -4.1e-44)
(* (sin (* y.re (atan2 x.im x.re))) t_2)
(if (<= y.re 50.0)
(* (exp (* (- y.im) (atan2 x.im x.re))) t_1)
(* t_2 t_1)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_1 = y_46_im * log(t_0);
double t_2 = pow(t_0, y_46_re);
double tmp;
if (y_46_re <= -4.1e-44) {
tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * t_2;
} else if (y_46_re <= 50.0) {
tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_1;
} else {
tmp = t_2 * 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) :: t_2
real(8) :: tmp
t_0 = sqrt(((x_46im * x_46im) + (x_46re * x_46re)))
t_1 = y_46im * log(t_0)
t_2 = t_0 ** y_46re
if (y_46re <= (-4.1d-44)) then
tmp = sin((y_46re * atan2(x_46im, x_46re))) * t_2
else if (y_46re <= 50.0d0) then
tmp = exp((-y_46im * atan2(x_46im, x_46re))) * t_1
else
tmp = t_2 * 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.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_1 = y_46_im * Math.log(t_0);
double t_2 = Math.pow(t_0, y_46_re);
double tmp;
if (y_46_re <= -4.1e-44) {
tmp = Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re))) * t_2;
} else if (y_46_re <= 50.0) {
tmp = Math.exp((-y_46_im * Math.atan2(x_46_im, x_46_re))) * t_1;
} else {
tmp = t_2 * t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))) t_1 = y_46_im * math.log(t_0) t_2 = math.pow(t_0, y_46_re) tmp = 0 if y_46_re <= -4.1e-44: tmp = math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) * t_2 elif y_46_re <= 50.0: tmp = math.exp((-y_46_im * math.atan2(x_46_im, x_46_re))) * t_1 else: tmp = t_2 * t_1 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re))) t_1 = Float64(y_46_im * log(t_0)) t_2 = t_0 ^ y_46_re tmp = 0.0 if (y_46_re <= -4.1e-44) tmp = Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) * t_2); elseif (y_46_re <= 50.0) tmp = Float64(exp(Float64(Float64(-y_46_im) * atan(x_46_im, x_46_re))) * t_1); else tmp = Float64(t_2 * t_1); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))); t_1 = y_46_im * log(t_0); t_2 = t_0 ^ y_46_re; tmp = 0.0; if (y_46_re <= -4.1e-44) tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * t_2; elseif (y_46_re <= 50.0) tmp = exp((-y_46_im * atan2(x_46_im, x_46_re))) * t_1; else tmp = t_2 * 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[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$0, y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -4.1e-44], N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[y$46$re, 50.0], N[(N[Exp[N[((-y$46$im) * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$2 * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x.im \cdot x.im + x.re \cdot x.re}\\
t_1 := y.im \cdot \log t\_0\\
t_2 := {t\_0}^{y.re}\\
\mathbf{if}\;y.re \leq -4.1 \cdot 10^{-44}:\\
\;\;\;\;\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t\_2\\
\mathbf{elif}\;y.re \leq 50:\\
\;\;\;\;e^{\left(-y.im\right) \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\end{array}
\end{array}
if y.re < -4.09999999999999992e-44Initial program 33.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6480.3
Applied rewrites80.3%
if -4.09999999999999992e-44 < y.re < 50Initial program 44.5%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites47.2%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6442.7
Applied rewrites42.7%
Taylor expanded in y.re around 0
lower-exp.f64N/A
lower-neg.f64N/A
lift-atan2.f64N/A
lift-*.f6445.6
Applied rewrites45.6%
if 50 < y.re Initial program 36.5%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites54.0%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6468.3
Applied rewrites68.3%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6465.2
Applied rewrites65.2%
Final simplification60.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (sqrt (+ (* x.im x.im) (* x.re x.re)))) (t_1 (pow t_0 y.re)))
(if (<= y.re -2.4e-274)
(* (* y.re (atan2 x.im x.re)) t_1)
(* t_1 (* y.im (log t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_1 = pow(t_0, y_46_re);
double tmp;
if (y_46_re <= -2.4e-274) {
tmp = (y_46_re * atan2(x_46_im, x_46_re)) * t_1;
} else {
tmp = t_1 * (y_46_im * log(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) :: t_1
real(8) :: tmp
t_0 = sqrt(((x_46im * x_46im) + (x_46re * x_46re)))
t_1 = t_0 ** y_46re
if (y_46re <= (-2.4d-274)) then
tmp = (y_46re * atan2(x_46im, x_46re)) * t_1
else
tmp = t_1 * (y_46im * log(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.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re)));
double t_1 = Math.pow(t_0, y_46_re);
double tmp;
if (y_46_re <= -2.4e-274) {
tmp = (y_46_re * Math.atan2(x_46_im, x_46_re)) * t_1;
} else {
tmp = t_1 * (y_46_im * Math.log(t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))) t_1 = math.pow(t_0, y_46_re) tmp = 0 if y_46_re <= -2.4e-274: tmp = (y_46_re * math.atan2(x_46_im, x_46_re)) * t_1 else: tmp = t_1 * (y_46_im * math.log(t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sqrt(Float64(Float64(x_46_im * x_46_im) + Float64(x_46_re * x_46_re))) t_1 = t_0 ^ y_46_re tmp = 0.0 if (y_46_re <= -2.4e-274) tmp = Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) * t_1); else tmp = Float64(t_1 * Float64(y_46_im * log(t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = sqrt(((x_46_im * x_46_im) + (x_46_re * x_46_re))); t_1 = t_0 ^ y_46_re; tmp = 0.0; if (y_46_re <= -2.4e-274) tmp = (y_46_re * atan2(x_46_im, x_46_re)) * t_1; else tmp = t_1 * (y_46_im * log(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[Sqrt[N[(N[(x$46$im * x$46$im), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[t$95$0, y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -2.4e-274], N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(y$46$im * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x.im \cdot x.im + x.re \cdot x.re}\\
t_1 := {t\_0}^{y.re}\\
\mathbf{if}\;y.re \leq -2.4 \cdot 10^{-274}:\\
\;\;\;\;\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(y.im \cdot \log t\_0\right)\\
\end{array}
\end{array}
if y.re < -2.4e-274Initial program 36.4%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6454.9
Applied rewrites54.9%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6454.6
Applied rewrites54.6%
if -2.4e-274 < y.re Initial program 42.4%
Taylor expanded in y.im around 0
lower-+.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-*.f64N/A
log-pow-revN/A
lower-log.f64N/A
lower-pow.f64N/A
Applied rewrites54.7%
Taylor expanded in y.re around 0
lower-*.f64N/A
pow2N/A
pow2N/A
lower-log.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6459.0
Applied rewrites59.0%
Taylor expanded in y.im around 0
sqrt-pow2N/A
pow2N/A
pow2N/A
sqrt-pow2N/A
lower-pow.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-sqrt.f6448.8
Applied rewrites48.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (* y.re (atan2 x.im x.re)) (pow (sqrt (* x.re x.re)) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return (y_46_re * atan2(x_46_im, x_46_re)) * pow(sqrt((x_46_re * 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
code = (y_46re * atan2(x_46im, x_46re)) * (sqrt((x_46re * 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) {
return (y_46_re * Math.atan2(x_46_im, x_46_re)) * Math.pow(Math.sqrt((x_46_re * x_46_re)), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return (y_46_re * math.atan2(x_46_im, x_46_re)) * math.pow(math.sqrt((x_46_re * x_46_re)), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) * (sqrt(Float64(x_46_re * x_46_re)) ^ y_46_re)) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = (y_46_re * atan2(x_46_im, x_46_re)) * (sqrt((x_46_re * x_46_re)) ^ y_46_re); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] * N[Power[N[Sqrt[N[(x$46$re * x$46$re), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\sqrt{x.re \cdot x.re}\right)}^{y.re}
\end{array}
Initial program 39.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6444.9
Applied rewrites44.9%
Taylor expanded in x.re around inf
pow2N/A
lift-*.f6434.7
Applied rewrites34.7%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6434.3
Applied rewrites34.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (sin (* y.re (atan2 x.im x.re))) 1.0))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return sin((y_46_re * atan2(x_46_im, x_46_re))) * 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = sin((y_46re * atan2(x_46im, x_46re))) * 1.0d0
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.sin((y_46_re * Math.atan2(x_46_im, x_46_re))) * 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.sin((y_46_re * math.atan2(x_46_im, x_46_re))) * 1.0
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(sin(Float64(y_46_re * atan(x_46_im, x_46_re))) * 1.0) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = sin((y_46_re * atan2(x_46_im, x_46_re))) * 1.0; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot 1
\end{array}
Initial program 39.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6444.9
Applied rewrites44.9%
Taylor expanded in y.re around 0
Applied rewrites11.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* y.re (atan2 x.im x.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return y_46_re * atan2(x_46_im, x_46_re);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = y_46re * atan2(x_46im, x_46re)
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return y_46_re * Math.atan2(x_46_im, x_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return y_46_re * math.atan2(x_46_im, x_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(y_46_re * atan(x_46_im, x_46_re)) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = y_46_re * atan2(x_46_im, x_46_re); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}
\end{array}
Initial program 39.3%
Taylor expanded in y.im around 0
lower-*.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lift-atan2.f64N/A
lower-pow.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6444.9
Applied rewrites44.9%
Taylor expanded in y.re around 0
lift-atan2.f64N/A
lift-*.f6411.1
Applied rewrites11.1%
herbie shell --seed 2025058
(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)))))