
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
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 = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
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 = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (+ x.re (* (/ y.im y.re) x.im)) y.re)))
(if (<= y.re -1.35e+147)
t_0
(if (<= y.re -5.1e-48)
(*
x.re
(+
(/ y.re (+ (pow y.im 2.0) (pow y.re 2.0)))
(* (/ y.im (* (+ (* y.im y.im) (* y.re y.re)) x.re)) x.im)))
(if (<= y.re 1.45e-123)
(/ (+ x.im (* y.re (/ x.re y.im))) y.im)
(if (<= y.re 2.9e+55)
(/
(+ (* x.re y.re) (* x.im y.im))
(+ (* y.re y.re) (* y.im y.im)))
t_0))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.35e+147) {
tmp = t_0;
} else if (y_46_re <= -5.1e-48) {
tmp = x_46_re * ((y_46_re / (pow(y_46_im, 2.0) + pow(y_46_re, 2.0))) + ((y_46_im / (((y_46_im * y_46_im) + (y_46_re * y_46_re)) * x_46_re)) * x_46_im));
} else if (y_46_re <= 1.45e-123) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else if (y_46_re <= 2.9e+55) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46re + ((y_46im / y_46re) * x_46im)) / y_46re
if (y_46re <= (-1.35d+147)) then
tmp = t_0
else if (y_46re <= (-5.1d-48)) then
tmp = x_46re * ((y_46re / ((y_46im ** 2.0d0) + (y_46re ** 2.0d0))) + ((y_46im / (((y_46im * y_46im) + (y_46re * y_46re)) * x_46re)) * x_46im))
else if (y_46re <= 1.45d-123) then
tmp = (x_46im + (y_46re * (x_46re / y_46im))) / y_46im
else if (y_46re <= 2.9d+55) then
tmp = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.35e+147) {
tmp = t_0;
} else if (y_46_re <= -5.1e-48) {
tmp = x_46_re * ((y_46_re / (Math.pow(y_46_im, 2.0) + Math.pow(y_46_re, 2.0))) + ((y_46_im / (((y_46_im * y_46_im) + (y_46_re * y_46_re)) * x_46_re)) * x_46_im));
} else if (y_46_re <= 1.45e-123) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else if (y_46_re <= 2.9e+55) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re tmp = 0 if y_46_re <= -1.35e+147: tmp = t_0 elif y_46_re <= -5.1e-48: tmp = x_46_re * ((y_46_re / (math.pow(y_46_im, 2.0) + math.pow(y_46_re, 2.0))) + ((y_46_im / (((y_46_im * y_46_im) + (y_46_re * y_46_re)) * x_46_re)) * x_46_im)) elif y_46_re <= 1.45e-123: tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im elif y_46_re <= 2.9e+55: tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_re + Float64(Float64(y_46_im / y_46_re) * x_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -1.35e+147) tmp = t_0; elseif (y_46_re <= -5.1e-48) tmp = Float64(x_46_re * Float64(Float64(y_46_re / Float64((y_46_im ^ 2.0) + (y_46_re ^ 2.0))) + Float64(Float64(y_46_im / Float64(Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re)) * x_46_re)) * x_46_im))); elseif (y_46_re <= 1.45e-123) tmp = Float64(Float64(x_46_im + Float64(y_46_re * Float64(x_46_re / y_46_im))) / y_46_im); elseif (y_46_re <= 2.9e+55) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re; tmp = 0.0; if (y_46_re <= -1.35e+147) tmp = t_0; elseif (y_46_re <= -5.1e-48) tmp = x_46_re * ((y_46_re / ((y_46_im ^ 2.0) + (y_46_re ^ 2.0))) + ((y_46_im / (((y_46_im * y_46_im) + (y_46_re * y_46_re)) * x_46_re)) * x_46_im)); elseif (y_46_re <= 1.45e-123) tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im; elseif (y_46_re <= 2.9e+55) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re + N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.35e+147], t$95$0, If[LessEqual[y$46$re, -5.1e-48], N[(x$46$re * N[(N[(y$46$re / N[(N[Power[y$46$im, 2.0], $MachinePrecision] + N[Power[y$46$re, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y$46$im / N[(N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.45e-123], N[(N[(x$46$im + N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 2.9e+55], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
t_0 := \frac{x.re + \frac{y.im}{y.re} \cdot x.im}{y.re}\\
\mathbf{if}\;y.re \leq -1.35 \cdot 10^{+147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq -5.1 \cdot 10^{-48}:\\
\;\;\;\;x.re \cdot \left(\frac{y.re}{{y.im}^{2} + {y.re}^{2}} + \frac{y.im}{\left(y.im \cdot y.im + y.re \cdot y.re\right) \cdot x.re} \cdot x.im\right)\\
\mathbf{elif}\;y.re \leq 1.45 \cdot 10^{-123}:\\
\;\;\;\;\frac{x.im + y.re \cdot \frac{x.re}{y.im}}{y.im}\\
\mathbf{elif}\;y.re \leq 2.9 \cdot 10^{+55}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -1.35e147 or 2.8999999999999999e55 < y.re Initial program 61.3%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -1.35e147 < y.re < -5.1000000000000001e-48Initial program 61.3%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f6456.1%
Applied rewrites56.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6457.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6457.6%
lift-pow.f64N/A
pow2N/A
lift-*.f6457.6%
lift-pow.f64N/A
pow2N/A
lift-*.f6457.6%
Applied rewrites57.6%
if -5.1000000000000001e-48 < y.re < 1.45e-123Initial program 61.3%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.1%
Applied rewrites53.1%
if 1.45e-123 < y.re < 2.8999999999999999e55Initial program 61.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (+ x.re (* (/ y.im y.re) x.im)) y.re)))
(if (<= y.re -4.9e+42)
t_0
(if (<= y.re 1.45e-123)
(/ (+ x.im (* y.re (/ x.re y.im))) y.im)
(if (<= y.re 2.9e+55)
(/
(+ (* x.re y.re) (* x.im y.im))
(+ (* y.re y.re) (* y.im y.im)))
t_0)))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -4.9e+42) {
tmp = t_0;
} else if (y_46_re <= 1.45e-123) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else if (y_46_re <= 2.9e+55) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46re + ((y_46im / y_46re) * x_46im)) / y_46re
if (y_46re <= (-4.9d+42)) then
tmp = t_0
else if (y_46re <= 1.45d-123) then
tmp = (x_46im + (y_46re * (x_46re / y_46im))) / y_46im
else if (y_46re <= 2.9d+55) then
tmp = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -4.9e+42) {
tmp = t_0;
} else if (y_46_re <= 1.45e-123) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else if (y_46_re <= 2.9e+55) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re tmp = 0 if y_46_re <= -4.9e+42: tmp = t_0 elif y_46_re <= 1.45e-123: tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im elif y_46_re <= 2.9e+55: tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_re + Float64(Float64(y_46_im / y_46_re) * x_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -4.9e+42) tmp = t_0; elseif (y_46_re <= 1.45e-123) tmp = Float64(Float64(x_46_im + Float64(y_46_re * Float64(x_46_re / y_46_im))) / y_46_im); elseif (y_46_re <= 2.9e+55) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re; tmp = 0.0; if (y_46_re <= -4.9e+42) tmp = t_0; elseif (y_46_re <= 1.45e-123) tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im; elseif (y_46_re <= 2.9e+55) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re + N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -4.9e+42], t$95$0, If[LessEqual[y$46$re, 1.45e-123], N[(N[(x$46$im + N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 2.9e+55], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{x.re + \frac{y.im}{y.re} \cdot x.im}{y.re}\\
\mathbf{if}\;y.re \leq -4.9 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 1.45 \cdot 10^{-123}:\\
\;\;\;\;\frac{x.im + y.re \cdot \frac{x.re}{y.im}}{y.im}\\
\mathbf{elif}\;y.re \leq 2.9 \cdot 10^{+55}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -4.9000000000000002e42 or 2.8999999999999999e55 < y.re Initial program 61.3%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -4.9000000000000002e42 < y.re < 1.45e-123Initial program 61.3%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.1%
Applied rewrites53.1%
if 1.45e-123 < y.re < 2.8999999999999999e55Initial program 61.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (+ x.re (* (/ y.im y.re) x.im)) y.re)))
(if (<= y.re -4.9e+42)
t_0
(if (<= y.re 13000000000000.0)
(/ (+ x.im (* y.re (/ x.re y.im))) y.im)
t_0))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -4.9e+42) {
tmp = t_0;
} else if (y_46_re <= 13000000000000.0) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46re + ((y_46im / y_46re) * x_46im)) / y_46re
if (y_46re <= (-4.9d+42)) then
tmp = t_0
else if (y_46re <= 13000000000000.0d0) then
tmp = (x_46im + (y_46re * (x_46re / y_46im))) / y_46im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -4.9e+42) {
tmp = t_0;
} else if (y_46_re <= 13000000000000.0) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re tmp = 0 if y_46_re <= -4.9e+42: tmp = t_0 elif y_46_re <= 13000000000000.0: tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_re + Float64(Float64(y_46_im / y_46_re) * x_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -4.9e+42) tmp = t_0; elseif (y_46_re <= 13000000000000.0) tmp = Float64(Float64(x_46_im + Float64(y_46_re * Float64(x_46_re / y_46_im))) / y_46_im); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_re + ((y_46_im / y_46_re) * x_46_im)) / y_46_re; tmp = 0.0; if (y_46_re <= -4.9e+42) tmp = t_0; elseif (y_46_re <= 13000000000000.0) tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re + N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -4.9e+42], t$95$0, If[LessEqual[y$46$re, 13000000000000.0], N[(N[(x$46$im + N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{x.re + \frac{y.im}{y.re} \cdot x.im}{y.re}\\
\mathbf{if}\;y.re \leq -4.9 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 13000000000000:\\
\;\;\;\;\frac{x.im + y.re \cdot \frac{x.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -4.9000000000000002e42 or 1.3e13 < y.re Initial program 61.3%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.9%
Applied rewrites51.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.1%
Applied rewrites54.1%
if -4.9000000000000002e42 < y.re < 1.3e13Initial program 61.3%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.1%
Applied rewrites53.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -4.9e+42)
(/ x.re y.re)
(if (<= y.re 13000000000000.0)
(/ (+ x.im (* y.re (/ x.re y.im))) y.im)
(/ x.re y.re))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -4.9e+42) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 13000000000000.0) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-4.9d+42)) then
tmp = x_46re / y_46re
else if (y_46re <= 13000000000000.0d0) then
tmp = (x_46im + (y_46re * (x_46re / y_46im))) / y_46im
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -4.9e+42) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 13000000000000.0) {
tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -4.9e+42: tmp = x_46_re / y_46_re elif y_46_re <= 13000000000000.0: tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -4.9e+42) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 13000000000000.0) tmp = Float64(Float64(x_46_im + Float64(y_46_re * Float64(x_46_re / y_46_im))) / y_46_im); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -4.9e+42) tmp = x_46_re / y_46_re; elseif (y_46_re <= 13000000000000.0) tmp = (x_46_im + (y_46_re * (x_46_re / y_46_im))) / y_46_im; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -4.9e+42], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 13000000000000.0], N[(N[(x$46$im + N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.9 \cdot 10^{+42}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 13000000000000:\\
\;\;\;\;\frac{x.im + y.re \cdot \frac{x.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
if y.re < -4.9000000000000002e42 or 1.3e13 < y.re Initial program 61.3%
Taylor expanded in y.re around inf
lower-/.f6442.6%
Applied rewrites42.6%
if -4.9000000000000002e42 < y.re < 1.3e13Initial program 61.3%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6451.8%
Applied rewrites51.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.1%
Applied rewrites53.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -5.2e+42)
(/ x.re y.re)
(if (<= y.re 3.2e-21)
(/ x.im y.im)
(if (<= y.re 1.52e+147)
(* (/ y.re (+ (* y.im y.im) (* y.re y.re))) x.re)
(/ x.re y.re)))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -5.2e+42) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 3.2e-21) {
tmp = x_46_im / y_46_im;
} else if (y_46_re <= 1.52e+147) {
tmp = (y_46_re / ((y_46_im * y_46_im) + (y_46_re * y_46_re))) * x_46_re;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-5.2d+42)) then
tmp = x_46re / y_46re
else if (y_46re <= 3.2d-21) then
tmp = x_46im / y_46im
else if (y_46re <= 1.52d+147) then
tmp = (y_46re / ((y_46im * y_46im) + (y_46re * y_46re))) * x_46re
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -5.2e+42) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 3.2e-21) {
tmp = x_46_im / y_46_im;
} else if (y_46_re <= 1.52e+147) {
tmp = (y_46_re / ((y_46_im * y_46_im) + (y_46_re * y_46_re))) * x_46_re;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -5.2e+42: tmp = x_46_re / y_46_re elif y_46_re <= 3.2e-21: tmp = x_46_im / y_46_im elif y_46_re <= 1.52e+147: tmp = (y_46_re / ((y_46_im * y_46_im) + (y_46_re * y_46_re))) * x_46_re else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -5.2e+42) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 3.2e-21) tmp = Float64(x_46_im / y_46_im); elseif (y_46_re <= 1.52e+147) tmp = Float64(Float64(y_46_re / Float64(Float64(y_46_im * y_46_im) + Float64(y_46_re * y_46_re))) * x_46_re); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -5.2e+42) tmp = x_46_re / y_46_re; elseif (y_46_re <= 3.2e-21) tmp = x_46_im / y_46_im; elseif (y_46_re <= 1.52e+147) tmp = (y_46_re / ((y_46_im * y_46_im) + (y_46_re * y_46_re))) * x_46_re; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -5.2e+42], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 3.2e-21], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.52e+147], N[(N[(y$46$re / N[(N[(y$46$im * y$46$im), $MachinePrecision] + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -5.2 \cdot 10^{+42}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 3.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.re \leq 1.52 \cdot 10^{+147}:\\
\;\;\;\;\frac{y.re}{y.im \cdot y.im + y.re \cdot y.re} \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
if y.re < -5.1999999999999998e42 or 1.5199999999999999e147 < y.re Initial program 61.3%
Taylor expanded in y.re around inf
lower-/.f6442.6%
Applied rewrites42.6%
if -5.1999999999999998e42 < y.re < 3.2000000000000002e-21Initial program 61.3%
Taylor expanded in y.re around 0
lower-/.f6441.6%
Applied rewrites41.6%
if 3.2000000000000002e-21 < y.re < 1.5199999999999999e147Initial program 61.3%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-pow.f6456.1%
Applied rewrites56.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6456.1%
Applied rewrites55.9%
Taylor expanded in x.re around inf
Applied rewrites42.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -5.2e+42) (/ x.re y.re) (if (<= y.re 13000000000000.0) (/ x.im y.im) (/ x.re y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -5.2e+42) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 13000000000000.0) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-5.2d+42)) then
tmp = x_46re / y_46re
else if (y_46re <= 13000000000000.0d0) then
tmp = x_46im / y_46im
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -5.2e+42) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 13000000000000.0) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -5.2e+42: tmp = x_46_re / y_46_re elif y_46_re <= 13000000000000.0: tmp = x_46_im / y_46_im else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -5.2e+42) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 13000000000000.0) tmp = Float64(x_46_im / y_46_im); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -5.2e+42) tmp = x_46_re / y_46_re; elseif (y_46_re <= 13000000000000.0) tmp = x_46_im / y_46_im; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -5.2e+42], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 13000000000000.0], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -5.2 \cdot 10^{+42}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 13000000000000:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
if y.re < -5.1999999999999998e42 or 1.3e13 < y.re Initial program 61.3%
Taylor expanded in y.re around inf
lower-/.f6442.6%
Applied rewrites42.6%
if -5.1999999999999998e42 < y.re < 1.3e13Initial program 61.3%
Taylor expanded in y.re around 0
lower-/.f6441.6%
Applied rewrites41.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.im))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
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 = x_46im / y_46im
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_im) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_im; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\frac{x.im}{y.im}
Initial program 61.3%
Taylor expanded in y.re around 0
lower-/.f6441.6%
Applied rewrites41.6%
herbie shell --seed 2025258
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))