
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y): return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y) return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))) end
function tmp = code(x, y) tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0)); end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}
(FPCore (x y) :precision binary64 (/ (* (/ x (+ y x)) (/ y (+ (+ y x) 1.0))) (+ y x)))
double code(double x, double y) {
return ((x / (y + x)) * (y / ((y + x) + 1.0))) / (y + x);
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x / (y + x)) * (y / ((y + x) + 1.0d0))) / (y + x)
end function
public static double code(double x, double y) {
return ((x / (y + x)) * (y / ((y + x) + 1.0))) / (y + x);
}
def code(x, y): return ((x / (y + x)) * (y / ((y + x) + 1.0))) / (y + x)
function code(x, y) return Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(Float64(y + x) + 1.0))) / Float64(y + x)) end
function tmp = code(x, y) tmp = ((x / (y + x)) * (y / ((y + x) + 1.0))) / (y + x); end
code[x_, y_] := N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) + 1}}{y + x}
\end{array}
Initial program 68.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6487.9
Applied rewrites87.9%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
(FPCore (x y) :precision binary64 (* (/ x (+ y x)) (/ (/ y (+ (+ y x) 1.0)) (+ y x))))
double code(double x, double y) {
return (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x));
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (y + x)) * ((y / ((y + x) + 1.0d0)) / (y + x))
end function
public static double code(double x, double y) {
return (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x));
}
def code(x, y): return (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x))
function code(x, y) return Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / Float64(Float64(y + x) + 1.0)) / Float64(y + x))) end
function tmp = code(x, y) tmp = (x / (y + x)) * ((y / ((y + x) + 1.0)) / (y + x)); end
code[x_, y_] := N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y + x} \cdot \frac{\frac{y}{\left(y + x\right) + 1}}{y + x}
\end{array}
Initial program 68.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6487.9
Applied rewrites87.9%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
(FPCore (x y) :precision binary64 (if (<= x -1.4e+149) (/ (/ y x) (+ y x)) (/ (* (/ x (+ y x)) y) (* (+ y x) (+ (+ y x) 1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -1.4e+149) {
tmp = (y / x) / (y + x);
} else {
tmp = ((x / (y + x)) * y) / ((y + x) * ((y + x) + 1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.4d+149)) then
tmp = (y / x) / (y + x)
else
tmp = ((x / (y + x)) * y) / ((y + x) * ((y + x) + 1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.4e+149) {
tmp = (y / x) / (y + x);
} else {
tmp = ((x / (y + x)) * y) / ((y + x) * ((y + x) + 1.0));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.4e+149: tmp = (y / x) / (y + x) else: tmp = ((x / (y + x)) * y) / ((y + x) * ((y + x) + 1.0)) return tmp
function code(x, y) tmp = 0.0 if (x <= -1.4e+149) tmp = Float64(Float64(y / x) / Float64(y + x)); else tmp = Float64(Float64(Float64(x / Float64(y + x)) * y) / Float64(Float64(y + x) * Float64(Float64(y + x) + 1.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.4e+149) tmp = (y / x) / (y + x); else tmp = ((x / (y + x)) * y) / ((y + x) * ((y + x) + 1.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.4e+149], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot y}{\left(y + x\right) \cdot \left(\left(y + x\right) + 1\right)}\\
\end{array}
\end{array}
if x < -1.4e149Initial program 58.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.3
Applied rewrites82.3%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f6488.6
Applied rewrites88.6%
if -1.4e149 < x Initial program 70.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.7
Applied rewrites88.7%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f6495.9
Applied rewrites95.9%
(FPCore (x y)
:precision binary64
(if (<= x -1.4e+149)
(/ (/ y x) (+ y x))
(if (<= x -5e-159)
(* (/ x (* (+ y x) (+ y x))) (/ y (+ (+ y x) 1.0)))
(/ (/ x (+ 1.0 y)) y))))
double code(double x, double y) {
double tmp;
if (x <= -1.4e+149) {
tmp = (y / x) / (y + x);
} else if (x <= -5e-159) {
tmp = (x / ((y + x) * (y + x))) * (y / ((y + x) + 1.0));
} else {
tmp = (x / (1.0 + y)) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.4d+149)) then
tmp = (y / x) / (y + x)
else if (x <= (-5d-159)) then
tmp = (x / ((y + x) * (y + x))) * (y / ((y + x) + 1.0d0))
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.4e+149) {
tmp = (y / x) / (y + x);
} else if (x <= -5e-159) {
tmp = (x / ((y + x) * (y + x))) * (y / ((y + x) + 1.0));
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.4e+149: tmp = (y / x) / (y + x) elif x <= -5e-159: tmp = (x / ((y + x) * (y + x))) * (y / ((y + x) + 1.0)) else: tmp = (x / (1.0 + y)) / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.4e+149) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (x <= -5e-159) tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(y + x))) * Float64(y / Float64(Float64(y + x) + 1.0))); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.4e+149) tmp = (y / x) / (y + x); elseif (x <= -5e-159) tmp = (x / ((y + x) * (y + x))) * (y / ((y + x) + 1.0)); else tmp = (x / (1.0 + y)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.4e+149], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-159], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{\left(y + x\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -1.4e149Initial program 58.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6482.3
Applied rewrites82.3%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
lower-/.f6488.6
Applied rewrites88.6%
if -1.4e149 < x < -5.00000000000000032e-159Initial program 75.9%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.1
Applied rewrites97.1%
if -5.00000000000000032e-159 < x Initial program 68.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6456.3
Applied rewrites56.3%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f6457.3
Applied rewrites57.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= x -1.42e+56)
(/ (* 1.0 (/ y t_0)) (+ y x))
(if (<= x -5e-159)
(* x (/ y (* t_0 (* (+ y x) (+ y x)))))
(/ (/ x (+ 1.0 y)) y)))))
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -1.42e+56) {
tmp = (1.0 * (y / t_0)) / (y + x);
} else if (x <= -5e-159) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else {
tmp = (x / (1.0 + y)) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (y + x) + 1.0d0
if (x <= (-1.42d+56)) then
tmp = (1.0d0 * (y / t_0)) / (y + x)
else if (x <= (-5d-159)) then
tmp = x * (y / (t_0 * ((y + x) * (y + x))))
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (x <= -1.42e+56) {
tmp = (1.0 * (y / t_0)) / (y + x);
} else if (x <= -5e-159) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if x <= -1.42e+56: tmp = (1.0 * (y / t_0)) / (y + x) elif x <= -5e-159: tmp = x * (y / (t_0 * ((y + x) * (y + x)))) else: tmp = (x / (1.0 + y)) / y return tmp
function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (x <= -1.42e+56) tmp = Float64(Float64(1.0 * Float64(y / t_0)) / Float64(y + x)); elseif (x <= -5e-159) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (x <= -1.42e+56) tmp = (1.0 * (y / t_0)) / (y + x); elseif (x <= -5e-159) tmp = x * (y / (t_0 * ((y + x) * (y + x)))); else tmp = (x / (1.0 + y)) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.42e+56], N[(N[(1.0 * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-159], N[(x * N[(y / N[(t$95$0 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;x \leq -1.42 \cdot 10^{+56}:\\
\;\;\;\;\frac{1 \cdot \frac{y}{t\_0}}{y + x}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -1.42e56Initial program 57.7%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6486.1
Applied rewrites86.1%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites80.4%
if -1.42e56 < x < -5.00000000000000032e-159Initial program 84.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6494.4
Applied rewrites94.4%
if -5.00000000000000032e-159 < x Initial program 68.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6456.3
Applied rewrites56.3%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f6457.3
Applied rewrites57.3%
(FPCore (x y)
:precision binary64
(if (<= x -3.5e-10)
(/ (/ y (+ 1.0 x)) (+ y x))
(if (<= x -1.3e-149)
(/ (* x y) (* (* (+ x y) (+ x y)) (+ y 1.0)))
(/ (/ x (+ 1.0 y)) y))))
double code(double x, double y) {
double tmp;
if (x <= -3.5e-10) {
tmp = (y / (1.0 + x)) / (y + x);
} else if (x <= -1.3e-149) {
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
} else {
tmp = (x / (1.0 + y)) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.5d-10)) then
tmp = (y / (1.0d0 + x)) / (y + x)
else if (x <= (-1.3d-149)) then
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0d0))
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.5e-10) {
tmp = (y / (1.0 + x)) / (y + x);
} else if (x <= -1.3e-149) {
tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.5e-10: tmp = (y / (1.0 + x)) / (y + x) elif x <= -1.3e-149: tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0)) else: tmp = (x / (1.0 + y)) / y return tmp
function code(x, y) tmp = 0.0 if (x <= -3.5e-10) tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(y + x)); elseif (x <= -1.3e-149) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(y + 1.0))); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.5e-10) tmp = (y / (1.0 + x)) / (y + x); elseif (x <= -1.3e-149) tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0)); else tmp = (x / (1.0 + y)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.5e-10], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.3e-149], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-149}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(y + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if x < -3.4999999999999998e-10Initial program 63.1%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6475.2
Applied rewrites75.2%
if -3.4999999999999998e-10 < x < -1.29999999999999999e-149Initial program 85.2%
Taylor expanded in x around 0
Applied rewrites85.0%
if -1.29999999999999999e-149 < x Initial program 68.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6456.5
Applied rewrites56.5%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f6457.4
Applied rewrites57.4%
(FPCore (x y)
:precision binary64
(if (<= y -4.5e-10)
(/ (/ y x) x)
(if (<= y 1.75e-131)
(/ y (* (+ 1.0 x) x))
(if (<= y 58000000000000.0)
(/ x (* (+ 1.0 y) y))
(if (<= y 1.4e+164) (* (/ x (* (+ y x) y)) 1.0) (/ (/ x y) y))))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / x;
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 58000000000000.0) {
tmp = x / ((1.0 + y) * y);
} else if (y <= 1.4e+164) {
tmp = (x / ((y + x) * y)) * 1.0;
} else {
tmp = (x / y) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.5d-10)) then
tmp = (y / x) / x
else if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else if (y <= 58000000000000.0d0) then
tmp = x / ((1.0d0 + y) * y)
else if (y <= 1.4d+164) then
tmp = (x / ((y + x) * y)) * 1.0d0
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / x;
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 58000000000000.0) {
tmp = x / ((1.0 + y) * y);
} else if (y <= 1.4e+164) {
tmp = (x / ((y + x) * y)) * 1.0;
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e-10: tmp = (y / x) / x elif y <= 1.75e-131: tmp = y / ((1.0 + x) * x) elif y <= 58000000000000.0: tmp = x / ((1.0 + y) * y) elif y <= 1.4e+164: tmp = (x / ((y + x) * y)) * 1.0 else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(Float64(y / x) / x); elseif (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); elseif (y <= 58000000000000.0) tmp = Float64(x / Float64(Float64(1.0 + y) * y)); elseif (y <= 1.4e+164) tmp = Float64(Float64(x / Float64(Float64(y + x) * y)) * 1.0); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.5e-10) tmp = (y / x) / x; elseif (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); elseif (y <= 58000000000000.0) tmp = x / ((1.0 + y) * y); elseif (y <= 1.4e+164) tmp = (x / ((y + x) * y)) * 1.0; else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e-10], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 58000000000000.0], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+164], N[(N[(x / N[(N[(y + x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{elif}\;y \leq 58000000000000:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot y} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -4.5e-10Initial program 64.2%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6423.7
Applied rewrites23.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6427.6
Applied rewrites27.6%
if -4.5e-10 < y < 1.7500000000000001e-131Initial program 70.5%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6478.7
Applied rewrites78.7%
if 1.7500000000000001e-131 < y < 5.8e13Initial program 89.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6441.7
Applied rewrites41.7%
if 5.8e13 < y < 1.4000000000000001e164Initial program 64.1%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6491.9
Applied rewrites91.9%
Taylor expanded in y around inf
Applied rewrites81.3%
Taylor expanded in x around 0
Applied rewrites75.0%
if 1.4000000000000001e164 < y Initial program 57.4%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
(FPCore (x y) :precision binary64 (if (<= y -4.5e-10) (/ (/ y x) (+ y x)) (if (<= y 1.75e-131) (/ y (* (+ 1.0 x) x)) (/ (/ x (+ 1.0 y)) (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / (y + x);
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = (x / (1.0 + y)) / (y + x);
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.5d-10)) then
tmp = (y / x) / (y + x)
else if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else
tmp = (x / (1.0d0 + y)) / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / (y + x);
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = (x / (1.0 + y)) / (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e-10: tmp = (y / x) / (y + x) elif y <= 1.75e-131: tmp = y / ((1.0 + x) * x) else: tmp = (x / (1.0 + y)) / (y + x) return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.5e-10) tmp = (y / x) / (y + x); elseif (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); else tmp = (x / (1.0 + y)) / (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e-10], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y + x}\\
\end{array}
\end{array}
if y < -4.5e-10Initial program 64.2%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6428.3
Applied rewrites28.3%
if -4.5e-10 < y < 1.7500000000000001e-131Initial program 70.5%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6478.7
Applied rewrites78.7%
if 1.7500000000000001e-131 < y Initial program 70.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6491.5
Applied rewrites91.5%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lift-+.f6465.3
Applied rewrites65.3%
(FPCore (x y) :precision binary64 (if (<= y 1.75e-131) (/ (/ y (+ 1.0 x)) (+ y x)) (/ (/ x (+ 1.0 y)) (+ y x))))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-131) {
tmp = (y / (1.0 + x)) / (y + x);
} else {
tmp = (x / (1.0 + y)) / (y + x);
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.75d-131) then
tmp = (y / (1.0d0 + x)) / (y + x)
else
tmp = (x / (1.0d0 + y)) / (y + x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.75e-131) {
tmp = (y / (1.0 + x)) / (y + x);
} else {
tmp = (x / (1.0 + y)) / (y + x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e-131: tmp = (y / (1.0 + x)) / (y + x) else: tmp = (x / (1.0 + y)) / (y + x) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e-131) tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(y + x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / Float64(y + x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e-131) tmp = (y / (1.0 + x)) / (y + x); else tmp = (x / (1.0 + y)) / (y + x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e-131], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y + x}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-131Initial program 68.0%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6485.9
Applied rewrites85.9%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6459.4
Applied rewrites59.4%
if 1.7500000000000001e-131 < y Initial program 70.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6491.5
Applied rewrites91.5%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lift-+.f6465.3
Applied rewrites65.3%
(FPCore (x y)
:precision binary64
(if (<= y -4.5e-10)
(/ (/ y x) x)
(if (<= y 1.75e-131)
(/ y (* (+ 1.0 x) x))
(if (<= y 1.4e+164) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y)))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / x;
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 1.4e+164) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.5d-10)) then
tmp = (y / x) / x
else if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else if (y <= 1.4d+164) then
tmp = x / ((1.0d0 + y) * y)
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / x;
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 1.4e+164) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e-10: tmp = (y / x) / x elif y <= 1.75e-131: tmp = y / ((1.0 + x) * x) elif y <= 1.4e+164: tmp = x / ((1.0 + y) * y) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(Float64(y / x) / x); elseif (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); elseif (y <= 1.4e+164) tmp = Float64(x / Float64(Float64(1.0 + y) * y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.5e-10) tmp = (y / x) / x; elseif (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); elseif (y <= 1.4e+164) tmp = x / ((1.0 + y) * y); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e-10], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+164], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -4.5e-10Initial program 64.2%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6423.7
Applied rewrites23.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6427.6
Applied rewrites27.6%
if -4.5e-10 < y < 1.7500000000000001e-131Initial program 70.5%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6478.7
Applied rewrites78.7%
if 1.7500000000000001e-131 < y < 1.4000000000000001e164Initial program 76.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6453.1
Applied rewrites53.1%
if 1.4000000000000001e164 < y Initial program 57.4%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
(FPCore (x y) :precision binary64 (if (<= y -4.5e-10) (/ (/ y x) (+ y x)) (if (<= y 1.75e-131) (/ y (* (+ 1.0 x) x)) (/ (/ x (+ 1.0 y)) y))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / (y + x);
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = (x / (1.0 + y)) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.5d-10)) then
tmp = (y / x) / (y + x)
else if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / (y + x);
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e-10: tmp = (y / x) / (y + x) elif y <= 1.75e-131: tmp = y / ((1.0 + x) * x) else: tmp = (x / (1.0 + y)) / y return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(Float64(y / x) / Float64(y + x)); elseif (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.5e-10) tmp = (y / x) / (y + x); elseif (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); else tmp = (x / (1.0 + y)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e-10], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if y < -4.5e-10Initial program 64.2%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.5
Applied rewrites88.5%
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6428.3
Applied rewrites28.3%
if -4.5e-10 < y < 1.7500000000000001e-131Initial program 70.5%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6478.7
Applied rewrites78.7%
if 1.7500000000000001e-131 < y Initial program 70.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6462.9
Applied rewrites62.9%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f6464.8
Applied rewrites64.8%
(FPCore (x y) :precision binary64 (if (<= y -4.5e-10) (/ (/ y x) x) (if (<= y 1.75e-131) (/ y (* (+ 1.0 x) x)) (/ (/ x (+ 1.0 y)) y))))
double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / x;
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = (x / (1.0 + y)) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-4.5d-10)) then
tmp = (y / x) / x
else if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else
tmp = (x / (1.0d0 + y)) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -4.5e-10) {
tmp = (y / x) / x;
} else if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = (x / (1.0 + y)) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -4.5e-10: tmp = (y / x) / x elif y <= 1.75e-131: tmp = y / ((1.0 + x) * x) else: tmp = (x / (1.0 + y)) / y return tmp
function code(x, y) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(Float64(y / x) / x); elseif (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); else tmp = Float64(Float64(x / Float64(1.0 + y)) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -4.5e-10) tmp = (y / x) / x; elseif (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); else tmp = (x / (1.0 + y)) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -4.5e-10], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(1.0 + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{1 + y}}{y}\\
\end{array}
\end{array}
if y < -4.5e-10Initial program 64.2%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6423.7
Applied rewrites23.7%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6427.6
Applied rewrites27.6%
if -4.5e-10 < y < 1.7500000000000001e-131Initial program 70.5%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6478.7
Applied rewrites78.7%
if 1.7500000000000001e-131 < y Initial program 70.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6462.9
Applied rewrites62.9%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f6464.8
Applied rewrites64.8%
(FPCore (x y) :precision binary64 (if (<= y 1.75e-131) (/ y (* (+ 1.0 x) x)) (if (<= y 1.4e+164) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 1.4e+164) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else if (y <= 1.4d+164) then
tmp = x / ((1.0d0 + y) * y)
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 1.4e+164) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e-131: tmp = y / ((1.0 + x) * x) elif y <= 1.4e+164: tmp = x / ((1.0 + y) * y) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); elseif (y <= 1.4e+164) tmp = Float64(x / Float64(Float64(1.0 + y) * y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); elseif (y <= 1.4e+164) tmp = x / ((1.0 + y) * y); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+164], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-131Initial program 68.0%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6457.5
Applied rewrites57.5%
if 1.7500000000000001e-131 < y < 1.4000000000000001e164Initial program 76.7%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6453.1
Applied rewrites53.1%
if 1.4000000000000001e164 < y Initial program 57.4%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
(FPCore (x y) :precision binary64 (if (<= y 1.75e-131) (/ y (* (+ 1.0 x) x)) (/ x (* (+ 1.0 y) y))))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = x / ((1.0 + y) * y);
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.75d-131) then
tmp = y / ((1.0d0 + x) * x)
else
tmp = x / ((1.0d0 + y) * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.75e-131) {
tmp = y / ((1.0 + x) * x);
} else {
tmp = x / ((1.0 + y) * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e-131: tmp = y / ((1.0 + x) * x) else: tmp = x / ((1.0 + y) * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e-131) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); else tmp = Float64(x / Float64(Float64(1.0 + y) * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e-131) tmp = y / ((1.0 + x) * x); else tmp = x / ((1.0 + y) * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-131}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\end{array}
\end{array}
if y < 1.7500000000000001e-131Initial program 68.0%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6457.5
Applied rewrites57.5%
if 1.7500000000000001e-131 < y Initial program 70.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6462.9
Applied rewrites62.9%
(FPCore (x y) :precision binary64 (if (<= x -6600000000.0) (/ y (* x x)) (/ x (* (+ 1.0 y) y))))
double code(double x, double y) {
double tmp;
if (x <= -6600000000.0) {
tmp = y / (x * x);
} else {
tmp = x / ((1.0 + y) * y);
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-6600000000.0d0)) then
tmp = y / (x * x)
else
tmp = x / ((1.0d0 + y) * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -6600000000.0) {
tmp = y / (x * x);
} else {
tmp = x / ((1.0 + y) * y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -6600000000.0: tmp = y / (x * x) else: tmp = x / ((1.0 + y) * y) return tmp
function code(x, y) tmp = 0.0 if (x <= -6600000000.0) tmp = Float64(y / Float64(x * x)); else tmp = Float64(x / Float64(Float64(1.0 + y) * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -6600000000.0) tmp = y / (x * x); else tmp = x / ((1.0 + y) * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -6600000000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6600000000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\end{array}
\end{array}
if x < -6.6e9Initial program 61.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6472.7
Applied rewrites72.7%
if -6.6e9 < x Initial program 71.3%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6457.8
Applied rewrites57.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y y))))
(if (<= x -6800000000.0)
(/ y (* x x))
(if (<= x -2.4e-186) t_0 (if (<= x 7.2e-105) (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -6800000000.0) {
tmp = y / (x * x);
} else if (x <= -2.4e-186) {
tmp = t_0;
} else if (x <= 7.2e-105) {
tmp = x / y;
} 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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y * y)
if (x <= (-6800000000.0d0)) then
tmp = y / (x * x)
else if (x <= (-2.4d-186)) then
tmp = t_0
else if (x <= 7.2d-105) then
tmp = x / y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * y);
double tmp;
if (x <= -6800000000.0) {
tmp = y / (x * x);
} else if (x <= -2.4e-186) {
tmp = t_0;
} else if (x <= 7.2e-105) {
tmp = x / y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * y) tmp = 0 if x <= -6800000000.0: tmp = y / (x * x) elif x <= -2.4e-186: tmp = t_0 elif x <= 7.2e-105: tmp = x / y else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * y)) tmp = 0.0 if (x <= -6800000000.0) tmp = Float64(y / Float64(x * x)); elseif (x <= -2.4e-186) tmp = t_0; elseif (x <= 7.2e-105) tmp = Float64(x / y); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * y); tmp = 0.0; if (x <= -6800000000.0) tmp = y / (x * x); elseif (x <= -2.4e-186) tmp = t_0; elseif (x <= 7.2e-105) tmp = x / y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6800000000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.4e-186], t$95$0, If[LessEqual[x, 7.2e-105], N[(x / y), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot y}\\
\mathbf{if}\;x \leq -6800000000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-186}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-105}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.8e9Initial program 61.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6472.7
Applied rewrites72.7%
if -6.8e9 < x < -2.40000000000000003e-186 or 7.19999999999999929e-105 < x Initial program 74.7%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6436.4
Applied rewrites36.4%
if -2.40000000000000003e-186 < x < 7.19999999999999929e-105Initial program 64.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
Taylor expanded in y around 0
Applied rewrites70.6%
(FPCore (x y) :precision binary64 (if (<= y 1.0) (/ x y) (/ x (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.0d0) then
tmp = x / y
else
tmp = x / (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.0) {
tmp = x / y;
} else {
tmp = x / (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.0: tmp = x / y else: tmp = x / (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.0) tmp = Float64(x / y); else tmp = Float64(x / Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.0) tmp = x / y; else tmp = x / (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 1Initial program 71.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6441.3
Applied rewrites41.3%
Taylor expanded in y around 0
Applied rewrites26.4%
if 1 < y Initial program 62.1%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6471.6
Applied rewrites71.6%
(FPCore (x y) :precision binary64 (/ x y))
double code(double x, double y) {
return x / y;
}
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, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
public static double code(double x, double y) {
return x / y;
}
def code(x, y): return x / y
function code(x, y) return Float64(x / y) end
function tmp = code(x, y) tmp = x / y; end
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 68.9%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6449.1
Applied rewrites49.1%
Taylor expanded in y around 0
Applied rewrites26.8%
herbie shell --seed 2025101
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))