
(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}
Sampling outcomes in binary64 precision:
Herbie found 19 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 (+ 1.0 (+ y x))) (+ y x))))
double code(double x, double y) {
return (x / (y + x)) * ((y / (1.0 + (y + x))) / (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 / (1.0d0 + (y + x))) / (y + x))
end function
public static double code(double x, double y) {
return (x / (y + x)) * ((y / (1.0 + (y + x))) / (y + x));
}
def code(x, y): return (x / (y + x)) * ((y / (1.0 + (y + x))) / (y + x))
function code(x, y) return Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / Float64(1.0 + Float64(y + x))) / Float64(y + x))) end
function tmp = code(x, y) tmp = (x / (y + x)) * ((y / (1.0 + (y + x))) / (y + x)); end
code[x_, y_] := N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y + x} \cdot \frac{\frac{y}{1 + \left(y + x\right)}}{y + x}
\end{array}
Initial program 66.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(* 1.0 (/ (/ y (+ 1.0 (+ y x))) (+ y x)))
(if (<= x -2e+41)
(* (/ y (fma (+ 1.0 x) x (* (fma 2.0 x 1.0) y))) 1.0)
(if (<= x -4.2e-143)
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0)))
(* (/ x (+ y x)) (pow (+ 1.0 y) -1.0))))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / (1.0 + (y + x))) / (y + x));
} else if (x <= -2e+41) {
tmp = (y / fma((1.0 + x), x, (fma(2.0, x, 1.0) * y))) * 1.0;
} else if (x <= -4.2e-143) {
tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
} else {
tmp = (x / (y + x)) * pow((1.0 + y), -1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(1.0 * Float64(Float64(y / Float64(1.0 + Float64(y + x))) / Float64(y + x))); elseif (x <= -2e+41) tmp = Float64(Float64(y / fma(Float64(1.0 + x), x, Float64(fma(2.0, x, 1.0) * y))) * 1.0); elseif (x <= -4.2e-143) tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0))); else tmp = Float64(Float64(x / Float64(y + x)) * (Float64(1.0 + y) ^ -1.0)); end return tmp end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(1.0 * N[(N[(y / N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2e+41], N[(N[(y / N[(N[(1.0 + x), $MachinePrecision] * x + N[(N[(2.0 * x + 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x, -4.2e-143], 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], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[Power[N[(1.0 + y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;1 \cdot \frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{+41}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(1 + x, x, \mathsf{fma}\left(2, x, 1\right) \cdot y\right)} \cdot 1\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-143}:\\
\;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot {\left(1 + y\right)}^{-1}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites81.4%
if -6.00000000000000048e220 < x < -2.00000000000000001e41Initial program 62.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6490.8
lift-+.f64N/A
+-commutativeN/A
Applied rewrites90.8%
Taylor expanded in x around inf
Applied rewrites82.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.4
Applied rewrites79.4%
if -2.00000000000000001e41 < x < -4.2000000000000002e-143Initial program 89.2%
if -4.2000000000000002e-143 < x Initial program 63.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6462.1
Applied rewrites62.1%
Final simplification70.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ y x))) (t_1 (+ 1.0 (+ y x))))
(if (<= x -6e+220)
(* 1.0 (/ (/ y t_1) (+ y x)))
(if (<= x 6.8e-208)
(* y (/ t_0 (* t_1 (+ y x))))
(* t_0 (pow (+ 1.0 y) -1.0))))))
double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = 1.0 + (y + x);
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / t_1) / (y + x));
} else if (x <= 6.8e-208) {
tmp = y * (t_0 / (t_1 * (y + x)));
} else {
tmp = t_0 * pow((1.0 + y), -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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y + x)
t_1 = 1.0d0 + (y + x)
if (x <= (-6d+220)) then
tmp = 1.0d0 * ((y / t_1) / (y + x))
else if (x <= 6.8d-208) then
tmp = y * (t_0 / (t_1 * (y + x)))
else
tmp = t_0 * ((1.0d0 + y) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y + x);
double t_1 = 1.0 + (y + x);
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / t_1) / (y + x));
} else if (x <= 6.8e-208) {
tmp = y * (t_0 / (t_1 * (y + x)));
} else {
tmp = t_0 * Math.pow((1.0 + y), -1.0);
}
return tmp;
}
def code(x, y): t_0 = x / (y + x) t_1 = 1.0 + (y + x) tmp = 0 if x <= -6e+220: tmp = 1.0 * ((y / t_1) / (y + x)) elif x <= 6.8e-208: tmp = y * (t_0 / (t_1 * (y + x))) else: tmp = t_0 * math.pow((1.0 + y), -1.0) return tmp
function code(x, y) t_0 = Float64(x / Float64(y + x)) t_1 = Float64(1.0 + Float64(y + x)) tmp = 0.0 if (x <= -6e+220) tmp = Float64(1.0 * Float64(Float64(y / t_1) / Float64(y + x))); elseif (x <= 6.8e-208) tmp = Float64(y * Float64(t_0 / Float64(t_1 * Float64(y + x)))); else tmp = Float64(t_0 * (Float64(1.0 + y) ^ -1.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y + x); t_1 = 1.0 + (y + x); tmp = 0.0; if (x <= -6e+220) tmp = 1.0 * ((y / t_1) / (y + x)); elseif (x <= 6.8e-208) tmp = y * (t_0 / (t_1 * (y + x))); else tmp = t_0 * ((1.0 + y) ^ -1.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e+220], N[(1.0 * N[(N[(y / t$95$1), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e-208], N[(y * N[(t$95$0 / N[(t$95$1 * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[(1.0 + y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
t_1 := 1 + \left(y + x\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;1 \cdot \frac{\frac{y}{t\_1}}{y + x}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-208}:\\
\;\;\;\;y \cdot \frac{t\_0}{t\_1 \cdot \left(y + x\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\left(1 + y\right)}^{-1}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites81.4%
if -6.00000000000000048e220 < x < 6.8e-208Initial program 70.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6494.3
Applied rewrites94.3%
if 6.8e-208 < x Initial program 65.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6446.7
Applied rewrites46.7%
Final simplification74.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (+ y x))))
(if (<= x -6e+220)
(* 1.0 (/ (/ y t_0) (+ y x)))
(if (<= x -3.2e-129)
(* (/ y (* t_0 (+ y x))) 1.0)
(* (/ x (+ y x)) (pow (+ 1.0 y) -1.0))))))
double code(double x, double y) {
double t_0 = 1.0 + (y + x);
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / t_0) / (y + x));
} else if (x <= -3.2e-129) {
tmp = (y / (t_0 * (y + x))) * 1.0;
} else {
tmp = (x / (y + x)) * pow((1.0 + y), -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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (y + x)
if (x <= (-6d+220)) then
tmp = 1.0d0 * ((y / t_0) / (y + x))
else if (x <= (-3.2d-129)) then
tmp = (y / (t_0 * (y + x))) * 1.0d0
else
tmp = (x / (y + x)) * ((1.0d0 + y) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (y + x);
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / t_0) / (y + x));
} else if (x <= -3.2e-129) {
tmp = (y / (t_0 * (y + x))) * 1.0;
} else {
tmp = (x / (y + x)) * Math.pow((1.0 + y), -1.0);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (y + x) tmp = 0 if x <= -6e+220: tmp = 1.0 * ((y / t_0) / (y + x)) elif x <= -3.2e-129: tmp = (y / (t_0 * (y + x))) * 1.0 else: tmp = (x / (y + x)) * math.pow((1.0 + y), -1.0) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(y + x)) tmp = 0.0 if (x <= -6e+220) tmp = Float64(1.0 * Float64(Float64(y / t_0) / Float64(y + x))); elseif (x <= -3.2e-129) tmp = Float64(Float64(y / Float64(t_0 * Float64(y + x))) * 1.0); else tmp = Float64(Float64(x / Float64(y + x)) * (Float64(1.0 + y) ^ -1.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (y + x); tmp = 0.0; if (x <= -6e+220) tmp = 1.0 * ((y / t_0) / (y + x)); elseif (x <= -3.2e-129) tmp = (y / (t_0 * (y + x))) * 1.0; else tmp = (x / (y + x)) * ((1.0 + y) ^ -1.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e+220], N[(1.0 * N[(N[(y / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.2e-129], N[(N[(y / N[(t$95$0 * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[Power[N[(1.0 + y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left(y + x\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;1 \cdot \frac{\frac{y}{t\_0}}{y + x}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{t\_0 \cdot \left(y + x\right)} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot {\left(1 + y\right)}^{-1}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites81.4%
if -6.00000000000000048e220 < x < -3.2000000000000003e-129Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6496.0
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.0%
Taylor expanded in x around inf
Applied rewrites74.4%
if -3.2000000000000003e-129 < x Initial program 64.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
Final simplification67.5%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(/ (/ y x) x)
(if (<= x -3.2e-129)
(* (/ y (* (+ 1.0 (+ y x)) (+ y x))) 1.0)
(* (/ x (+ y x)) (pow (+ 1.0 y) -1.0)))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = (y / x) / x;
} else if (x <= -3.2e-129) {
tmp = (y / ((1.0 + (y + x)) * (y + x))) * 1.0;
} else {
tmp = (x / (y + x)) * pow((1.0 + y), -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 <= (-6d+220)) then
tmp = (y / x) / x
else if (x <= (-3.2d-129)) then
tmp = (y / ((1.0d0 + (y + x)) * (y + x))) * 1.0d0
else
tmp = (x / (y + x)) * ((1.0d0 + y) ** (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = (y / x) / x;
} else if (x <= -3.2e-129) {
tmp = (y / ((1.0 + (y + x)) * (y + x))) * 1.0;
} else {
tmp = (x / (y + x)) * Math.pow((1.0 + y), -1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -6e+220: tmp = (y / x) / x elif x <= -3.2e-129: tmp = (y / ((1.0 + (y + x)) * (y + x))) * 1.0 else: tmp = (x / (y + x)) * math.pow((1.0 + y), -1.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(Float64(y / x) / x); elseif (x <= -3.2e-129) tmp = Float64(Float64(y / Float64(Float64(1.0 + Float64(y + x)) * Float64(y + x))) * 1.0); else tmp = Float64(Float64(x / Float64(y + x)) * (Float64(1.0 + y) ^ -1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -6e+220) tmp = (y / x) / x; elseif (x <= -3.2e-129) tmp = (y / ((1.0 + (y + x)) * (y + x))) * 1.0; else tmp = (x / (y + x)) * ((1.0 + y) ^ -1.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -3.2e-129], N[(N[(y / N[(N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[Power[N[(1.0 + y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{\left(1 + \left(y + x\right)\right) \cdot \left(y + x\right)} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y + x} \cdot {\left(1 + y\right)}^{-1}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if -6.00000000000000048e220 < x < -3.2000000000000003e-129Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6496.0
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.0%
Taylor expanded in x around inf
Applied rewrites74.4%
if -3.2000000000000003e-129 < x Initial program 64.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6462.8
Applied rewrites62.8%
Final simplification67.4%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(/ (/ (- y (* y (/ (fma 3.0 y 1.0) x))) x) x)
(if (<= x 3.6e-39)
(* (/ y (* (+ 1.0 (+ y x)) (+ y x))) (/ x (+ y x)))
(/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = ((y - (y * (fma(3.0, y, 1.0) / x))) / x) / x;
} else if (x <= 3.6e-39) {
tmp = (y / ((1.0 + (y + x)) * (y + x))) * (x / (y + x));
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(Float64(Float64(y - Float64(y * Float64(fma(3.0, y, 1.0) / x))) / x) / x); elseif (x <= 3.6e-39) tmp = Float64(Float64(y / Float64(Float64(1.0 + Float64(y + x)) * Float64(y + x))) * Float64(x / Float64(y + x))); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(N[(N[(y - N[(y * N[(N[(3.0 * y + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 3.6e-39], N[(N[(y / N[(N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{y - y \cdot \frac{\mathsf{fma}\left(3, y, 1\right)}{x}}{x}}{x}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{\left(1 + \left(y + x\right)\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites79.7%
if -6.00000000000000048e220 < x < 3.6000000000000001e-39Initial program 71.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6498.2
lift-+.f64N/A
+-commutativeN/A
Applied rewrites98.2%
if 3.6000000000000001e-39 < x Initial program 58.8%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (+ y x))))
(if (<= x -6e+220)
(* 1.0 (/ (/ y t_0) (+ y x)))
(if (<= x 3.6e-39)
(* (/ y (* t_0 (+ y x))) (/ x (+ y x)))
(/ (/ x y) y)))))
double code(double x, double y) {
double t_0 = 1.0 + (y + x);
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / t_0) / (y + x));
} else if (x <= 3.6e-39) {
tmp = (y / (t_0 * (y + x))) * (x / (y + 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (y + x)
if (x <= (-6d+220)) then
tmp = 1.0d0 * ((y / t_0) / (y + x))
else if (x <= 3.6d-39) then
tmp = (y / (t_0 * (y + x))) * (x / (y + x))
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (y + x);
double tmp;
if (x <= -6e+220) {
tmp = 1.0 * ((y / t_0) / (y + x));
} else if (x <= 3.6e-39) {
tmp = (y / (t_0 * (y + x))) * (x / (y + x));
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (y + x) tmp = 0 if x <= -6e+220: tmp = 1.0 * ((y / t_0) / (y + x)) elif x <= 3.6e-39: tmp = (y / (t_0 * (y + x))) * (x / (y + x)) else: tmp = (x / y) / y return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(y + x)) tmp = 0.0 if (x <= -6e+220) tmp = Float64(1.0 * Float64(Float64(y / t_0) / Float64(y + x))); elseif (x <= 3.6e-39) tmp = Float64(Float64(y / Float64(t_0 * Float64(y + x))) * Float64(x / Float64(y + x))); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (y + x); tmp = 0.0; if (x <= -6e+220) tmp = 1.0 * ((y / t_0) / (y + x)); elseif (x <= 3.6e-39) tmp = (y / (t_0 * (y + x))) * (x / (y + x)); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6e+220], N[(1.0 * N[(N[(y / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e-39], N[(N[(y / N[(t$95$0 * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left(y + x\right)\\
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;1 \cdot \frac{\frac{y}{t\_0}}{y + x}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{t\_0 \cdot \left(y + x\right)} \cdot \frac{x}{y + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites81.4%
if -6.00000000000000048e220 < x < 3.6000000000000001e-39Initial program 71.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6498.2
lift-+.f64N/A
+-commutativeN/A
Applied rewrites98.2%
if 3.6000000000000001e-39 < x Initial program 58.8%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.3
Applied rewrites34.3%
(FPCore (x y)
:precision binary64
(if (<= x -1.1e+111)
(* 1.0 (/ (/ y (+ 1.0 (+ y x))) (+ y x)))
(if (<= x 5.8e+38)
(* x (/ (/ y (+ x y)) (* (+ (+ 1.0 x) y) (+ x y))))
(/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (x <= -1.1e+111) {
tmp = 1.0 * ((y / (1.0 + (y + x))) / (y + x));
} else if (x <= 5.8e+38) {
tmp = x * ((y / (x + y)) / (((1.0 + x) + y) * (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 (x <= (-1.1d+111)) then
tmp = 1.0d0 * ((y / (1.0d0 + (y + x))) / (y + x))
else if (x <= 5.8d+38) then
tmp = x * ((y / (x + y)) / (((1.0d0 + x) + y) * (x + y)))
else
tmp = (x / y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.1e+111) {
tmp = 1.0 * ((y / (1.0 + (y + x))) / (y + x));
} else if (x <= 5.8e+38) {
tmp = x * ((y / (x + y)) / (((1.0 + x) + y) * (x + y)));
} else {
tmp = (x / y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.1e+111: tmp = 1.0 * ((y / (1.0 + (y + x))) / (y + x)) elif x <= 5.8e+38: tmp = x * ((y / (x + y)) / (((1.0 + x) + y) * (x + y))) else: tmp = (x / y) / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.1e+111) tmp = Float64(1.0 * Float64(Float64(y / Float64(1.0 + Float64(y + x))) / Float64(y + x))); elseif (x <= 5.8e+38) tmp = Float64(x * Float64(Float64(y / Float64(x + y)) / Float64(Float64(Float64(1.0 + x) + y) * Float64(x + y)))); else tmp = Float64(Float64(x / y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.1e+111) tmp = 1.0 * ((y / (1.0 + (y + x))) / (y + x)); elseif (x <= 5.8e+38) tmp = x * ((y / (x + y)) / (((1.0 + x) + y) * (x + y))); else tmp = (x / y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.1e+111], N[(1.0 * N[(N[(y / N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.8e+38], N[(x * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(1.0 + x), $MachinePrecision] + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+111}:\\
\;\;\;\;1 \cdot \frac{\frac{y}{1 + \left(y + x\right)}}{y + x}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+38}:\\
\;\;\;\;x \cdot \frac{\frac{y}{x + y}}{\left(\left(1 + x\right) + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -1.09999999999999999e111Initial program 47.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites81.3%
if -1.09999999999999999e111 < x < 5.80000000000000013e38Initial program 75.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lower-*.f6498.0
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-+.f64N/A
lower-+.f6498.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.0
Applied rewrites98.0%
if 5.80000000000000013e38 < x Initial program 46.2%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6426.7
Applied rewrites26.7%
(FPCore (x y) :precision binary64 (if (<= y 1.25e-19) (* (/ y (* (+ 1.0 x) (+ y x))) (/ x (+ y x))) (* x (/ (/ 1.0 (+ 1.0 (+ y x))) (+ y x)))))
double code(double x, double y) {
double tmp;
if (y <= 1.25e-19) {
tmp = (y / ((1.0 + x) * (y + x))) * (x / (y + x));
} else {
tmp = x * ((1.0 / (1.0 + (y + x))) / (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.25d-19) then
tmp = (y / ((1.0d0 + x) * (y + x))) * (x / (y + x))
else
tmp = x * ((1.0d0 / (1.0d0 + (y + x))) / (y + x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.25e-19) {
tmp = (y / ((1.0 + x) * (y + x))) * (x / (y + x));
} else {
tmp = x * ((1.0 / (1.0 + (y + x))) / (y + x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.25e-19: tmp = (y / ((1.0 + x) * (y + x))) * (x / (y + x)) else: tmp = x * ((1.0 / (1.0 + (y + x))) / (y + x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.25e-19) tmp = Float64(Float64(y / Float64(Float64(1.0 + x) * Float64(y + x))) * Float64(x / Float64(y + x))); else tmp = Float64(x * Float64(Float64(1.0 / Float64(1.0 + Float64(y + x))) / Float64(y + x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.25e-19) tmp = (y / ((1.0 + x) * (y + x))) * (x / (y + x)); else tmp = x * ((1.0 / (1.0 + (y + x))) / (y + x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.25e-19], N[(N[(y / N[(N[(1.0 + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.25 \cdot 10^{-19}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{1}{1 + \left(y + x\right)}}{y + x}\\
\end{array}
\end{array}
if y < 1.2500000000000001e-19Initial program 66.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6496.8
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.8%
Taylor expanded in y around 0
lower-+.f6480.4
Applied rewrites80.4%
if 1.2500000000000001e-19 < y Initial program 65.8%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.8
Applied rewrites88.9%
Taylor expanded in x around 0
Applied rewrites86.1%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(/ (/ y x) x)
(if (<= x -1.8e-6)
(* (/ y (* (+ 1.0 x) (+ y x))) 1.0)
(if (<= x -3.2e-129)
(* (/ y (* (+ 1.0 y) (+ y x))) 1.0)
(if (<= x 5.2e+32) (/ x (fma y y y)) (/ (/ x y) y))))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = (y / x) / x;
} else if (x <= -1.8e-6) {
tmp = (y / ((1.0 + x) * (y + x))) * 1.0;
} else if (x <= -3.2e-129) {
tmp = (y / ((1.0 + y) * (y + x))) * 1.0;
} else if (x <= 5.2e+32) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(Float64(y / x) / x); elseif (x <= -1.8e-6) tmp = Float64(Float64(y / Float64(Float64(1.0 + x) * Float64(y + x))) * 1.0); elseif (x <= -3.2e-129) tmp = Float64(Float64(y / Float64(Float64(1.0 + y) * Float64(y + x))) * 1.0); elseif (x <= 5.2e+32) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -1.8e-6], N[(N[(y / N[(N[(1.0 + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x, -3.2e-129], N[(N[(y / N[(N[(1.0 + y), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x, 5.2e+32], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{-6}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot \left(y + x\right)} \cdot 1\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{\left(1 + y\right) \cdot \left(y + x\right)} \cdot 1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if -6.00000000000000048e220 < x < -1.79999999999999992e-6Initial program 67.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6493.2
lift-+.f64N/A
+-commutativeN/A
Applied rewrites93.2%
Taylor expanded in x around inf
Applied rewrites78.4%
Taylor expanded in y around 0
lower-+.f6476.0
Applied rewrites76.0%
if -1.79999999999999992e-6 < x < -3.2000000000000003e-129Initial program 90.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites68.8%
Taylor expanded in x around 0
lower-+.f6468.8
Applied rewrites68.8%
if -3.2000000000000003e-129 < x < 5.2000000000000004e32Initial program 70.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.1
Applied rewrites76.1%
if 5.2000000000000004e32 < x Initial program 47.4%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6426.8
Applied rewrites26.8%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(/ (/ y x) x)
(if (<= x -3.2e-129)
(* (/ y (* (+ 1.0 (+ y x)) (+ y x))) 1.0)
(if (<= x 5.2e+32) (/ x (fma y y y)) (/ (/ x y) y)))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = (y / x) / x;
} else if (x <= -3.2e-129) {
tmp = (y / ((1.0 + (y + x)) * (y + x))) * 1.0;
} else if (x <= 5.2e+32) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(Float64(y / x) / x); elseif (x <= -3.2e-129) tmp = Float64(Float64(y / Float64(Float64(1.0 + Float64(y + x)) * Float64(y + x))) * 1.0); elseif (x <= 5.2e+32) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -3.2e-129], N[(N[(y / N[(N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x, 5.2e+32], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{\left(1 + \left(y + x\right)\right) \cdot \left(y + x\right)} \cdot 1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if -6.00000000000000048e220 < x < -3.2000000000000003e-129Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6496.0
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.0%
Taylor expanded in x around inf
Applied rewrites74.4%
if -3.2000000000000003e-129 < x < 5.2000000000000004e32Initial program 70.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.1
Applied rewrites76.1%
if 5.2000000000000004e32 < x Initial program 47.4%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6426.8
Applied rewrites26.8%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(/ (/ y x) x)
(if (<= x -3.2e-129)
(* y (/ 1.0 (* (+ (+ 1.0 x) y) (+ x y))))
(if (<= x 5.2e+32) (/ x (fma y y y)) (/ (/ x y) y)))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = (y / x) / x;
} else if (x <= -3.2e-129) {
tmp = y * (1.0 / (((1.0 + x) + y) * (x + y)));
} else if (x <= 5.2e+32) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(Float64(y / x) / x); elseif (x <= -3.2e-129) tmp = Float64(y * Float64(1.0 / Float64(Float64(Float64(1.0 + x) + y) * Float64(x + y)))); elseif (x <= 5.2e+32) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -3.2e-129], N[(y * N[(1.0 / N[(N[(N[(1.0 + x), $MachinePrecision] + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e+32], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-129}:\\
\;\;\;\;y \cdot \frac{1}{\left(\left(1 + x\right) + y\right) \cdot \left(x + y\right)}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if -6.00000000000000048e220 < x < -3.2000000000000003e-129Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6496.0
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.0%
Taylor expanded in x around inf
Applied rewrites74.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6474.4
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-+.f64N/A
lift-+.f6474.4
lift-+.f64N/A
+-commutativeN/A
lift-+.f6474.4
Applied rewrites74.4%
if -3.2000000000000003e-129 < x < 5.2000000000000004e32Initial program 70.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.1
Applied rewrites76.1%
if 5.2000000000000004e32 < x Initial program 47.4%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6426.8
Applied rewrites26.8%
(FPCore (x y)
:precision binary64
(if (<= y 2.05e-153)
(/ y (fma x x x))
(if (<= y 8.5e+154)
(* x (/ 1.0 (* (+ (+ 1.0 x) y) (+ x y))))
(/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (y <= 2.05e-153) {
tmp = y / fma(x, x, x);
} else if (y <= 8.5e+154) {
tmp = x * (1.0 / (((1.0 + x) + y) * (x + y)));
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 2.05e-153) tmp = Float64(y / fma(x, x, x)); elseif (y <= 8.5e+154) tmp = Float64(x * Float64(1.0 / Float64(Float64(Float64(1.0 + x) + y) * Float64(x + y)))); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[y, 2.05e-153], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e+154], N[(x * N[(1.0 / N[(N[(N[(1.0 + x), $MachinePrecision] + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.05 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{1}{\left(\left(1 + x\right) + y\right) \cdot \left(x + y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 2.05e-153Initial program 66.4%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6453.1
Applied rewrites53.1%
if 2.05e-153 < y < 8.5000000000000002e154Initial program 69.4%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6493.1
Applied rewrites93.2%
Taylor expanded in x around 0
Applied rewrites79.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lower-/.f6479.9
lift-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-+.f64N/A
lift-+.f6479.9
lift-+.f64N/A
+-commutativeN/A
lift-+.f6479.9
Applied rewrites79.9%
if 8.5000000000000002e154 < y Initial program 61.1%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6491.3
Applied rewrites91.3%
(FPCore (x y)
:precision binary64
(if (<= x -6e+220)
(/ (/ y x) x)
(if (<= x -2e-128)
(* (/ y (* (+ 1.0 x) (+ y x))) 1.0)
(if (<= x 5.2e+32) (/ x (fma y y y)) (/ (/ x y) y)))))
double code(double x, double y) {
double tmp;
if (x <= -6e+220) {
tmp = (y / x) / x;
} else if (x <= -2e-128) {
tmp = (y / ((1.0 + x) * (y + x))) * 1.0;
} else if (x <= 5.2e+32) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -6e+220) tmp = Float64(Float64(y / x) / x); elseif (x <= -2e-128) tmp = Float64(Float64(y / Float64(Float64(1.0 + x) * Float64(y + x))) * 1.0); elseif (x <= 5.2e+32) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[x, -6e+220], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, -2e-128], N[(N[(y / N[(N[(1.0 + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x, 5.2e+32], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+220}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-128}:\\
\;\;\;\;\frac{y}{\left(1 + x\right) \cdot \left(y + x\right)} \cdot 1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if x < -6.00000000000000048e220Initial program 42.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
if -6.00000000000000048e220 < x < -2.00000000000000011e-128Initial program 77.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
times-fracN/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
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6496.0
lift-+.f64N/A
+-commutativeN/A
Applied rewrites96.0%
Taylor expanded in x around inf
Applied rewrites74.4%
Taylor expanded in y around 0
lower-+.f6458.1
Applied rewrites58.1%
if -2.00000000000000011e-128 < x < 5.2000000000000004e32Initial program 70.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6476.1
Applied rewrites76.1%
if 5.2000000000000004e32 < x Initial program 47.4%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6426.8
Applied rewrites26.8%
(FPCore (x y) :precision binary64 (if (<= y 6.2e-142) (/ y (fma x x x)) (if (<= y 450000000000.0) (/ x (fma y y y)) (/ (/ x y) y))))
double code(double x, double y) {
double tmp;
if (y <= 6.2e-142) {
tmp = y / fma(x, x, x);
} else if (y <= 450000000000.0) {
tmp = x / fma(y, y, y);
} else {
tmp = (x / y) / y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 6.2e-142) tmp = Float64(y / fma(x, x, x)); elseif (y <= 450000000000.0) tmp = Float64(x / fma(y, y, y)); else tmp = Float64(Float64(x / y) / y); end return tmp end
code[x_, y_] := If[LessEqual[y, 6.2e-142], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 450000000000.0], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{-142}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{elif}\;y \leq 450000000000:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y}\\
\end{array}
\end{array}
if y < 6.2e-142Initial program 66.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6453.1
Applied rewrites53.1%
if 6.2e-142 < y < 4.5e11Initial program 76.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6456.1
Applied rewrites56.1%
if 4.5e11 < y Initial program 63.1%
Taylor expanded in y around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6477.2
Applied rewrites77.2%
(FPCore (x y) :precision binary64 (if (<= y 6.2e-142) (/ y (fma x x x)) (/ x (fma y y y))))
double code(double x, double y) {
double tmp;
if (y <= 6.2e-142) {
tmp = y / fma(x, x, x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 6.2e-142) tmp = Float64(y / fma(x, x, x)); else tmp = Float64(x / fma(y, y, y)); end return tmp end
code[x_, y_] := If[LessEqual[y, 6.2e-142], N[(y / N[(x * x + x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{-142}:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if y < 6.2e-142Initial program 66.3%
Taylor expanded in y around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6453.1
Applied rewrites53.1%
if 6.2e-142 < y Initial program 66.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6468.4
Applied rewrites68.4%
(FPCore (x y) :precision binary64 (if (<= x -700.0) (/ y (* x x)) (/ x (fma y y y))))
double code(double x, double y) {
double tmp;
if (x <= -700.0) {
tmp = y / (x * x);
} else {
tmp = x / fma(y, y, y);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -700.0) tmp = Float64(y / Float64(x * x)); else tmp = Float64(x / fma(y, y, y)); end return tmp end
code[x_, y_] := If[LessEqual[x, -700.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -700:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
\end{array}
\end{array}
if x < -700Initial program 59.1%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6471.6
Applied rewrites71.6%
Applied rewrites70.4%
if -700 < x Initial program 68.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6461.8
Applied rewrites61.8%
(FPCore (x y) :precision binary64 (if (<= y 2.6e+18) (/ y (* x x)) (/ x (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.6e+18) {
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 <= 2.6d+18) 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 <= 2.6e+18) {
tmp = y / (x * x);
} else {
tmp = x / (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.6e+18: tmp = y / (x * x) else: tmp = x / (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.6e+18) 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 <= 2.6e+18) tmp = y / (x * x); else tmp = x / (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.6e+18], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\
\end{array}
\end{array}
if y < 2.6e18Initial program 67.5%
Taylor expanded in x around inf
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.1
Applied rewrites34.1%
Applied rewrites35.1%
if 2.6e18 < y Initial program 63.1%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6473.1
Applied rewrites73.1%
Taylor expanded in y around inf
Applied rewrites73.1%
(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 66.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6452.8
Applied rewrites52.8%
Taylor expanded in y around inf
Applied rewrites40.4%
(FPCore (x y) :precision binary64 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (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 + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y): return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y) return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x)))) end
function tmp = code(x, y) tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x))); end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}
herbie shell --seed 2024352
(FPCore (x y)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))
(/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))