
(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]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
Herbie found 23 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]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))) (t_1 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) 2e-34)
(* (/ (fmin x y) t_1) (/ (/ (fmax x y) (- (fmin x y) -1.0)) t_1))
(/
(/ (* (/ (fmax x y) (- (fmax x y) (- -1.0 (fmin x y)))) (fmin x y)) t_0)
t_0))))double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double t_1 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 2e-34) {
tmp = (fmin(x, y) / t_1) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_1);
} else {
tmp = (((fmax(x, y) / (fmax(x, y) - (-1.0 - fmin(x, y)))) * fmin(x, y)) / t_0) / 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) :: t_1
real(8) :: tmp
t_0 = fmax(x, y) + fmin(x, y)
t_1 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= 2d-34) then
tmp = (fmin(x, y) / t_1) * ((fmax(x, y) / (fmin(x, y) - (-1.0d0))) / t_1)
else
tmp = (((fmax(x, y) / (fmax(x, y) - ((-1.0d0) - fmin(x, y)))) * fmin(x, y)) / t_0) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double t_1 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 2e-34) {
tmp = (fmin(x, y) / t_1) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_1);
} else {
tmp = (((fmax(x, y) / (fmax(x, y) - (-1.0 - fmin(x, y)))) * fmin(x, y)) / t_0) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) t_1 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= 2e-34: tmp = (fmin(x, y) / t_1) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_1) else: tmp = (((fmax(x, y) / (fmax(x, y) - (-1.0 - fmin(x, y)))) * fmin(x, y)) / t_0) / t_0 return tmp
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) t_1 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= 2e-34) tmp = Float64(Float64(fmin(x, y) / t_1) * Float64(Float64(fmax(x, y) / Float64(fmin(x, y) - -1.0)) / t_1)); else tmp = Float64(Float64(Float64(Float64(fmax(x, y) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y)))) * fmin(x, y)) / t_0) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) + min(x, y); t_1 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= 2e-34) tmp = (min(x, y) / t_1) * ((max(x, y) / (min(x, y) - -1.0)) / t_1); else tmp = (((max(x, y) / (max(x, y) - (-1.0 - min(x, y)))) * min(x, y)) / t_0) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 2e-34], N[(N[(N[Min[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
t_1 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 2 \cdot 10^{-34}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{t\_1} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) - -1}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)} \cdot \mathsf{min}\left(x, y\right)}{t\_0}}{t\_0}\\
\end{array}
if y < 1.99999999999999986e-34Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites75.1%
if 1.99999999999999986e-34 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites88.2%
(FPCore (x y) :precision binary64 (let* ((t_0 (- (- x) y))) (* (/ y t_0) (/ (/ x t_0) (- y (- -1.0 x))))))
double code(double x, double y) {
double t_0 = -x - y;
return (y / t_0) * ((x / t_0) / (y - (-1.0 - 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
real(8) :: t_0
t_0 = -x - y
code = (y / t_0) * ((x / t_0) / (y - ((-1.0d0) - x)))
end function
public static double code(double x, double y) {
double t_0 = -x - y;
return (y / t_0) * ((x / t_0) / (y - (-1.0 - x)));
}
def code(x, y): t_0 = -x - y return (y / t_0) * ((x / t_0) / (y - (-1.0 - x)))
function code(x, y) t_0 = Float64(Float64(-x) - y) return Float64(Float64(y / t_0) * Float64(Float64(x / t_0) / Float64(y - Float64(-1.0 - x)))) end
function tmp = code(x, y) t_0 = -x - y; tmp = (y / t_0) * ((x / t_0) / (y - (-1.0 - x))); end
code[x_, y_] := Block[{t$95$0 = N[((-x) - y), $MachinePrecision]}, N[(N[(y / t$95$0), $MachinePrecision] * N[(N[(x / t$95$0), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(-x\right) - y\\
\frac{y}{t\_0} \cdot \frac{\frac{x}{t\_0}}{y - \left(-1 - x\right)}
\end{array}
Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (fmax x y) (- -1.0 (fmin x y))))
(t_1 (+ (fmax x y) (fmin x y)))
(t_2 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) 5e-31)
(* (/ (fmin x y) t_2) (/ (/ (fmax x y) (- (fmin x y) -1.0)) t_2))
(if (<= (fmax x y) 2.15e+170)
(* (/ (fmax x y) t_0) (/ (fmin x y) (* t_1 t_1)))
(* -1.0 (/ (/ (fmin x y) (- (- (fmin x y)) (fmax x y))) t_0))))))double code(double x, double y) {
double t_0 = fmax(x, y) - (-1.0 - fmin(x, y));
double t_1 = fmax(x, y) + fmin(x, y);
double t_2 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 5e-31) {
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2);
} else if (fmax(x, y) <= 2.15e+170) {
tmp = (fmax(x, y) / t_0) * (fmin(x, y) / (t_1 * t_1));
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(x, y) - ((-1.0d0) - fmin(x, y))
t_1 = fmax(x, y) + fmin(x, y)
t_2 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= 5d-31) then
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - (-1.0d0))) / t_2)
else if (fmax(x, y) <= 2.15d+170) then
tmp = (fmax(x, y) / t_0) * (fmin(x, y) / (t_1 * t_1))
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) - (-1.0 - fmin(x, y));
double t_1 = fmax(x, y) + fmin(x, y);
double t_2 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 5e-31) {
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2);
} else if (fmax(x, y) <= 2.15e+170) {
tmp = (fmax(x, y) / t_0) * (fmin(x, y) / (t_1 * t_1));
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_0);
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) - (-1.0 - fmin(x, y)) t_1 = fmax(x, y) + fmin(x, y) t_2 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= 5e-31: tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2) elif fmax(x, y) <= 2.15e+170: tmp = (fmax(x, y) / t_0) * (fmin(x, y) / (t_1 * t_1)) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_0) return tmp
function code(x, y) t_0 = Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))) t_1 = Float64(fmax(x, y) + fmin(x, y)) t_2 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= 5e-31) tmp = Float64(Float64(fmin(x, y) / t_2) * Float64(Float64(fmax(x, y) / Float64(fmin(x, y) - -1.0)) / t_2)); elseif (fmax(x, y) <= 2.15e+170) tmp = Float64(Float64(fmax(x, y) / t_0) * Float64(fmin(x, y) / Float64(t_1 * t_1))); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / t_0)); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) - (-1.0 - min(x, y)); t_1 = max(x, y) + min(x, y); t_2 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= 5e-31) tmp = (min(x, y) / t_2) * ((max(x, y) / (min(x, y) - -1.0)) / t_2); elseif (max(x, y) <= 2.15e+170) tmp = (max(x, y) / t_0) * (min(x, y) / (t_1 * t_1)); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / t_0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 5e-31], N[(N[(N[Min[x, y], $MachinePrecision] / t$95$2), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 2.15e+170], N[(N[(N[Max[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)\\
t_1 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
t_2 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 5 \cdot 10^{-31}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{t\_2} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) - -1}}{t\_2}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 2.15 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{t\_0} \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_1 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{t\_0}\\
\end{array}
if y < 5e-31Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites75.1%
if 5e-31 < y < 2.1499999999999999e170Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
add-flipN/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
metadata-evalN/A
lower-/.f6487.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6487.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6487.8
Applied rewrites87.8%
if 2.1499999999999999e170 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y)))
(t_1 (- (fmax x y) (- -1.0 (fmin x y))))
(t_2 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) 1e-42)
(* (/ (fmin x y) t_2) (/ (/ (fmax x y) (- (fmin x y) -1.0)) t_2))
(if (<= (fmax x y) 2.15e+170)
(* (/ (fmax x y) (* t_0 t_0)) (/ (fmin x y) t_1))
(* -1.0 (/ (/ (fmin x y) (- (- (fmin x y)) (fmax x y))) t_1))))))double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double t_1 = fmax(x, y) - (-1.0 - fmin(x, y));
double t_2 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 1e-42) {
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2);
} else if (fmax(x, y) <= 2.15e+170) {
tmp = (fmax(x, y) / (t_0 * t_0)) * (fmin(x, y) / t_1);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_1);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, 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) :: t_2
real(8) :: tmp
t_0 = fmax(x, y) + fmin(x, y)
t_1 = fmax(x, y) - ((-1.0d0) - fmin(x, y))
t_2 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= 1d-42) then
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - (-1.0d0))) / t_2)
else if (fmax(x, y) <= 2.15d+170) then
tmp = (fmax(x, y) / (t_0 * t_0)) * (fmin(x, y) / t_1)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_1)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double t_1 = fmax(x, y) - (-1.0 - fmin(x, y));
double t_2 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 1e-42) {
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2);
} else if (fmax(x, y) <= 2.15e+170) {
tmp = (fmax(x, y) / (t_0 * t_0)) * (fmin(x, y) / t_1);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_1);
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) t_1 = fmax(x, y) - (-1.0 - fmin(x, y)) t_2 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= 1e-42: tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2) elif fmax(x, y) <= 2.15e+170: tmp = (fmax(x, y) / (t_0 * t_0)) * (fmin(x, y) / t_1) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_1) return tmp
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) t_1 = Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))) t_2 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= 1e-42) tmp = Float64(Float64(fmin(x, y) / t_2) * Float64(Float64(fmax(x, y) / Float64(fmin(x, y) - -1.0)) / t_2)); elseif (fmax(x, y) <= 2.15e+170) tmp = Float64(Float64(fmax(x, y) / Float64(t_0 * t_0)) * Float64(fmin(x, y) / t_1)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / t_1)); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) + min(x, y); t_1 = max(x, y) - (-1.0 - min(x, y)); t_2 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= 1e-42) tmp = (min(x, y) / t_2) * ((max(x, y) / (min(x, y) - -1.0)) / t_2); elseif (max(x, y) <= 2.15e+170) tmp = (max(x, y) / (t_0 * t_0)) * (min(x, y) / t_1); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / t_1); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 1e-42], N[(N[(N[Min[x, y], $MachinePrecision] / t$95$2), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 2.15e+170], N[(N[(N[Max[x, y], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
t_1 := \mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)\\
t_2 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 10^{-42}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{t\_2} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) - -1}}{t\_2}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 2.15 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{t\_0 \cdot t\_0} \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{t\_1}\\
\end{array}
if y < 1.00000000000000004e-42Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites75.1%
if 1.00000000000000004e-42 < y < 2.1499999999999999e170Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6487.8
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
add-flipN/A
associate-+l-N/A
lower--.f64N/A
lower--.f64N/A
metadata-eval87.8
Applied rewrites87.8%
if 2.1499999999999999e170 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (fmax x y) (- -1.0 (fmin x y))))
(t_1 (+ (fmax x y) (fmin x y)))
(t_2 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) 5e-31)
(* (/ (fmin x y) t_2) (/ (/ (fmax x y) (- (fmin x y) -1.0)) t_2))
(if (<= (fmax x y) 1.36e+105)
(* (/ (fmax x y) (* t_0 (* t_1 t_1))) (fmin x y))
(* -1.0 (/ (/ (fmin x y) (- (- (fmin x y)) (fmax x y))) t_0))))))double code(double x, double y) {
double t_0 = fmax(x, y) - (-1.0 - fmin(x, y));
double t_1 = fmax(x, y) + fmin(x, y);
double t_2 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 5e-31) {
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / (t_0 * (t_1 * t_1))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = fmax(x, y) - ((-1.0d0) - fmin(x, y))
t_1 = fmax(x, y) + fmin(x, y)
t_2 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= 5d-31) then
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - (-1.0d0))) / t_2)
else if (fmax(x, y) <= 1.36d+105) then
tmp = (fmax(x, y) / (t_0 * (t_1 * t_1))) * fmin(x, y)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) - (-1.0 - fmin(x, y));
double t_1 = fmax(x, y) + fmin(x, y);
double t_2 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 5e-31) {
tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / (t_0 * (t_1 * t_1))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_0);
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) - (-1.0 - fmin(x, y)) t_1 = fmax(x, y) + fmin(x, y) t_2 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= 5e-31: tmp = (fmin(x, y) / t_2) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_2) elif fmax(x, y) <= 1.36e+105: tmp = (fmax(x, y) / (t_0 * (t_1 * t_1))) * fmin(x, y) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / t_0) return tmp
function code(x, y) t_0 = Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))) t_1 = Float64(fmax(x, y) + fmin(x, y)) t_2 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= 5e-31) tmp = Float64(Float64(fmin(x, y) / t_2) * Float64(Float64(fmax(x, y) / Float64(fmin(x, y) - -1.0)) / t_2)); elseif (fmax(x, y) <= 1.36e+105) tmp = Float64(Float64(fmax(x, y) / Float64(t_0 * Float64(t_1 * t_1))) * fmin(x, y)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / t_0)); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) - (-1.0 - min(x, y)); t_1 = max(x, y) + min(x, y); t_2 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= 5e-31) tmp = (min(x, y) / t_2) * ((max(x, y) / (min(x, y) - -1.0)) / t_2); elseif (max(x, y) <= 1.36e+105) tmp = (max(x, y) / (t_0 * (t_1 * t_1))) * min(x, y); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / t_0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 5e-31], N[(N[(N[Min[x, y], $MachinePrecision] / t$95$2), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.36e+105], N[(N[(N[Max[x, y], $MachinePrecision] / N[(t$95$0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)\\
t_1 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
t_2 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 5 \cdot 10^{-31}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{t\_2} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) - -1}}{t\_2}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.36 \cdot 10^{+105}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{t\_0 \cdot \left(t\_1 \cdot t\_1\right)} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{t\_0}\\
\end{array}
if y < 5e-31Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites75.1%
if 5e-31 < y < 1.3599999999999999e105Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.5%
if 1.3599999999999999e105 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) -4.8e+36)
(/ (/ (fmax x y) (fmin x y)) (+ (fmax x y) (fmin x y)))
(if (<= (fmax x y) 0.0013)
(/ (* (/ (fmin x y) t_0) (fmax x y)) (* (- (fmin x y) -1.0) t_0))
(if (<= (fmax x y) 1.36e+105)
(* (/ (fmax x y) (* (- (fmax x y) -1.0) (* t_0 t_0))) (fmin x y))
(*
-1.0
(/
(/ (fmin x y) (- (- (fmin x y)) (fmax x y)))
(- (fmax x y) (- -1.0 (fmin x y))))))))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= -4.8e+36) {
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 0.0013) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / ((fmin(x, y) - -1.0) * t_0);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, 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 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= (-4.8d+36)) then
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y))
else if (fmax(x, y) <= 0.0013d0) then
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / ((fmin(x, y) - (-1.0d0)) * t_0)
else if (fmax(x, y) <= 1.36d+105) then
tmp = (fmax(x, y) / ((fmax(x, y) - (-1.0d0)) * (t_0 * t_0))) * fmin(x, y)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - ((-1.0d0) - fmin(x, y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= -4.8e+36) {
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 0.0013) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / ((fmin(x, y) - -1.0) * t_0);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y))));
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= -4.8e+36: tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y)) elif fmax(x, y) <= 0.0013: tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / ((fmin(x, y) - -1.0) * t_0) elif fmax(x, y) <= 1.36e+105: tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y)))) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= -4.8e+36) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) / Float64(fmax(x, y) + fmin(x, y))); elseif (fmax(x, y) <= 0.0013) tmp = Float64(Float64(Float64(fmin(x, y) / t_0) * fmax(x, y)) / Float64(Float64(fmin(x, y) - -1.0) * t_0)); elseif (fmax(x, y) <= 1.36e+105) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(fmax(x, y) - -1.0) * Float64(t_0 * t_0))) * fmin(x, y)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= -4.8e+36) tmp = (max(x, y) / min(x, y)) / (max(x, y) + min(x, y)); elseif (max(x, y) <= 0.0013) tmp = ((min(x, y) / t_0) * max(x, y)) / ((min(x, y) - -1.0) * t_0); elseif (max(x, y) <= 1.36e+105) tmp = (max(x, y) / ((max(x, y) - -1.0) * (t_0 * t_0))) * min(x, y); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / (max(x, y) - (-1.0 - min(x, y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], -4.8e+36], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 0.0013], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.36e+105], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -4.8 \cdot 10^{+36}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 0.0013:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_0} \cdot \mathsf{max}\left(x, y\right)}{\left(\mathsf{min}\left(x, y\right) - -1\right) \cdot t\_0}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.36 \cdot 10^{+105}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(\mathsf{max}\left(x, y\right) - -1\right) \cdot \left(t\_0 \cdot t\_0\right)} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)}\\
\end{array}
if y < -4.79999999999999985e36Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
if -4.79999999999999985e36 < y < 0.0012999999999999999Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.8%
if 0.0012999999999999999 < y < 1.3599999999999999e105Initial program 68.3%
Taylor expanded in x around 0
lower-+.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6475.2
Applied rewrites75.2%
if 1.3599999999999999e105 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) 0.0013)
(* (/ (fmin x y) t_0) (/ (/ (fmax x y) (- (fmin x y) -1.0)) t_0))
(if (<= (fmax x y) 1.36e+105)
(* (/ (fmax x y) (* (- (fmax x y) -1.0) (* t_0 t_0))) (fmin x y))
(*
-1.0
(/
(/ (fmin x y) (- (- (fmin x y)) (fmax x y)))
(- (fmax x y) (- -1.0 (fmin x y)))))))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 0.0013) {
tmp = (fmin(x, y) / t_0) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_0);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, 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 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= 0.0013d0) then
tmp = (fmin(x, y) / t_0) * ((fmax(x, y) / (fmin(x, y) - (-1.0d0))) / t_0)
else if (fmax(x, y) <= 1.36d+105) then
tmp = (fmax(x, y) / ((fmax(x, y) - (-1.0d0)) * (t_0 * t_0))) * fmin(x, y)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - ((-1.0d0) - fmin(x, y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= 0.0013) {
tmp = (fmin(x, y) / t_0) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_0);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y))));
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= 0.0013: tmp = (fmin(x, y) / t_0) * ((fmax(x, y) / (fmin(x, y) - -1.0)) / t_0) elif fmax(x, y) <= 1.36e+105: tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y)))) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= 0.0013) tmp = Float64(Float64(fmin(x, y) / t_0) * Float64(Float64(fmax(x, y) / Float64(fmin(x, y) - -1.0)) / t_0)); elseif (fmax(x, y) <= 1.36e+105) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(fmax(x, y) - -1.0) * Float64(t_0 * t_0))) * fmin(x, y)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= 0.0013) tmp = (min(x, y) / t_0) * ((max(x, y) / (min(x, y) - -1.0)) / t_0); elseif (max(x, y) <= 1.36e+105) tmp = (max(x, y) / ((max(x, y) - -1.0) * (t_0 * t_0))) * min(x, y); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / (max(x, y) - (-1.0 - min(x, y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 0.0013], N[(N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.36e+105], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 0.0013:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{t\_0} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) - -1}}{t\_0}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.36 \cdot 10^{+105}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(\mathsf{max}\left(x, y\right) - -1\right) \cdot \left(t\_0 \cdot t\_0\right)} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)}\\
\end{array}
if y < 0.0012999999999999999Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
lower-*.f64N/A
Applied rewrites75.1%
if 0.0012999999999999999 < y < 1.3599999999999999e105Initial program 68.3%
Taylor expanded in x around 0
lower-+.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6475.2
Applied rewrites75.2%
if 1.3599999999999999e105 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))) (t_1 (+ (fmax x y) (fmin x y))))
(if (<= (fmax x y) 0.0013)
(* (/ (fmin x y) (- (fmin x y) -1.0)) (/ (/ (fmax x y) t_1) t_1))
(if (<= (fmax x y) 1.36e+105)
(* (/ (fmax x y) (* (- (fmax x y) -1.0) (* t_0 t_0))) (fmin x y))
(*
-1.0
(/
(/ (fmin x y) (- (- (fmin x y)) (fmax x y)))
(- (fmax x y) (- -1.0 (fmin x y)))))))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double t_1 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= 0.0013) {
tmp = (fmin(x, y) / (fmin(x, y) - -1.0)) * ((fmax(x, y) / t_1) / t_1);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, 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) :: t_1
real(8) :: tmp
t_0 = fmin(x, y) + fmax(x, y)
t_1 = fmax(x, y) + fmin(x, y)
if (fmax(x, y) <= 0.0013d0) then
tmp = (fmin(x, y) / (fmin(x, y) - (-1.0d0))) * ((fmax(x, y) / t_1) / t_1)
else if (fmax(x, y) <= 1.36d+105) then
tmp = (fmax(x, y) / ((fmax(x, y) - (-1.0d0)) * (t_0 * t_0))) * fmin(x, y)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - ((-1.0d0) - fmin(x, y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double t_1 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= 0.0013) {
tmp = (fmin(x, y) / (fmin(x, y) - -1.0)) * ((fmax(x, y) / t_1) / t_1);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y))));
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) t_1 = fmax(x, y) + fmin(x, y) tmp = 0 if fmax(x, y) <= 0.0013: tmp = (fmin(x, y) / (fmin(x, y) - -1.0)) * ((fmax(x, y) / t_1) / t_1) elif fmax(x, y) <= 1.36e+105: tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y)))) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) t_1 = Float64(fmax(x, y) + fmin(x, y)) tmp = 0.0 if (fmax(x, y) <= 0.0013) tmp = Float64(Float64(fmin(x, y) / Float64(fmin(x, y) - -1.0)) * Float64(Float64(fmax(x, y) / t_1) / t_1)); elseif (fmax(x, y) <= 1.36e+105) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(fmax(x, y) - -1.0) * Float64(t_0 * t_0))) * fmin(x, y)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); t_1 = max(x, y) + min(x, y); tmp = 0.0; if (max(x, y) <= 0.0013) tmp = (min(x, y) / (min(x, y) - -1.0)) * ((max(x, y) / t_1) / t_1); elseif (max(x, y) <= 1.36e+105) tmp = (max(x, y) / ((max(x, y) - -1.0) * (t_0 * t_0))) * min(x, y); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / (max(x, y) - (-1.0 - min(x, y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 0.0013], N[(N[(N[Min[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.36e+105], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
t_1 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 0.0013:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\mathsf{min}\left(x, y\right) - -1} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{t\_1}}{t\_1}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.36 \cdot 10^{+105}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(\mathsf{max}\left(x, y\right) - -1\right) \cdot \left(t\_0 \cdot t\_0\right)} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)}\\
\end{array}
if y < 0.0012999999999999999Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.8%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6475.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6475.0
Applied rewrites75.0%
if 0.0012999999999999999 < y < 1.3599999999999999e105Initial program 68.3%
Taylor expanded in x around 0
lower-+.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6475.2
Applied rewrites75.2%
if 1.3599999999999999e105 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))) (t_1 (* t_0 t_0)))
(if (<= (fmax x y) -9.5e-277)
(/ (/ (fmax x y) (+ 1.0 (fmin x y))) (+ (fmax x y) (fmin x y)))
(if (<= (fmax x y) 1.6e-172)
(/ (* (/ (fmin x y) t_0) (fmax x y)) (* 1.0 t_0))
(if (<= (fmax x y) 0.0235)
(* (fmax x y) (/ (fmin x y) (* (- (fmin x y) -1.0) t_1)))
(if (<= (fmax x y) 1.36e+105)
(* (/ (fmax x y) (* (- (fmax x y) -1.0) t_1)) (fmin x y))
(*
-1.0
(/
(/ (fmin x y) (- (- (fmin x y)) (fmax x y)))
(- (fmax x y) (- -1.0 (fmin x y)))))))))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double t_1 = t_0 * t_0;
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.6e-172) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else if (fmax(x, y) <= 0.0235) {
tmp = fmax(x, y) * (fmin(x, y) / ((fmin(x, y) - -1.0) * t_1));
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * t_1)) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, 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) :: t_1
real(8) :: tmp
t_0 = fmin(x, y) + fmax(x, y)
t_1 = t_0 * t_0
if (fmax(x, y) <= (-9.5d-277)) then
tmp = (fmax(x, y) / (1.0d0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y))
else if (fmax(x, y) <= 1.6d-172) then
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0d0 * t_0)
else if (fmax(x, y) <= 0.0235d0) then
tmp = fmax(x, y) * (fmin(x, y) / ((fmin(x, y) - (-1.0d0)) * t_1))
else if (fmax(x, y) <= 1.36d+105) then
tmp = (fmax(x, y) / ((fmax(x, y) - (-1.0d0)) * t_1)) * fmin(x, y)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - ((-1.0d0) - fmin(x, y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double t_1 = t_0 * t_0;
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.6e-172) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else if (fmax(x, y) <= 0.0235) {
tmp = fmax(x, y) * (fmin(x, y) / ((fmin(x, y) - -1.0) * t_1));
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * t_1)) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y))));
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) t_1 = t_0 * t_0 tmp = 0 if fmax(x, y) <= -9.5e-277: tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y)) elif fmax(x, y) <= 1.6e-172: tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0) elif fmax(x, y) <= 0.0235: tmp = fmax(x, y) * (fmin(x, y) / ((fmin(x, y) - -1.0) * t_1)) elif fmax(x, y) <= 1.36e+105: tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * t_1)) * fmin(x, y) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y)))) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) t_1 = Float64(t_0 * t_0) tmp = 0.0 if (fmax(x, y) <= -9.5e-277) tmp = Float64(Float64(fmax(x, y) / Float64(1.0 + fmin(x, y))) / Float64(fmax(x, y) + fmin(x, y))); elseif (fmax(x, y) <= 1.6e-172) tmp = Float64(Float64(Float64(fmin(x, y) / t_0) * fmax(x, y)) / Float64(1.0 * t_0)); elseif (fmax(x, y) <= 0.0235) tmp = Float64(fmax(x, y) * Float64(fmin(x, y) / Float64(Float64(fmin(x, y) - -1.0) * t_1))); elseif (fmax(x, y) <= 1.36e+105) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(fmax(x, y) - -1.0) * t_1)) * fmin(x, y)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); t_1 = t_0 * t_0; tmp = 0.0; if (max(x, y) <= -9.5e-277) tmp = (max(x, y) / (1.0 + min(x, y))) / (max(x, y) + min(x, y)); elseif (max(x, y) <= 1.6e-172) tmp = ((min(x, y) / t_0) * max(x, y)) / (1.0 * t_0); elseif (max(x, y) <= 0.0235) tmp = max(x, y) * (min(x, y) / ((min(x, y) - -1.0) * t_1)); elseif (max(x, y) <= 1.36e+105) tmp = (max(x, y) / ((max(x, y) - -1.0) * t_1)) * min(x, y); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / (max(x, y) - (-1.0 - min(x, y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * t$95$0), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], -9.5e-277], N[(N[(N[Max[x, y], $MachinePrecision] / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.6e-172], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(1.0 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 0.0235], N[(N[Max[x, y], $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / N[(N[(N[Min[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.36e+105], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
t_1 := t\_0 \cdot t\_0\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -9.5 \cdot 10^{-277}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{1 + \mathsf{min}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.6 \cdot 10^{-172}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_0} \cdot \mathsf{max}\left(x, y\right)}{1 \cdot t\_0}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 0.0235:\\
\;\;\;\;\mathsf{max}\left(x, y\right) \cdot \frac{\mathsf{min}\left(x, y\right)}{\left(\mathsf{min}\left(x, y\right) - -1\right) \cdot t\_1}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.36 \cdot 10^{+105}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(\mathsf{max}\left(x, y\right) - -1\right) \cdot t\_1} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)}\\
\end{array}
if y < -9.5e-277Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if -9.5e-277 < y < 1.6000000000000001e-172Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.8%
Taylor expanded in x around 0
Applied rewrites50.8%
if 1.6000000000000001e-172 < y < 0.0235Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6475.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.0
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6475.0
Applied rewrites75.0%
if 0.0235 < y < 1.3599999999999999e105Initial program 68.3%
Taylor expanded in x around 0
lower-+.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6475.2
Applied rewrites75.2%
if 1.3599999999999999e105 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) -9.5e-277)
(/ (/ (fmax x y) (+ 1.0 (fmin x y))) (+ (fmax x y) (fmin x y)))
(if (<= (fmax x y) 1.6e-172)
(/ (* (/ (fmin x y) t_0) (fmax x y)) (* 1.0 t_0))
(if (<= (fmax x y) 1.36e+105)
(* (/ (fmax x y) (* (- (fmax x y) -1.0) (* t_0 t_0))) (fmin x y))
(*
-1.0
(/
(/ (fmin x y) (- (- (fmin x y)) (fmax x y)))
(- (fmax x y) (- -1.0 (fmin x y))))))))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.6e-172) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, 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 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= (-9.5d-277)) then
tmp = (fmax(x, y) / (1.0d0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y))
else if (fmax(x, y) <= 1.6d-172) then
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0d0 * t_0)
else if (fmax(x, y) <= 1.36d+105) then
tmp = (fmax(x, y) / ((fmax(x, y) - (-1.0d0)) * (t_0 * t_0))) * fmin(x, y)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - ((-1.0d0) - fmin(x, y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.6e-172) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else if (fmax(x, y) <= 1.36e+105) {
tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y))));
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= -9.5e-277: tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y)) elif fmax(x, y) <= 1.6e-172: tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0) elif fmax(x, y) <= 1.36e+105: tmp = (fmax(x, y) / ((fmax(x, y) - -1.0) * (t_0 * t_0))) * fmin(x, y) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y)))) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= -9.5e-277) tmp = Float64(Float64(fmax(x, y) / Float64(1.0 + fmin(x, y))) / Float64(fmax(x, y) + fmin(x, y))); elseif (fmax(x, y) <= 1.6e-172) tmp = Float64(Float64(Float64(fmin(x, y) / t_0) * fmax(x, y)) / Float64(1.0 * t_0)); elseif (fmax(x, y) <= 1.36e+105) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(fmax(x, y) - -1.0) * Float64(t_0 * t_0))) * fmin(x, y)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= -9.5e-277) tmp = (max(x, y) / (1.0 + min(x, y))) / (max(x, y) + min(x, y)); elseif (max(x, y) <= 1.6e-172) tmp = ((min(x, y) / t_0) * max(x, y)) / (1.0 * t_0); elseif (max(x, y) <= 1.36e+105) tmp = (max(x, y) / ((max(x, y) - -1.0) * (t_0 * t_0))) * min(x, y); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / (max(x, y) - (-1.0 - min(x, y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], -9.5e-277], N[(N[(N[Max[x, y], $MachinePrecision] / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.6e-172], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(1.0 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.36e+105], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -9.5 \cdot 10^{-277}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{1 + \mathsf{min}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.6 \cdot 10^{-172}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_0} \cdot \mathsf{max}\left(x, y\right)}{1 \cdot t\_0}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.36 \cdot 10^{+105}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(\mathsf{max}\left(x, y\right) - -1\right) \cdot \left(t\_0 \cdot t\_0\right)} \cdot \mathsf{min}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)}\\
\end{array}
if y < -9.5e-277Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if -9.5e-277 < y < 1.6000000000000001e-172Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.8%
Taylor expanded in x around 0
Applied rewrites50.8%
if 1.6000000000000001e-172 < y < 1.3599999999999999e105Initial program 68.3%
Taylor expanded in x around 0
lower-+.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.2
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6475.2
Applied rewrites75.2%
if 1.3599999999999999e105 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))))
(if (<= (fmax x y) -9.5e-277)
(/ (/ (fmax x y) (+ 1.0 (fmin x y))) (+ (fmax x y) (fmin x y)))
(if (<= (fmax x y) 1.16e-8)
(/ (* (/ (fmin x y) t_0) (fmax x y)) (* 1.0 t_0))
(*
-1.0
(/
(/ (fmin x y) (- (- (fmin x y)) (fmax x y)))
(- (fmax x y) (- -1.0 (fmin x y)))))))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.16e-8) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, 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 = fmin(x, y) + fmax(x, y)
if (fmax(x, y) <= (-9.5d-277)) then
tmp = (fmax(x, y) / (1.0d0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y))
else if (fmax(x, y) <= 1.16d-8) then
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0d0 * t_0)
else
tmp = (-1.0d0) * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - ((-1.0d0) - fmin(x, y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.16e-8) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else {
tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y))));
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) tmp = 0 if fmax(x, y) <= -9.5e-277: tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / (fmax(x, y) + fmin(x, y)) elif fmax(x, y) <= 1.16e-8: tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0) else: tmp = -1.0 * ((fmin(x, y) / (-fmin(x, y) - fmax(x, y))) / (fmax(x, y) - (-1.0 - fmin(x, y)))) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmax(x, y) <= -9.5e-277) tmp = Float64(Float64(fmax(x, y) / Float64(1.0 + fmin(x, y))) / Float64(fmax(x, y) + fmin(x, y))); elseif (fmax(x, y) <= 1.16e-8) tmp = Float64(Float64(Float64(fmin(x, y) / t_0) * fmax(x, y)) / Float64(1.0 * t_0)); else tmp = Float64(-1.0 * Float64(Float64(fmin(x, y) / Float64(Float64(-fmin(x, y)) - fmax(x, y))) / Float64(fmax(x, y) - Float64(-1.0 - fmin(x, y))))); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); tmp = 0.0; if (max(x, y) <= -9.5e-277) tmp = (max(x, y) / (1.0 + min(x, y))) / (max(x, y) + min(x, y)); elseif (max(x, y) <= 1.16e-8) tmp = ((min(x, y) / t_0) * max(x, y)) / (1.0 * t_0); else tmp = -1.0 * ((min(x, y) / (-min(x, y) - max(x, y))) / (max(x, y) - (-1.0 - min(x, y)))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], -9.5e-277], N[(N[(N[Max[x, y], $MachinePrecision] / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.16e-8], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(1.0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(-1.0 * N[(N[(N[Min[x, y], $MachinePrecision] / N[((-N[Min[x, y], $MachinePrecision]) - N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - N[(-1.0 - N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -9.5 \cdot 10^{-277}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{1 + \mathsf{min}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.16 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_0} \cdot \mathsf{max}\left(x, y\right)}{1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{\left(-\mathsf{min}\left(x, y\right)\right) - \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) - \left(-1 - \mathsf{min}\left(x, y\right)\right)}\\
\end{array}
if y < -9.5e-277Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if -9.5e-277 < y < 1.15999999999999996e-8Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.8%
Taylor expanded in x around 0
Applied rewrites50.8%
if 1.15999999999999996e-8 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites51.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))) (t_1 (+ (fmax x y) (fmin x y))))
(if (<= (fmax x y) -9.5e-277)
(/ (/ (fmax x y) (+ 1.0 (fmin x y))) t_1)
(if (<= (fmax x y) 1.16e-8)
(/ (* (/ (fmin x y) t_0) (fmax x y)) (* 1.0 t_0))
(/ (/ (fmin x y) (+ 1.0 (fmax x y))) t_1)))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double t_1 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_1;
} else if (fmax(x, y) <= 1.16e-8) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else {
tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, 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 = fmin(x, y) + fmax(x, y)
t_1 = fmax(x, y) + fmin(x, y)
if (fmax(x, y) <= (-9.5d-277)) then
tmp = (fmax(x, y) / (1.0d0 + fmin(x, y))) / t_1
else if (fmax(x, y) <= 1.16d-8) then
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0d0 * t_0)
else
tmp = (fmin(x, y) / (1.0d0 + fmax(x, y))) / t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double t_1 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= -9.5e-277) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_1;
} else if (fmax(x, y) <= 1.16e-8) {
tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0);
} else {
tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_1;
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) t_1 = fmax(x, y) + fmin(x, y) tmp = 0 if fmax(x, y) <= -9.5e-277: tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_1 elif fmax(x, y) <= 1.16e-8: tmp = ((fmin(x, y) / t_0) * fmax(x, y)) / (1.0 * t_0) else: tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_1 return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) t_1 = Float64(fmax(x, y) + fmin(x, y)) tmp = 0.0 if (fmax(x, y) <= -9.5e-277) tmp = Float64(Float64(fmax(x, y) / Float64(1.0 + fmin(x, y))) / t_1); elseif (fmax(x, y) <= 1.16e-8) tmp = Float64(Float64(Float64(fmin(x, y) / t_0) * fmax(x, y)) / Float64(1.0 * t_0)); else tmp = Float64(Float64(fmin(x, y) / Float64(1.0 + fmax(x, y))) / t_1); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); t_1 = max(x, y) + min(x, y); tmp = 0.0; if (max(x, y) <= -9.5e-277) tmp = (max(x, y) / (1.0 + min(x, y))) / t_1; elseif (max(x, y) <= 1.16e-8) tmp = ((min(x, y) / t_0) * max(x, y)) / (1.0 * t_0); else tmp = (min(x, y) / (1.0 + max(x, y))) / t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], -9.5e-277], N[(N[(N[Max[x, y], $MachinePrecision] / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.16e-8], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(1.0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(1.0 + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
t_1 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -9.5 \cdot 10^{-277}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{1 + \mathsf{min}\left(x, y\right)}}{t\_1}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.16 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_0} \cdot \mathsf{max}\left(x, y\right)}{1 \cdot t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{1 + \mathsf{max}\left(x, y\right)}}{t\_1}\\
\end{array}
if y < -9.5e-277Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if -9.5e-277 < y < 1.15999999999999996e-8Initial program 68.3%
Taylor expanded in y around 0
lower-+.f6458.0
Applied rewrites58.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lift-neg.f64N/A
sub-negate-revN/A
lift--.f64N/A
distribute-neg-frac2N/A
lift-/.f64N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.8%
Taylor expanded in x around 0
Applied rewrites50.8%
if 1.15999999999999996e-8 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))))
(if (<= (fmax x y) -4.6e+29)
(/ (/ (fmax x y) (fmin x y)) t_0)
(if (<= (fmax x y) 1.2e-72)
(/ (fmax x y) (* (fmin x y) (+ 1.0 (fmin x y))))
(/ (/ (fmin x y) (+ 1.0 (fmax x y))) t_0)))))double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= -4.6e+29) {
tmp = (fmax(x, y) / fmin(x, y)) / t_0;
} else if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (1.0 + fmax(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 = fmax(x, y) + fmin(x, y)
if (fmax(x, y) <= (-4.6d+29)) then
tmp = (fmax(x, y) / fmin(x, y)) / t_0
else if (fmax(x, y) <= 1.2d-72) then
tmp = fmax(x, y) / (fmin(x, y) * (1.0d0 + fmin(x, y)))
else
tmp = (fmin(x, y) / (1.0d0 + fmax(x, y))) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= -4.6e+29) {
tmp = (fmax(x, y) / fmin(x, y)) / t_0;
} else if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) tmp = 0 if fmax(x, y) <= -4.6e+29: tmp = (fmax(x, y) / fmin(x, y)) / t_0 elif fmax(x, y) <= 1.2e-72: tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y))) else: tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_0 return tmp
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) tmp = 0.0 if (fmax(x, y) <= -4.6e+29) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) / t_0); elseif (fmax(x, y) <= 1.2e-72) tmp = Float64(fmax(x, y) / Float64(fmin(x, y) * Float64(1.0 + fmin(x, y)))); else tmp = Float64(Float64(fmin(x, y) / Float64(1.0 + fmax(x, y))) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) + min(x, y); tmp = 0.0; if (max(x, y) <= -4.6e+29) tmp = (max(x, y) / min(x, y)) / t_0; elseif (max(x, y) <= 1.2e-72) tmp = max(x, y) / (min(x, y) * (1.0 + min(x, y))); else tmp = (min(x, y) / (1.0 + max(x, y))) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], -4.6e+29], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.2e-72], N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] * N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(1.0 + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -4.6 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}}{t\_0}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) \cdot \left(1 + \mathsf{min}\left(x, y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{1 + \mathsf{max}\left(x, y\right)}}{t\_0}\\
\end{array}
if y < -4.6000000000000002e29Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
if -4.6000000000000002e29 < y < 1.2e-72Initial program 68.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8
Applied rewrites48.8%
if 1.2e-72 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
(FPCore (x y) :precision binary64 (if (<= (fmax x y) 1.2e-72) (* (* -1.0 (/ (fmax x y) (fmin x y))) (/ -1.0 (+ 1.0 (fmin x y)))) (/ (/ (fmin x y) (+ 1.0 (fmax x y))) (+ (fmax x y) (fmin x y)))))
double code(double x, double y) {
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = (-1.0 * (fmax(x, y) / fmin(x, y))) * (-1.0 / (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / (fmax(x, y) + fmin(x, 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 (fmax(x, y) <= 1.2d-72) then
tmp = ((-1.0d0) * (fmax(x, y) / fmin(x, y))) * ((-1.0d0) / (1.0d0 + fmin(x, y)))
else
tmp = (fmin(x, y) / (1.0d0 + fmax(x, y))) / (fmax(x, y) + fmin(x, y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = (-1.0 * (fmax(x, y) / fmin(x, y))) * (-1.0 / (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / (fmax(x, y) + fmin(x, y));
}
return tmp;
}
def code(x, y): tmp = 0 if fmax(x, y) <= 1.2e-72: tmp = (-1.0 * (fmax(x, y) / fmin(x, y))) * (-1.0 / (1.0 + fmin(x, y))) else: tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / (fmax(x, y) + fmin(x, y)) return tmp
function code(x, y) tmp = 0.0 if (fmax(x, y) <= 1.2e-72) tmp = Float64(Float64(-1.0 * Float64(fmax(x, y) / fmin(x, y))) * Float64(-1.0 / Float64(1.0 + fmin(x, y)))); else tmp = Float64(Float64(fmin(x, y) / Float64(1.0 + fmax(x, y))) / Float64(fmax(x, y) + fmin(x, y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (max(x, y) <= 1.2e-72) tmp = (-1.0 * (max(x, y) / min(x, y))) * (-1.0 / (1.0 + min(x, y))); else tmp = (min(x, y) / (1.0 + max(x, y))) / (max(x, y) + min(x, y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Max[x, y], $MachinePrecision], 1.2e-72], N[(N[(-1.0 * N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(1.0 + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;\left(-1 \cdot \frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}\right) \cdot \frac{-1}{1 + \mathsf{min}\left(x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{1 + \mathsf{max}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\end{array}
if y < 1.2e-72Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-/.f6450.1
Applied rewrites50.1%
if 1.2e-72 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))))
(if (<= (fmax x y) 1.2e-72)
(/ (/ (fmax x y) (+ 1.0 (fmin x y))) t_0)
(/ (/ (fmin x y) (+ 1.0 (fmax x y))) t_0))))double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_0;
} else {
tmp = (fmin(x, y) / (1.0 + fmax(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 = fmax(x, y) + fmin(x, y)
if (fmax(x, y) <= 1.2d-72) then
tmp = (fmax(x, y) / (1.0d0 + fmin(x, y))) / t_0
else
tmp = (fmin(x, y) / (1.0d0 + fmax(x, y))) / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_0;
} else {
tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) tmp = 0 if fmax(x, y) <= 1.2e-72: tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_0 else: tmp = (fmin(x, y) / (1.0 + fmax(x, y))) / t_0 return tmp
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) tmp = 0.0 if (fmax(x, y) <= 1.2e-72) tmp = Float64(Float64(fmax(x, y) / Float64(1.0 + fmin(x, y))) / t_0); else tmp = Float64(Float64(fmin(x, y) / Float64(1.0 + fmax(x, y))) / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) + min(x, y); tmp = 0.0; if (max(x, y) <= 1.2e-72) tmp = (max(x, y) / (1.0 + min(x, y))) / t_0; else tmp = (min(x, y) / (1.0 + max(x, y))) / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Max[x, y], $MachinePrecision], 1.2e-72], N[(N[(N[Max[x, y], $MachinePrecision] / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(1.0 + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{1 + \mathsf{min}\left(x, y\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{1 + \mathsf{max}\left(x, y\right)}}{t\_0}\\
\end{array}
if y < 1.2e-72Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7
Applied rewrites50.7%
if 1.2e-72 < y Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6451.0
Applied rewrites51.0%
(FPCore (x y)
:precision binary64
(if (<= (fmax x y) -4.6e+29)
(/ (/ (fmax x y) (fmin x y)) (+ (fmax x y) (fmin x y)))
(if (<= (fmax x y) 1.2e-72)
(/ (fmax x y) (* (fmin x y) (+ 1.0 (fmin x y))))
(/ (/ (fmin x y) (- (fmax x y) -1.0)) (fmax x y)))))double code(double x, double y) {
double tmp;
if (fmax(x, y) <= -4.6e+29) {
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) / fmax(x, 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 (fmax(x, y) <= (-4.6d+29)) then
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y))
else if (fmax(x, y) <= 1.2d-72) then
tmp = fmax(x, y) / (fmin(x, y) * (1.0d0 + fmin(x, y)))
else
tmp = (fmin(x, y) / (fmax(x, y) - (-1.0d0))) / fmax(x, y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (fmax(x, y) <= -4.6e+29) {
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y));
} else if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) / fmax(x, y);
}
return tmp;
}
def code(x, y): tmp = 0 if fmax(x, y) <= -4.6e+29: tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y)) elif fmax(x, y) <= 1.2e-72: tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y))) else: tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) / fmax(x, y) return tmp
function code(x, y) tmp = 0.0 if (fmax(x, y) <= -4.6e+29) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) / Float64(fmax(x, y) + fmin(x, y))); elseif (fmax(x, y) <= 1.2e-72) tmp = Float64(fmax(x, y) / Float64(fmin(x, y) * Float64(1.0 + fmin(x, y)))); else tmp = Float64(Float64(fmin(x, y) / Float64(fmax(x, y) - -1.0)) / fmax(x, y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (max(x, y) <= -4.6e+29) tmp = (max(x, y) / min(x, y)) / (max(x, y) + min(x, y)); elseif (max(x, y) <= 1.2e-72) tmp = max(x, y) / (min(x, y) * (1.0 + min(x, y))); else tmp = (min(x, y) / (max(x, y) - -1.0)) / max(x, y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Max[x, y], $MachinePrecision], -4.6e+29], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Max[x, y], $MachinePrecision], 1.2e-72], N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] * N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq -4.6 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{max}\left(x, y\right) \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) \cdot \left(1 + \mathsf{min}\left(x, y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right) - -1}}{\mathsf{max}\left(x, y\right)}\\
\end{array}
if y < -4.6000000000000002e29Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
if -4.6000000000000002e29 < y < 1.2e-72Initial program 68.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8
Applied rewrites48.8%
if 1.2e-72 < y Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6450.5
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6450.5
Applied rewrites50.5%
(FPCore (x y) :precision binary64 (if (<= (fmax x y) 1.2e-72) (/ (fmax x y) (* (fmin x y) (+ 1.0 (fmin x y)))) (/ (/ (fmin x y) (- (fmax x y) -1.0)) (fmax x y))))
double code(double x, double y) {
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) / fmax(x, 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 (fmax(x, y) <= 1.2d-72) then
tmp = fmax(x, y) / (fmin(x, y) * (1.0d0 + fmin(x, y)))
else
tmp = (fmin(x, y) / (fmax(x, y) - (-1.0d0))) / fmax(x, y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) / fmax(x, y);
}
return tmp;
}
def code(x, y): tmp = 0 if fmax(x, y) <= 1.2e-72: tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y))) else: tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) / fmax(x, y) return tmp
function code(x, y) tmp = 0.0 if (fmax(x, y) <= 1.2e-72) tmp = Float64(fmax(x, y) / Float64(fmin(x, y) * Float64(1.0 + fmin(x, y)))); else tmp = Float64(Float64(fmin(x, y) / Float64(fmax(x, y) - -1.0)) / fmax(x, y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (max(x, y) <= 1.2e-72) tmp = max(x, y) / (min(x, y) * (1.0 + min(x, y))); else tmp = (min(x, y) / (max(x, y) - -1.0)) / max(x, y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Max[x, y], $MachinePrecision], 1.2e-72], N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] * N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) \cdot \left(1 + \mathsf{min}\left(x, y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right) - -1}}{\mathsf{max}\left(x, y\right)}\\
\end{array}
if y < 1.2e-72Initial program 68.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8
Applied rewrites48.8%
if 1.2e-72 < y Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6450.5
lift-+.f64N/A
+-commutativeN/A
add-flip-revN/A
metadata-evalN/A
lower--.f6450.5
Applied rewrites50.5%
(FPCore (x y) :precision binary64 (if (<= (fmax x y) 1.2e-72) (/ (fmax x y) (* (fmin x y) (+ 1.0 (fmin x y)))) (/ (fmin x y) (fma (fmax x y) (fmax x y) (fmax x y)))))
double code(double x, double y) {
double tmp;
if (fmax(x, y) <= 1.2e-72) {
tmp = fmax(x, y) / (fmin(x, y) * (1.0 + fmin(x, y)));
} else {
tmp = fmin(x, y) / fma(fmax(x, y), fmax(x, y), fmax(x, y));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (fmax(x, y) <= 1.2e-72) tmp = Float64(fmax(x, y) / Float64(fmin(x, y) * Float64(1.0 + fmin(x, y)))); else tmp = Float64(fmin(x, y) / fma(fmax(x, y), fmax(x, y), fmax(x, y))); end return tmp end
code[x_, y_] := If[LessEqual[N[Max[x, y], $MachinePrecision], 1.2e-72], N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] * N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) \cdot \left(1 + \mathsf{min}\left(x, y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\mathsf{fma}\left(\mathsf{max}\left(x, y\right), \mathsf{max}\left(x, y\right), \mathsf{max}\left(x, y\right)\right)}\\
\end{array}
if y < 1.2e-72Initial program 68.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8
Applied rewrites48.8%
if 1.2e-72 < y Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6449.2
Applied rewrites49.2%
(FPCore (x y) :precision binary64 (if (<= (fmax x y) 9e-261) (/ (/ (fmax x y) (fmin x y)) (fmax x y)) (/ (fmin x y) (fma (fmax x y) (fmax x y) (fmax x y)))))
double code(double x, double y) {
double tmp;
if (fmax(x, y) <= 9e-261) {
tmp = (fmax(x, y) / fmin(x, y)) / fmax(x, y);
} else {
tmp = fmin(x, y) / fma(fmax(x, y), fmax(x, y), fmax(x, y));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (fmax(x, y) <= 9e-261) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) / fmax(x, y)); else tmp = Float64(fmin(x, y) / fma(fmax(x, y), fmax(x, y), fmax(x, y))); end return tmp end
code[x_, y_] := If[LessEqual[N[Max[x, y], $MachinePrecision], 9e-261], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision], N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{max}\left(x, y\right) \leq 9 \cdot 10^{-261}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}}{\mathsf{max}\left(x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\mathsf{fma}\left(\mathsf{max}\left(x, y\right), \mathsf{max}\left(x, y\right), \mathsf{max}\left(x, y\right)\right)}\\
\end{array}
if y < 9.0000000000000002e-261Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
Taylor expanded in x around 0
Applied rewrites14.4%
if 9.0000000000000002e-261 < y Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6449.2
Applied rewrites49.2%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (fmax x y) (fmin x y)))) (if (<= (fmin x y) -7.6e+17) (/ t_0 (fmax x y)) (/ 1.0 t_0))))
double code(double x, double y) {
double t_0 = fmax(x, y) / fmin(x, y);
double tmp;
if (fmin(x, y) <= -7.6e+17) {
tmp = t_0 / fmax(x, y);
} else {
tmp = 1.0 / 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 = fmax(x, y) / fmin(x, y)
if (fmin(x, y) <= (-7.6d+17)) then
tmp = t_0 / fmax(x, y)
else
tmp = 1.0d0 / t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) / fmin(x, y);
double tmp;
if (fmin(x, y) <= -7.6e+17) {
tmp = t_0 / fmax(x, y);
} else {
tmp = 1.0 / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) / fmin(x, y) tmp = 0 if fmin(x, y) <= -7.6e+17: tmp = t_0 / fmax(x, y) else: tmp = 1.0 / t_0 return tmp
function code(x, y) t_0 = Float64(fmax(x, y) / fmin(x, y)) tmp = 0.0 if (fmin(x, y) <= -7.6e+17) tmp = Float64(t_0 / fmax(x, y)); else tmp = Float64(1.0 / t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) / min(x, y); tmp = 0.0; if (min(x, y) <= -7.6e+17) tmp = t_0 / max(x, y); else tmp = 1.0 / t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -7.6e+17], N[(t$95$0 / N[Max[x, y], $MachinePrecision]), $MachinePrecision], N[(1.0 / t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -7.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{t\_0}{\mathsf{max}\left(x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_0}\\
\end{array}
if x < -7.6e17Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites73.6%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
Taylor expanded in x around 0
Applied rewrites14.4%
if -7.6e17 < x Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
Taylor expanded in y around 0
lower-/.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f32N/A
lower-/.f32N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f6426.7
Applied rewrites26.7%
(FPCore (x y) :precision binary64 (if (<= x -7.6e+17) (* -1.0 (/ -1.0 x)) (/ 1.0 (/ y x))))
double code(double x, double y) {
double tmp;
if (x <= -7.6e+17) {
tmp = -1.0 * (-1.0 / x);
} else {
tmp = 1.0 / (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 (x <= (-7.6d+17)) then
tmp = (-1.0d0) * ((-1.0d0) / x)
else
tmp = 1.0d0 / (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -7.6e+17) {
tmp = -1.0 * (-1.0 / x);
} else {
tmp = 1.0 / (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -7.6e+17: tmp = -1.0 * (-1.0 / x) else: tmp = 1.0 / (y / x) return tmp
function code(x, y) tmp = 0.0 if (x <= -7.6e+17) tmp = Float64(-1.0 * Float64(-1.0 / x)); else tmp = Float64(1.0 / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -7.6e+17) tmp = -1.0 * (-1.0 / x); else tmp = 1.0 / (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -7.6e+17], N[(-1.0 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+17}:\\
\;\;\;\;-1 \cdot \frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\end{array}
if x < -7.6e17Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
Taylor expanded in x around 0
Applied rewrites4.2%
if -7.6e17 < x Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
Taylor expanded in y around 0
lower-/.f6426.3
Applied rewrites26.3%
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f32N/A
lower-/.f32N/A
lift-neg.f64N/A
frac-2negN/A
lift-/.f6426.7
Applied rewrites26.7%
(FPCore (x y) :precision binary64 (if (<= (fmin x y) -7.6e+17) (* -1.0 (/ -1.0 (fmin x y))) (/ (fmin x y) (fmax x y))))
double code(double x, double y) {
double tmp;
if (fmin(x, y) <= -7.6e+17) {
tmp = -1.0 * (-1.0 / fmin(x, y));
} else {
tmp = fmin(x, y) / fmax(x, 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 (fmin(x, y) <= (-7.6d+17)) then
tmp = (-1.0d0) * ((-1.0d0) / fmin(x, y))
else
tmp = fmin(x, y) / fmax(x, y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (fmin(x, y) <= -7.6e+17) {
tmp = -1.0 * (-1.0 / fmin(x, y));
} else {
tmp = fmin(x, y) / fmax(x, y);
}
return tmp;
}
def code(x, y): tmp = 0 if fmin(x, y) <= -7.6e+17: tmp = -1.0 * (-1.0 / fmin(x, y)) else: tmp = fmin(x, y) / fmax(x, y) return tmp
function code(x, y) tmp = 0.0 if (fmin(x, y) <= -7.6e+17) tmp = Float64(-1.0 * Float64(-1.0 / fmin(x, y))); else tmp = Float64(fmin(x, y) / fmax(x, y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (min(x, y) <= -7.6e+17) tmp = -1.0 * (-1.0 / min(x, y)); else tmp = min(x, y) / max(x, y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Min[x, y], $MachinePrecision], -7.6e+17], N[(-1.0 * N[(-1.0 / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Min[x, y], $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -7.6 \cdot 10^{+17}:\\
\;\;\;\;-1 \cdot \frac{-1}{\mathsf{min}\left(x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right)}\\
\end{array}
if x < -7.6e17Initial program 68.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2
Applied rewrites38.2%
Taylor expanded in x around 0
Applied rewrites4.2%
if -7.6e17 < x Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
Taylor expanded in y around 0
lower-/.f6426.3
Applied rewrites26.3%
(FPCore (x y) :precision binary64 (/ x y))
double code(double x, double y) {
return x / y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / y
end function
public static double code(double x, double y) {
return x / y;
}
def code(x, y): return x / y
function code(x, y) return Float64(x / y) end
function tmp = code(x, y) tmp = x / y; end
code[x_, y_] := N[(x / y), $MachinePrecision]
\frac{x}{y}
Initial program 68.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6449.2
Applied rewrites49.2%
Taylor expanded in y around 0
lower-/.f6426.3
Applied rewrites26.3%
herbie shell --seed 2025172
(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))))