
(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 17 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 (/ (* (/ y (+ y x)) (/ x (+ y x))) (+ (+ y x) 1.0)))
double code(double x, double y) {
return ((y / (y + x)) * (x / (y + x))) / ((y + x) + 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 = ((y / (y + x)) * (x / (y + x))) / ((y + x) + 1.0d0)
end function
public static double code(double x, double y) {
return ((y / (y + x)) * (x / (y + x))) / ((y + x) + 1.0);
}
def code(x, y): return ((y / (y + x)) * (x / (y + x))) / ((y + x) + 1.0)
function code(x, y) return Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + x))) / Float64(Float64(y + x) + 1.0)) end
function tmp = code(x, y) tmp = ((y / (y + x)) * (x / (y + x))) / ((y + x) + 1.0); end
code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{y}{y + x} \cdot \frac{x}{y + x}}{\left(y + x\right) + 1}
\end{array}
Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
(FPCore (x y) :precision binary64 (* (/ (/ x (+ y x)) (+ y x)) (/ y (+ (+ y x) 1.0))))
double code(double x, double y) {
return ((x / (y + x)) / (y + x)) * (y / ((y + x) + 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 / ((y + x) + 1.0d0))
end function
public static double code(double x, double y) {
return ((x / (y + x)) / (y + x)) * (y / ((y + x) + 1.0));
}
def code(x, y): return ((x / (y + x)) / (y + x)) * (y / ((y + x) + 1.0))
function code(x, y) return Float64(Float64(Float64(x / Float64(y + x)) / Float64(y + x)) * Float64(y / Float64(Float64(y + x) + 1.0))) end
function tmp = code(x, y) tmp = ((x / (y + x)) / (y + x)) * (y / ((y + x) + 1.0)); end
code[x_, y_] := N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{x}{y + x}}{y + x} \cdot \frac{y}{\left(y + x\right) + 1}
\end{array}
Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.1
Applied rewrites88.1%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= y 2e-20)
(/ (* (/ y (+ y x)) (/ x (+ y x))) (+ 1.0 x))
(if (<= y 5.9e+128)
(* (/ x (* (+ y x) (+ y x))) (/ y t_0))
(/ (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 2e-20) {
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x);
} else if (y <= 5.9e+128) {
tmp = (x / ((y + x) * (y + x))) * (y / t_0);
} else {
tmp = (x / y) / 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 = (y + x) + 1.0d0
if (y <= 2d-20) then
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0d0 + x)
else if (y <= 5.9d+128) then
tmp = (x / ((y + x) * (y + x))) * (y / t_0)
else
tmp = (x / y) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 2e-20) {
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x);
} else if (y <= 5.9e+128) {
tmp = (x / ((y + x) * (y + x))) * (y / t_0);
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y <= 2e-20: tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x) elif y <= 5.9e+128: tmp = (x / ((y + x) * (y + x))) * (y / t_0) else: tmp = (x / y) / t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y <= 2e-20) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + x))) / Float64(1.0 + x)); elseif (y <= 5.9e+128) tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(y + x))) * Float64(y / t_0)); else tmp = Float64(Float64(x / y) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (y <= 2e-20) tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x); elseif (y <= 5.9e+128) tmp = (x / ((y + x) * (y + x))) * (y / t_0); else tmp = (x / y) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 2e-20], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.9e+128], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \leq 2 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{y + x}}{1 + x}\\
\mathbf{elif}\;y \leq 5.9 \cdot 10^{+128}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if y < 1.99999999999999989e-20Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
lower-+.f6474.5
Applied rewrites74.5%
if 1.99999999999999989e-20 < y < 5.89999999999999987e128Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.1
Applied rewrites88.1%
if 5.89999999999999987e128 < y Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= y 3400.0)
(/ (* (/ y (+ y x)) (/ x (+ y x))) (+ 1.0 x))
(if (<= y 6.5e+95)
(* x (/ y (* t_0 (* (+ y x) (+ y x)))))
(/ (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 3400.0) {
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x);
} else if (y <= 6.5e+95) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else {
tmp = (x / y) / 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 = (y + x) + 1.0d0
if (y <= 3400.0d0) then
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0d0 + x)
else if (y <= 6.5d+95) then
tmp = x * (y / (t_0 * ((y + x) * (y + x))))
else
tmp = (x / y) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 3400.0) {
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x);
} else if (y <= 6.5e+95) {
tmp = x * (y / (t_0 * ((y + x) * (y + x))));
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y <= 3400.0: tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x) elif y <= 6.5e+95: tmp = x * (y / (t_0 * ((y + x) * (y + x)))) else: tmp = (x / y) / t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y <= 3400.0) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + x))) / Float64(1.0 + x)); elseif (y <= 6.5e+95) tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / y) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (y <= 3400.0) tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x); elseif (y <= 6.5e+95) tmp = x * (y / (t_0 * ((y + x) * (y + x)))); else tmp = (x / y) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 3400.0], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.5e+95], N[(x * N[(y / N[(t$95$0 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \leq 3400:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{y + x}}{1 + x}\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+95}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if y < 3400Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
lower-+.f6474.5
Applied rewrites74.5%
if 3400 < y < 6.5e95Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6482.0
Applied rewrites82.0%
if 6.5e95 < y Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y) :precision binary64 (if (<= y 6500.0) (/ (* (/ y (+ y x)) (/ x (+ y x))) (+ 1.0 x)) (/ (/ x y) (+ (+ y x) 1.0))))
double code(double x, double y) {
double tmp;
if (y <= 6500.0) {
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x);
} else {
tmp = (x / y) / ((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 (y <= 6500.0d0) then
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0d0 + x)
else
tmp = (x / y) / ((y + x) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 6500.0) {
tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x);
} else {
tmp = (x / y) / ((y + x) + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 6500.0: tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x) else: tmp = (x / y) / ((y + x) + 1.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 6500.0) tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + x))) / Float64(1.0 + x)); else tmp = Float64(Float64(x / y) / Float64(Float64(y + x) + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 6500.0) tmp = ((y / (y + x)) * (x / (y + x))) / (1.0 + x); else tmp = (x / y) / ((y + x) + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 6500.0], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6500:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{y + x}}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{\left(y + x\right) + 1}\\
\end{array}
\end{array}
if y < 6500Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
lower-+.f6474.5
Applied rewrites74.5%
if 6500 < y Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y)
:precision binary64
(if (<= x -30000000000.0)
(* (/ (/ x (+ x y)) (+ x y)) (/ y x))
(if (<= x -8.5e-153)
(* (/ x (* (+ y x) (+ y x))) (/ y (+ 1.0 y)))
(/ (/ x (+ y x)) (+ (+ y x) 1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -30000000000.0) {
tmp = ((x / (x + y)) / (x + y)) * (y / x);
} else if (x <= -8.5e-153) {
tmp = (x / ((y + x) * (y + x))) * (y / (1.0 + y));
} else {
tmp = (x / (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 <= (-30000000000.0d0)) then
tmp = ((x / (x + y)) / (x + y)) * (y / x)
else if (x <= (-8.5d-153)) then
tmp = (x / ((y + x) * (y + x))) * (y / (1.0d0 + y))
else
tmp = (x / (y + x)) / ((y + x) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -30000000000.0) {
tmp = ((x / (x + y)) / (x + y)) * (y / x);
} else if (x <= -8.5e-153) {
tmp = (x / ((y + x) * (y + x))) * (y / (1.0 + y));
} else {
tmp = (x / (y + x)) / ((y + x) + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -30000000000.0: tmp = ((x / (x + y)) / (x + y)) * (y / x) elif x <= -8.5e-153: tmp = (x / ((y + x) * (y + x))) * (y / (1.0 + y)) else: tmp = (x / (y + x)) / ((y + x) + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -30000000000.0) tmp = Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + y)) * Float64(y / x)); elseif (x <= -8.5e-153) tmp = Float64(Float64(x / Float64(Float64(y + x) * Float64(y + x))) * Float64(y / Float64(1.0 + y))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(Float64(y + x) + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -30000000000.0) tmp = ((x / (x + y)) / (x + y)) * (y / x); elseif (x <= -8.5e-153) tmp = (x / ((y + x) * (y + x))) * (y / (1.0 + y)); else tmp = (x / (y + x)) / ((y + x) + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -30000000000.0], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.5e-153], N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -30000000000:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-153}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{1 + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\
\end{array}
\end{array}
if x < -3e10Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.1
Applied rewrites88.1%
Taylor expanded in x around inf
lower-/.f6446.7
Applied rewrites46.7%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6449.0
Applied rewrites49.0%
if -3e10 < x < -8.4999999999999996e-153Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.1
Applied rewrites88.1%
Taylor expanded in x around 0
lower-+.f6475.8
Applied rewrites75.8%
if -8.4999999999999996e-153 < x Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
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-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites52.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= y 3.5e-157)
(/ (/ y x) t_0)
(if (<= y 2.1e-19)
(* x (/ y (* (+ 1.0 x) (* (+ y x) (+ y x)))))
(/ (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 3.5e-157) {
tmp = (y / x) / t_0;
} else if (y <= 2.1e-19) {
tmp = x * (y / ((1.0 + x) * ((y + x) * (y + x))));
} else {
tmp = (x / y) / 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 = (y + x) + 1.0d0
if (y <= 3.5d-157) then
tmp = (y / x) / t_0
else if (y <= 2.1d-19) then
tmp = x * (y / ((1.0d0 + x) * ((y + x) * (y + x))))
else
tmp = (x / y) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 3.5e-157) {
tmp = (y / x) / t_0;
} else if (y <= 2.1e-19) {
tmp = x * (y / ((1.0 + x) * ((y + x) * (y + x))));
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y <= 3.5e-157: tmp = (y / x) / t_0 elif y <= 2.1e-19: tmp = x * (y / ((1.0 + x) * ((y + x) * (y + x)))) else: tmp = (x / y) / t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y <= 3.5e-157) tmp = Float64(Float64(y / x) / t_0); elseif (y <= 2.1e-19) tmp = Float64(x * Float64(y / Float64(Float64(1.0 + x) * Float64(Float64(y + x) * Float64(y + x))))); else tmp = Float64(Float64(x / y) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (y <= 3.5e-157) tmp = (y / x) / t_0; elseif (y <= 2.1e-19) tmp = x * (y / ((1.0 + x) * ((y + x) * (y + x)))); else tmp = (x / y) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 3.5e-157], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y, 2.1e-19], N[(x * N[(y / N[(N[(1.0 + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \leq 3.5 \cdot 10^{-157}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{-19}:\\
\;\;\;\;x \cdot \frac{y}{\left(1 + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if y < 3.5000000000000002e-157Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6449.4
Applied rewrites49.4%
if 3.5000000000000002e-157 < y < 2.0999999999999999e-19Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6482.0
Applied rewrites82.0%
Taylor expanded in y around 0
lower-+.f6471.7
Applied rewrites71.7%
if 2.0999999999999999e-19 < y Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y)
:precision binary64
(if (<= x -26000000000.0)
(* (/ (/ x (+ x y)) (+ x y)) (/ y x))
(if (<= x -1.35e-152)
(/ (* y x) (* (* (+ y x) (+ y x)) (+ 1.0 y)))
(/ (/ x (+ y x)) (+ (+ y x) 1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -26000000000.0) {
tmp = ((x / (x + y)) / (x + y)) * (y / x);
} else if (x <= -1.35e-152) {
tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + y));
} else {
tmp = (x / (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 <= (-26000000000.0d0)) then
tmp = ((x / (x + y)) / (x + y)) * (y / x)
else if (x <= (-1.35d-152)) then
tmp = (y * x) / (((y + x) * (y + x)) * (1.0d0 + y))
else
tmp = (x / (y + x)) / ((y + x) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -26000000000.0) {
tmp = ((x / (x + y)) / (x + y)) * (y / x);
} else if (x <= -1.35e-152) {
tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + y));
} else {
tmp = (x / (y + x)) / ((y + x) + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -26000000000.0: tmp = ((x / (x + y)) / (x + y)) * (y / x) elif x <= -1.35e-152: tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + y)) else: tmp = (x / (y + x)) / ((y + x) + 1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -26000000000.0) tmp = Float64(Float64(Float64(x / Float64(x + y)) / Float64(x + y)) * Float64(y / x)); elseif (x <= -1.35e-152) tmp = Float64(Float64(y * x) / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(1.0 + y))); else tmp = Float64(Float64(x / Float64(y + x)) / Float64(Float64(y + x) + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -26000000000.0) tmp = ((x / (x + y)) / (x + y)) * (y / x); elseif (x <= -1.35e-152) tmp = (y * x) / (((y + x) * (y + x)) * (1.0 + y)); else tmp = (x / (y + x)) / ((y + x) + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -26000000000.0], N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.35e-152], N[(N[(y * x), $MachinePrecision] / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -26000000000:\\
\;\;\;\;\frac{\frac{x}{x + y}}{x + y} \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-152}:\\
\;\;\;\;\frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(1 + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\
\end{array}
\end{array}
if x < -2.6e10Initial program 69.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
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6488.1
Applied rewrites88.1%
Taylor expanded in x around inf
lower-/.f6446.7
Applied rewrites46.7%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6449.0
Applied rewrites49.0%
if -2.6e10 < x < -1.34999999999999999e-152Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-+.f6462.1
Applied rewrites62.1%
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-*.f6459.7
Applied rewrites59.7%
if -1.34999999999999999e-152 < x Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
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-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites52.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (+ y x) 1.0)))
(if (<= y 1.65e-129)
(/ (/ y x) t_0)
(if (<= y 7.2e-56)
(/ (* x y) (* (* (+ x y) (+ x y)) (+ 1.0 x)))
(/ (/ x y) t_0)))))
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 1.65e-129) {
tmp = (y / x) / t_0;
} else if (y <= 7.2e-56) {
tmp = (x * y) / (((x + y) * (x + y)) * (1.0 + x));
} else {
tmp = (x / y) / 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 = (y + x) + 1.0d0
if (y <= 1.65d-129) then
tmp = (y / x) / t_0
else if (y <= 7.2d-56) then
tmp = (x * y) / (((x + y) * (x + y)) * (1.0d0 + x))
else
tmp = (x / y) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 1.65e-129) {
tmp = (y / x) / t_0;
} else if (y <= 7.2e-56) {
tmp = (x * y) / (((x + y) * (x + y)) * (1.0 + x));
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y <= 1.65e-129: tmp = (y / x) / t_0 elif y <= 7.2e-56: tmp = (x * y) / (((x + y) * (x + y)) * (1.0 + x)) else: tmp = (x / y) / t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y <= 1.65e-129) tmp = Float64(Float64(y / x) / t_0); elseif (y <= 7.2e-56) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(1.0 + x))); else tmp = Float64(Float64(x / y) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (y <= 1.65e-129) tmp = (y / x) / t_0; elseif (y <= 7.2e-56) tmp = (x * y) / (((x + y) * (x + y)) * (1.0 + x)); else tmp = (x / y) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 1.65e-129], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y, 7.2e-56], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \leq 1.65 \cdot 10^{-129}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-56}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if y < 1.64999999999999994e-129Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6449.4
Applied rewrites49.4%
if 1.64999999999999994e-129 < y < 7.19999999999999956e-56Initial program 69.5%
Taylor expanded in y around 0
lower-+.f6459.1
Applied rewrites59.1%
if 7.19999999999999956e-56 < y Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ (+ y x) 1.0))) (if (<= y 3.6e-100) (/ (/ y x) t_0) (/ (/ x y) t_0))))
double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 3.6e-100) {
tmp = (y / x) / t_0;
} else {
tmp = (x / y) / 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 = (y + x) + 1.0d0
if (y <= 3.6d-100) then
tmp = (y / x) / t_0
else
tmp = (x / y) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y + x) + 1.0;
double tmp;
if (y <= 3.6e-100) {
tmp = (y / x) / t_0;
} else {
tmp = (x / y) / t_0;
}
return tmp;
}
def code(x, y): t_0 = (y + x) + 1.0 tmp = 0 if y <= 3.6e-100: tmp = (y / x) / t_0 else: tmp = (x / y) / t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y + x) + 1.0) tmp = 0.0 if (y <= 3.6e-100) tmp = Float64(Float64(y / x) / t_0); else tmp = Float64(Float64(x / y) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = (y + x) + 1.0; tmp = 0.0; if (y <= 3.6e-100) tmp = (y / x) / t_0; else tmp = (x / y) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[y, 3.6e-100], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;y \leq 3.6 \cdot 10^{-100}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{t\_0}\\
\end{array}
\end{array}
if y < 3.5999999999999999e-100Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6449.4
Applied rewrites49.4%
if 3.5999999999999999e-100 < y Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-/.f6452.0
Applied rewrites52.0%
(FPCore (x y) :precision binary64 (if (<= y 2.55e-70) (/ (/ y x) (+ (+ y x) 1.0)) (if (<= y 7.5e+155) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (y <= 2.55e-70) {
tmp = (y / x) / ((y + x) + 1.0);
} else if (y <= 7.5e+155) {
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 <= 2.55d-70) then
tmp = (y / x) / ((y + x) + 1.0d0)
else if (y <= 7.5d+155) 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 <= 2.55e-70) {
tmp = (y / x) / ((y + x) + 1.0);
} else if (y <= 7.5e+155) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.55e-70: tmp = (y / x) / ((y + x) + 1.0) elif y <= 7.5e+155: tmp = x / ((1.0 + y) * y) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 2.55e-70) tmp = Float64(Float64(y / x) / Float64(Float64(y + x) + 1.0)); elseif (y <= 7.5e+155) 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 <= 2.55e-70) tmp = (y / x) / ((y + x) + 1.0); elseif (y <= 7.5e+155) tmp = x / ((1.0 + y) * y); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.55e-70], N[(N[(y / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+155], 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 2.55 \cdot 10^{-70}:\\
\;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) + 1}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+155}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 2.55000000000000013e-70Initial program 69.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-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.4
Applied rewrites74.4%
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
lower-/.f64N/A
lift-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6449.4
Applied rewrites49.4%
if 2.55000000000000013e-70 < y < 7.4999999999999999e155Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6450.0
Applied rewrites50.0%
if 7.4999999999999999e155 < y Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
(FPCore (x y)
:precision binary64
(if (<= y -24000000000.0)
(/ (/ y x) x)
(if (<= y 3.6e-100)
(/ y (* (+ 1.0 x) x))
(if (<= y 7.5e+155) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y)))))
double code(double x, double y) {
double tmp;
if (y <= -24000000000.0) {
tmp = (y / x) / x;
} else if (y <= 3.6e-100) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 7.5e+155) {
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 <= (-24000000000.0d0)) then
tmp = (y / x) / x
else if (y <= 3.6d-100) then
tmp = y / ((1.0d0 + x) * x)
else if (y <= 7.5d+155) 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 <= -24000000000.0) {
tmp = (y / x) / x;
} else if (y <= 3.6e-100) {
tmp = y / ((1.0 + x) * x);
} else if (y <= 7.5e+155) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -24000000000.0: tmp = (y / x) / x elif y <= 3.6e-100: tmp = y / ((1.0 + x) * x) elif y <= 7.5e+155: tmp = x / ((1.0 + y) * y) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= -24000000000.0) tmp = Float64(Float64(y / x) / x); elseif (y <= 3.6e-100) tmp = Float64(y / Float64(Float64(1.0 + x) * x)); elseif (y <= 7.5e+155) 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 <= -24000000000.0) tmp = (y / x) / x; elseif (y <= 3.6e-100) tmp = y / ((1.0 + x) * x); elseif (y <= 7.5e+155) tmp = x / ((1.0 + y) * y); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -24000000000.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 3.6e-100], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+155], 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 -24000000000:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{-100}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+155}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < -2.4e10Initial program 69.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6437.1
Applied rewrites37.1%
if -2.4e10 < y < 3.5999999999999999e-100Initial program 69.5%
Taylor expanded in y around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6447.9
Applied rewrites47.9%
if 3.5999999999999999e-100 < y < 7.4999999999999999e155Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6450.0
Applied rewrites50.0%
if 7.4999999999999999e155 < y Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
(FPCore (x y) :precision binary64 (if (<= x -7.2e+46) (/ (/ y x) x) (if (<= x 2.1e+23) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (x <= -7.2e+46) {
tmp = (y / x) / x;
} else if (x <= 2.1e+23) {
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 (x <= (-7.2d+46)) then
tmp = (y / x) / x
else if (x <= 2.1d+23) 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 (x <= -7.2e+46) {
tmp = (y / x) / x;
} else if (x <= 2.1e+23) {
tmp = x / ((1.0 + y) * y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.2e+46: tmp = (y / x) / x elif x <= 2.1e+23: tmp = x / ((1.0 + y) * y) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (x <= -7.2e+46) tmp = Float64(Float64(y / x) / x); elseif (x <= 2.1e+23) 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 (x <= -7.2e+46) tmp = (y / x) / x; elseif (x <= 2.1e+23) tmp = x / ((1.0 + y) * y); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.2e+46], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 2.1e+23], 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}\;x \leq -7.2 \cdot 10^{+46}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+23}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -7.1999999999999997e46Initial program 69.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6437.1
Applied rewrites37.1%
if -7.1999999999999997e46 < x < 2.1000000000000001e23Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6450.0
Applied rewrites50.0%
if 2.1000000000000001e23 < x Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
(FPCore (x y) :precision binary64 (if (<= y 52000.0) (/ (/ y x) x) (/ (/ x y) y)))
double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = (y / x) / x;
} 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 <= 52000.0d0) then
tmp = (y / x) / x
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = (y / x) / x;
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 52000.0: tmp = (y / x) / x else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 52000.0) tmp = Float64(Float64(y / x) / x); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 52000.0) tmp = (y / x) / x; else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 52000.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 52000:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 52000Initial program 69.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6435.9
Applied rewrites35.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6437.1
Applied rewrites37.1%
if 52000 < y Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
(FPCore (x y) :precision binary64 (if (<= y 52000.0) (/ y (* x x)) (/ (/ x y) y)))
double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = y / (x * x);
} 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 <= 52000.0d0) then
tmp = y / (x * x)
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = y / (x * x);
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 52000.0: tmp = y / (x * x) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 52000.0) tmp = Float64(y / Float64(x * x)); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 52000.0) tmp = y / (x * x); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 52000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 52000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 52000Initial program 69.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6435.9
Applied rewrites35.9%
if 52000 < y Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6439.3
Applied rewrites39.3%
(FPCore (x y) :precision binary64 (if (<= y 52000.0) (/ y (* x x)) (/ x (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = y / (x * x);
} 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 <= 52000.0d0) then
tmp = y / (x * x)
else
tmp = x / (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = y / (x * x);
} else {
tmp = x / (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 52000.0: tmp = y / (x * x) else: tmp = x / (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 52000.0) tmp = Float64(y / Float64(x * x)); else tmp = Float64(x / Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 52000.0) tmp = y / (x * x); else tmp = x / (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 52000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 52000:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 52000Initial program 69.5%
Taylor expanded in x around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6435.9
Applied rewrites35.9%
if 52000 < y Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
(FPCore (x y) :precision binary64 (/ x (* y y)))
double code(double x, double y) {
return x / (y * 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 * y)
end function
public static double code(double x, double y) {
return x / (y * y);
}
def code(x, y): return x / (y * y)
function code(x, y) return Float64(x / Float64(y * y)) end
function tmp = code(x, y) tmp = x / (y * y); end
code[x_, y_] := N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y \cdot y}
\end{array}
Initial program 69.5%
Taylor expanded in y around inf
lower-/.f64N/A
unpow2N/A
lower-*.f6437.5
Applied rewrites37.5%
herbie shell --seed 2025142
(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))))