
(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 20 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 (/ (/ (* y (/ x (+ y x))) (- (+ y x) -1.0)) (+ y x)))
double code(double x, double y) {
return ((y * (x / (y + x))) / ((y + x) - -1.0)) / (y + x);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y * (x / (y + x))) / ((y + x) - (-1.0d0))) / (y + x)
end function
public static double code(double x, double y) {
return ((y * (x / (y + x))) / ((y + x) - -1.0)) / (y + x);
}
def code(x, y): return ((y * (x / (y + x))) / ((y + x) - -1.0)) / (y + x)
function code(x, y) return Float64(Float64(Float64(y * Float64(x / Float64(y + x))) / Float64(Float64(y + x) - -1.0)) / Float64(y + x)) end
function tmp = code(x, y) tmp = ((y * (x / (y + x))) / ((y + x) - -1.0)) / (y + x); end
code[x_, y_] := N[(N[(N[(y * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\frac{\frac{y \cdot \frac{x}{y + x}}{\left(y + x\right) - -1}}{y + x}
Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ (fmax x y) (fmin x y)))) (/ (* (/ (fmax x y) (- t_0 -1.0)) (/ (fmin x y) t_0)) t_0)))
double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
return ((fmax(x, y) / (t_0 - -1.0)) * (fmin(x, y) / t_0)) / t_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
real(8) :: t_0
t_0 = fmax(x, y) + fmin(x, y)
code = ((fmax(x, y) / (t_0 - (-1.0d0))) * (fmin(x, y) / t_0)) / t_0
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
return ((fmax(x, y) / (t_0 - -1.0)) * (fmin(x, y) / t_0)) / t_0;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) return ((fmax(x, y) / (t_0 - -1.0)) * (fmin(x, y) / t_0)) / t_0
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) return Float64(Float64(Float64(fmax(x, y) / Float64(t_0 - -1.0)) * Float64(fmin(x, y) / t_0)) / t_0) end
function tmp = code(x, y) t_0 = max(x, y) + min(x, y); tmp = ((max(x, y) / (t_0 - -1.0)) * (min(x, y) / t_0)) / t_0; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Max[x, y], $MachinePrecision] / N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)\\
\frac{\frac{\mathsf{max}\left(x, y\right)}{t\_0 - -1} \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_0}}{t\_0}
\end{array}
Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.8%
(FPCore (x y) :precision binary64 (* (/ y (+ x y)) (/ (/ x (- (+ x y) -1.0)) (+ x y))))
double code(double x, double y) {
return (y / (x + y)) * ((x / ((x + y) - -1.0)) / (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 = (y / (x + y)) * ((x / ((x + y) - (-1.0d0))) / (x + y))
end function
public static double code(double x, double y) {
return (y / (x + y)) * ((x / ((x + y) - -1.0)) / (x + y));
}
def code(x, y): return (y / (x + y)) * ((x / ((x + y) - -1.0)) / (x + y))
function code(x, y) return Float64(Float64(y / Float64(x + y)) * Float64(Float64(x / Float64(Float64(x + y) - -1.0)) / Float64(x + y))) end
function tmp = code(x, y) tmp = (y / (x + y)) * ((x / ((x + y) - -1.0)) / (x + y)); end
code[x_, y_] := N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(N[(x + y), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{y}{x + y} \cdot \frac{\frac{x}{\left(x + y\right) - -1}}{x + y}
Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y)))
(t_1 (+ (fmin x y) (fmax x y))))
(if (<= (fmin x y) -1.7e+109)
(* (/ (fmax x y) (fmin x y)) (/ (/ (fmin x y) (- t_1 -1.0)) t_1))
(if (<= (fmin x y) -1e-33)
(* (/ (fmin x y) (* (- t_0 -1.0) (* t_0 t_0))) (fmax x y))
(*
(/ (fmin x y) (- (fmax x y) -1.0))
(/ (/ (fmax x y) t_1) t_1))))))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 (fmin(x, y) <= -1.7e+109) {
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - -1.0)) / t_1);
} else if (fmin(x, y) <= -1e-33) {
tmp = (fmin(x, y) / ((t_0 - -1.0) * (t_0 * t_0))) * fmax(x, y);
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) * ((fmax(x, y) / t_1) / 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 = fmax(x, y) + fmin(x, y)
t_1 = fmin(x, y) + fmax(x, y)
if (fmin(x, y) <= (-1.7d+109)) then
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - (-1.0d0))) / t_1)
else if (fmin(x, y) <= (-1d-33)) then
tmp = (fmin(x, y) / ((t_0 - (-1.0d0)) * (t_0 * t_0))) * fmax(x, y)
else
tmp = (fmin(x, y) / (fmax(x, y) - (-1.0d0))) * ((fmax(x, y) / t_1) / 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 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmin(x, y) <= -1.7e+109) {
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - -1.0)) / t_1);
} else if (fmin(x, y) <= -1e-33) {
tmp = (fmin(x, y) / ((t_0 - -1.0) * (t_0 * t_0))) * fmax(x, y);
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) * ((fmax(x, y) / t_1) / t_1);
}
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 fmin(x, y) <= -1.7e+109: tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - -1.0)) / t_1) elif fmin(x, y) <= -1e-33: tmp = (fmin(x, y) / ((t_0 - -1.0) * (t_0 * t_0))) * fmax(x, y) else: tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) * ((fmax(x, y) / t_1) / t_1) 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 (fmin(x, y) <= -1.7e+109) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) * Float64(Float64(fmin(x, y) / Float64(t_1 - -1.0)) / t_1)); elseif (fmin(x, y) <= -1e-33) tmp = Float64(Float64(fmin(x, y) / Float64(Float64(t_0 - -1.0) * Float64(t_0 * t_0))) * fmax(x, y)); else tmp = Float64(Float64(fmin(x, y) / Float64(fmax(x, y) - -1.0)) * Float64(Float64(fmax(x, y) / t_1) / t_1)); 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 (min(x, y) <= -1.7e+109) tmp = (max(x, y) / min(x, y)) * ((min(x, y) / (t_1 - -1.0)) / t_1); elseif (min(x, y) <= -1e-33) tmp = (min(x, y) / ((t_0 - -1.0) * (t_0 * t_0))) * max(x, y); else tmp = (min(x, y) / (max(x, y) - -1.0)) * ((max(x, y) / t_1) / 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[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -1.7e+109], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Min[x, y], $MachinePrecision] / N[(t$95$1 - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], -1e-33], N[(N[(N[Min[x, y], $MachinePrecision] / N[(N[(t$95$0 - -1.0), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / t$95$1), $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{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -1.7 \cdot 10^{+109}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)} \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{t\_1 - -1}}{t\_1}\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\left(t\_0 - -1\right) \cdot \left(t\_0 \cdot t\_0\right)} \cdot \mathsf{max}\left(x, y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right) - -1} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{t\_1}}{t\_1}\\
\end{array}
if x < -1.7e109Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6461.1%
Applied rewrites61.1%
if -1.7e109 < x < -1.0000000000000001e-33Initial program 69.5%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.1%
if -1.0000000000000001e-33 < x Initial program 69.5%
Taylor expanded in x around 0
lower-+.f6459.4%
Applied rewrites59.4%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
+-commutativeN/A
lift-+.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-/l*N/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites86.0%
(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) 2.15e+150)
(/ (* (/ (fmax x y) t_1) (fmin x y)) (* (- t_1 -1.0) t_1))
(*
(/ (/ (fmax x y) (- t_0 -1.0)) t_0)
(/ (fmin x y) (fmax 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) <= 2.15e+150) {
tmp = ((fmax(x, y) / t_1) * fmin(x, y)) / ((t_1 - -1.0) * t_1);
} else {
tmp = ((fmax(x, y) / (t_0 - -1.0)) / t_0) * (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) :: 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) <= 2.15d+150) then
tmp = ((fmax(x, y) / t_1) * fmin(x, y)) / ((t_1 - (-1.0d0)) * t_1)
else
tmp = ((fmax(x, y) / (t_0 - (-1.0d0))) / t_0) * (fmin(x, y) / fmax(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) <= 2.15e+150) {
tmp = ((fmax(x, y) / t_1) * fmin(x, y)) / ((t_1 - -1.0) * t_1);
} else {
tmp = ((fmax(x, y) / (t_0 - -1.0)) / t_0) * (fmin(x, y) / fmax(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) <= 2.15e+150: tmp = ((fmax(x, y) / t_1) * fmin(x, y)) / ((t_1 - -1.0) * t_1) else: tmp = ((fmax(x, y) / (t_0 - -1.0)) / t_0) * (fmin(x, y) / fmax(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) <= 2.15e+150) tmp = Float64(Float64(Float64(fmax(x, y) / t_1) * fmin(x, y)) / Float64(Float64(t_1 - -1.0) * t_1)); else tmp = Float64(Float64(Float64(fmax(x, y) / Float64(t_0 - -1.0)) / t_0) * Float64(fmin(x, y) / fmax(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) <= 2.15e+150) tmp = ((max(x, y) / t_1) * min(x, y)) / ((t_1 - -1.0) * t_1); else tmp = ((max(x, y) / (t_0 - -1.0)) / t_0) * (min(x, y) / max(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], 2.15e+150], N[(N[(N[(N[Max[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision] / N[(N[(t$95$1 - -1.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Max[x, y], $MachinePrecision] / N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / N[Max[x, y], $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 2.15 \cdot 10^{+150}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{t\_1} \cdot \mathsf{min}\left(x, y\right)}{\left(t\_1 - -1\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{t\_0 - -1}}{t\_0} \cdot \frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right)}\\
\end{array}
if y < 2.15e150Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6493.5%
Applied rewrites93.5%
if 2.15e150 < y Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6499.8%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f6461.8%
Applied rewrites61.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) 2.15e+150)
(* (/ (fmax x y) (* (- t_1 -1.0) t_1)) (/ (fmin x y) t_1))
(*
(/ (/ (fmax x y) (- t_0 -1.0)) t_0)
(/ (fmin x y) (fmax 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) <= 2.15e+150) {
tmp = (fmax(x, y) / ((t_1 - -1.0) * t_1)) * (fmin(x, y) / t_1);
} else {
tmp = ((fmax(x, y) / (t_0 - -1.0)) / t_0) * (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) :: 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) <= 2.15d+150) then
tmp = (fmax(x, y) / ((t_1 - (-1.0d0)) * t_1)) * (fmin(x, y) / t_1)
else
tmp = ((fmax(x, y) / (t_0 - (-1.0d0))) / t_0) * (fmin(x, y) / fmax(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) <= 2.15e+150) {
tmp = (fmax(x, y) / ((t_1 - -1.0) * t_1)) * (fmin(x, y) / t_1);
} else {
tmp = ((fmax(x, y) / (t_0 - -1.0)) / t_0) * (fmin(x, y) / fmax(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) <= 2.15e+150: tmp = (fmax(x, y) / ((t_1 - -1.0) * t_1)) * (fmin(x, y) / t_1) else: tmp = ((fmax(x, y) / (t_0 - -1.0)) / t_0) * (fmin(x, y) / fmax(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) <= 2.15e+150) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(t_1 - -1.0) * t_1)) * Float64(fmin(x, y) / t_1)); else tmp = Float64(Float64(Float64(fmax(x, y) / Float64(t_0 - -1.0)) / t_0) * Float64(fmin(x, y) / fmax(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) <= 2.15e+150) tmp = (max(x, y) / ((t_1 - -1.0) * t_1)) * (min(x, y) / t_1); else tmp = ((max(x, y) / (t_0 - -1.0)) / t_0) * (min(x, y) / max(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], 2.15e+150], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(t$95$1 - -1.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Max[x, y], $MachinePrecision] / N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / N[Max[x, y], $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 2.15 \cdot 10^{+150}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(t\_1 - -1\right) \cdot t\_1} \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{t\_0 - -1}}{t\_0} \cdot \frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right)}\\
\end{array}
if y < 2.15e150Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
if 2.15e150 < y Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6499.8%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8%
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f6461.8%
Applied rewrites61.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (fmax x y) -1.0)) (t_1 (+ (fmin x y) (fmax x y))))
(if (<= (fmin x y) -5e-17)
(* (/ (fmax x y) (fmin x y)) (/ (/ (fmin x y) (- t_1 -1.0)) t_1))
(if (<= (fmin x y) 7e-142)
(/ (* (/ (fmin x y) t_1) (fmax x y)) (* t_0 t_1))
(/ (* (/ 1.0 t_0) (fmin x y)) (+ (fmax x y) (fmin x y)))))))double code(double x, double y) {
double t_0 = fmax(x, y) - -1.0;
double t_1 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - -1.0)) / t_1);
} else if (fmin(x, y) <= 7e-142) {
tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_0 * t_1);
} else {
tmp = ((1.0 / t_0) * fmin(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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = fmax(x, y) - (-1.0d0)
t_1 = fmin(x, y) + fmax(x, y)
if (fmin(x, y) <= (-5d-17)) then
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - (-1.0d0))) / t_1)
else if (fmin(x, y) <= 7d-142) then
tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_0 * t_1)
else
tmp = ((1.0d0 / t_0) * fmin(x, y)) / (fmax(x, y) + fmin(x, y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = fmax(x, y) - -1.0;
double t_1 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - -1.0)) / t_1);
} else if (fmin(x, y) <= 7e-142) {
tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_0 * t_1);
} else {
tmp = ((1.0 / t_0) * fmin(x, y)) / (fmax(x, y) + fmin(x, y));
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) - -1.0 t_1 = fmin(x, y) + fmax(x, y) tmp = 0 if fmin(x, y) <= -5e-17: tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_1 - -1.0)) / t_1) elif fmin(x, y) <= 7e-142: tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_0 * t_1) else: tmp = ((1.0 / t_0) * fmin(x, y)) / (fmax(x, y) + fmin(x, y)) return tmp
function code(x, y) t_0 = Float64(fmax(x, y) - -1.0) t_1 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmin(x, y) <= -5e-17) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) * Float64(Float64(fmin(x, y) / Float64(t_1 - -1.0)) / t_1)); elseif (fmin(x, y) <= 7e-142) tmp = Float64(Float64(Float64(fmin(x, y) / t_1) * fmax(x, y)) / Float64(t_0 * t_1)); else tmp = Float64(Float64(Float64(1.0 / t_0) * fmin(x, y)) / Float64(fmax(x, y) + fmin(x, y))); end return tmp end
function tmp_2 = code(x, y) t_0 = max(x, y) - -1.0; t_1 = min(x, y) + max(x, y); tmp = 0.0; if (min(x, y) <= -5e-17) tmp = (max(x, y) / min(x, y)) * ((min(x, y) / (t_1 - -1.0)) / t_1); elseif (min(x, y) <= 7e-142) tmp = ((min(x, y) / t_1) * max(x, y)) / (t_0 * t_1); else tmp = ((1.0 / t_0) * min(x, y)) / (max(x, y) + min(x, y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -5e-17], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Min[x, y], $MachinePrecision] / N[(t$95$1 - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], 7e-142], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / t$95$0), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(x, y\right) - -1\\
t_1 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)} \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{t\_1 - -1}}{t\_1}\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq 7 \cdot 10^{-142}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_1} \cdot \mathsf{max}\left(x, y\right)}{t\_0 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_0} \cdot \mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right) + \mathsf{min}\left(x, y\right)}\\
\end{array}
if x < -4.9999999999999999e-17Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6461.1%
Applied rewrites61.1%
if -4.9999999999999999e-17 < x < 7.0000000000000003e-142Initial program 69.5%
Taylor expanded in x around 0
lower-+.f6459.4%
Applied rewrites59.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6472.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6472.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6472.0%
Applied rewrites72.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.6%
if 7.0000000000000003e-142 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f6450.9%
Applied rewrites50.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmin x y) (fmax x y))))
(if (<= (fmin x y) -5e-17)
(* (/ (fmax x y) (fmin x y)) (/ (/ (fmin x y) (- t_0 -1.0)) t_0))
(*
(/ (fmin x y) (- (fmax x y) -1.0))
(/ (/ (fmax x y) t_0) t_0)))))double code(double x, double y) {
double t_0 = fmin(x, y) + fmax(x, y);
double tmp;
if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_0 - -1.0)) / t_0);
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) * ((fmax(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) :: tmp
t_0 = fmin(x, y) + fmax(x, y)
if (fmin(x, y) <= (-5d-17)) then
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_0 - (-1.0d0))) / t_0)
else
tmp = (fmin(x, y) / (fmax(x, y) - (-1.0d0))) * ((fmax(x, y) / t_0) / t_0)
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 (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_0 - -1.0)) / t_0);
} else {
tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) * ((fmax(x, y) / t_0) / t_0);
}
return tmp;
}
def code(x, y): t_0 = fmin(x, y) + fmax(x, y) tmp = 0 if fmin(x, y) <= -5e-17: tmp = (fmax(x, y) / fmin(x, y)) * ((fmin(x, y) / (t_0 - -1.0)) / t_0) else: tmp = (fmin(x, y) / (fmax(x, y) - -1.0)) * ((fmax(x, y) / t_0) / t_0) return tmp
function code(x, y) t_0 = Float64(fmin(x, y) + fmax(x, y)) tmp = 0.0 if (fmin(x, y) <= -5e-17) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) * Float64(Float64(fmin(x, y) / Float64(t_0 - -1.0)) / t_0)); else tmp = Float64(Float64(fmin(x, y) / Float64(fmax(x, y) - -1.0)) * Float64(Float64(fmax(x, y) / t_0) / t_0)); end return tmp end
function tmp_2 = code(x, y) t_0 = min(x, y) + max(x, y); tmp = 0.0; if (min(x, y) <= -5e-17) tmp = (max(x, y) / min(x, y)) * ((min(x, y) / (t_0 - -1.0)) / t_0); else tmp = (min(x, y) / (max(x, y) - -1.0)) * ((max(x, y) / t_0) / t_0); 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[Min[x, y], $MachinePrecision], -5e-17], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Min[x, y], $MachinePrecision] / N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Max[x, y], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)} \cdot \frac{\frac{\mathsf{min}\left(x, y\right)}{t\_0 - -1}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right) - -1} \cdot \frac{\frac{\mathsf{max}\left(x, y\right)}{t\_0}}{t\_0}\\
\end{array}
if x < -4.9999999999999999e-17Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6461.1%
Applied rewrites61.1%
if -4.9999999999999999e-17 < x Initial program 69.5%
Taylor expanded in x around 0
lower-+.f6459.4%
Applied rewrites59.4%
lift-/.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
associate-*l*N/A
+-commutativeN/A
lift-+.f64N/A
associate-/r*N/A
lift-*.f64N/A
associate-/l*N/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites86.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y)))
(t_1 (+ (fmin x y) (fmax x y)))
(t_2 (- (fmax x y) -1.0)))
(if (<= (fmin x y) -6.4e+185)
(* (/ (fmax x y) t_1) (/ 1.0 (fmin x y)))
(if (<= (fmin x y) -5e-17)
(* (/ (fmax x y) (* (- t_0 -1.0) t_0)) 1.0)
(if (<= (fmin x y) 7e-142)
(/ (* (/ (fmin x y) t_1) (fmax x y)) (* t_2 t_1))
(/ (* (/ 1.0 t_2) (fmin x y)) 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 t_2 = fmax(x, y) - -1.0;
double tmp;
if (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / t_1) * (1.0 / fmin(x, y));
} else if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0;
} else if (fmin(x, y) <= 7e-142) {
tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_2 * t_1);
} else {
tmp = ((1.0 / t_2) * fmin(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) + fmin(x, y)
t_1 = fmin(x, y) + fmax(x, y)
t_2 = fmax(x, y) - (-1.0d0)
if (fmin(x, y) <= (-6.4d+185)) then
tmp = (fmax(x, y) / t_1) * (1.0d0 / fmin(x, y))
else if (fmin(x, y) <= (-5d-17)) then
tmp = (fmax(x, y) / ((t_0 - (-1.0d0)) * t_0)) * 1.0d0
else if (fmin(x, y) <= 7d-142) then
tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_2 * t_1)
else
tmp = ((1.0d0 / t_2) * fmin(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 t_1 = fmin(x, y) + fmax(x, y);
double t_2 = fmax(x, y) - -1.0;
double tmp;
if (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / t_1) * (1.0 / fmin(x, y));
} else if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0;
} else if (fmin(x, y) <= 7e-142) {
tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_2 * t_1);
} else {
tmp = ((1.0 / t_2) * fmin(x, y)) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) t_1 = fmin(x, y) + fmax(x, y) t_2 = fmax(x, y) - -1.0 tmp = 0 if fmin(x, y) <= -6.4e+185: tmp = (fmax(x, y) / t_1) * (1.0 / fmin(x, y)) elif fmin(x, y) <= -5e-17: tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0 elif fmin(x, y) <= 7e-142: tmp = ((fmin(x, y) / t_1) * fmax(x, y)) / (t_2 * t_1) else: tmp = ((1.0 / t_2) * fmin(x, y)) / 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)) t_2 = Float64(fmax(x, y) - -1.0) tmp = 0.0 if (fmin(x, y) <= -6.4e+185) tmp = Float64(Float64(fmax(x, y) / t_1) * Float64(1.0 / fmin(x, y))); elseif (fmin(x, y) <= -5e-17) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(t_0 - -1.0) * t_0)) * 1.0); elseif (fmin(x, y) <= 7e-142) tmp = Float64(Float64(Float64(fmin(x, y) / t_1) * fmax(x, y)) / Float64(t_2 * t_1)); else tmp = Float64(Float64(Float64(1.0 / t_2) * fmin(x, y)) / 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); t_2 = max(x, y) - -1.0; tmp = 0.0; if (min(x, y) <= -6.4e+185) tmp = (max(x, y) / t_1) * (1.0 / min(x, y)); elseif (min(x, y) <= -5e-17) tmp = (max(x, y) / ((t_0 - -1.0) * t_0)) * 1.0; elseif (min(x, y) <= 7e-142) tmp = ((min(x, y) / t_1) * max(x, y)) / (t_2 * t_1); else tmp = ((1.0 / t_2) * min(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]}, Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -6.4e+185], N[(N[(N[Max[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(1.0 / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], -5e-17], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(t$95$0 - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], 7e-142], N[(N[(N[(N[Min[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] * N[Max[x, y], $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / t$95$2), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $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)\\
t_2 := \mathsf{max}\left(x, y\right) - -1\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -6.4 \cdot 10^{+185}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{t\_1} \cdot \frac{1}{\mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(t\_0 - -1\right) \cdot t\_0} \cdot 1\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq 7 \cdot 10^{-142}:\\
\;\;\;\;\frac{\frac{\mathsf{min}\left(x, y\right)}{t\_1} \cdot \mathsf{max}\left(x, y\right)}{t\_2 \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_2} \cdot \mathsf{min}\left(x, y\right)}{t\_0}\\
\end{array}
if x < -6.4000000000000001e185Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if -6.4000000000000001e185 < x < -4.9999999999999999e-17Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
Taylor expanded in x around inf
Applied rewrites66.3%
if -4.9999999999999999e-17 < x < 7.0000000000000003e-142Initial program 69.5%
Taylor expanded in x around 0
lower-+.f6459.4%
Applied rewrites59.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6472.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6472.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6472.0%
Applied rewrites72.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
times-fracN/A
lift-*.f64N/A
associate-/r*N/A
lift-+.f64N/A
+-commutativeN/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites75.6%
if 7.0000000000000003e-142 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f6450.9%
Applied rewrites50.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y)))
(t_1 (+ (fmin x y) (fmax x y)))
(t_2 (- (fmax x y) -1.0)))
(if (<= (fmin x y) -6.4e+185)
(* (/ (fmax x y) t_1) (/ 1.0 (fmin x y)))
(if (<= (fmin x y) -5e-17)
(* (/ (fmax x y) (* (- t_0 -1.0) t_0)) 1.0)
(if (<= (fmin x y) -4.8e-137)
(* (fmax x y) (/ (fmin x y) (* t_2 (* t_1 t_1))))
(/ (* (/ 1.0 t_2) (fmin x y)) 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 t_2 = fmax(x, y) - -1.0;
double tmp;
if (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / t_1) * (1.0 / fmin(x, y));
} else if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0;
} else if (fmin(x, y) <= -4.8e-137) {
tmp = fmax(x, y) * (fmin(x, y) / (t_2 * (t_1 * t_1)));
} else {
tmp = ((1.0 / t_2) * fmin(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) + fmin(x, y)
t_1 = fmin(x, y) + fmax(x, y)
t_2 = fmax(x, y) - (-1.0d0)
if (fmin(x, y) <= (-6.4d+185)) then
tmp = (fmax(x, y) / t_1) * (1.0d0 / fmin(x, y))
else if (fmin(x, y) <= (-5d-17)) then
tmp = (fmax(x, y) / ((t_0 - (-1.0d0)) * t_0)) * 1.0d0
else if (fmin(x, y) <= (-4.8d-137)) then
tmp = fmax(x, y) * (fmin(x, y) / (t_2 * (t_1 * t_1)))
else
tmp = ((1.0d0 / t_2) * fmin(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 t_1 = fmin(x, y) + fmax(x, y);
double t_2 = fmax(x, y) - -1.0;
double tmp;
if (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / t_1) * (1.0 / fmin(x, y));
} else if (fmin(x, y) <= -5e-17) {
tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0;
} else if (fmin(x, y) <= -4.8e-137) {
tmp = fmax(x, y) * (fmin(x, y) / (t_2 * (t_1 * t_1)));
} else {
tmp = ((1.0 / t_2) * fmin(x, y)) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) t_1 = fmin(x, y) + fmax(x, y) t_2 = fmax(x, y) - -1.0 tmp = 0 if fmin(x, y) <= -6.4e+185: tmp = (fmax(x, y) / t_1) * (1.0 / fmin(x, y)) elif fmin(x, y) <= -5e-17: tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0 elif fmin(x, y) <= -4.8e-137: tmp = fmax(x, y) * (fmin(x, y) / (t_2 * (t_1 * t_1))) else: tmp = ((1.0 / t_2) * fmin(x, y)) / 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)) t_2 = Float64(fmax(x, y) - -1.0) tmp = 0.0 if (fmin(x, y) <= -6.4e+185) tmp = Float64(Float64(fmax(x, y) / t_1) * Float64(1.0 / fmin(x, y))); elseif (fmin(x, y) <= -5e-17) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(t_0 - -1.0) * t_0)) * 1.0); elseif (fmin(x, y) <= -4.8e-137) tmp = Float64(fmax(x, y) * Float64(fmin(x, y) / Float64(t_2 * Float64(t_1 * t_1)))); else tmp = Float64(Float64(Float64(1.0 / t_2) * fmin(x, y)) / 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); t_2 = max(x, y) - -1.0; tmp = 0.0; if (min(x, y) <= -6.4e+185) tmp = (max(x, y) / t_1) * (1.0 / min(x, y)); elseif (min(x, y) <= -5e-17) tmp = (max(x, y) / ((t_0 - -1.0) * t_0)) * 1.0; elseif (min(x, y) <= -4.8e-137) tmp = max(x, y) * (min(x, y) / (t_2 * (t_1 * t_1))); else tmp = ((1.0 / t_2) * min(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]}, Block[{t$95$1 = N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[N[Min[x, y], $MachinePrecision], -6.4e+185], N[(N[(N[Max[x, y], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(1.0 / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], -5e-17], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(t$95$0 - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], -4.8e-137], N[(N[Max[x, y], $MachinePrecision] * N[(N[Min[x, y], $MachinePrecision] / N[(t$95$2 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / t$95$2), $MachinePrecision] * N[Min[x, y], $MachinePrecision]), $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)\\
t_2 := \mathsf{max}\left(x, y\right) - -1\\
\mathbf{if}\;\mathsf{min}\left(x, y\right) \leq -6.4 \cdot 10^{+185}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{t\_1} \cdot \frac{1}{\mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -5 \cdot 10^{-17}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(t\_0 - -1\right) \cdot t\_0} \cdot 1\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -4.8 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{max}\left(x, y\right) \cdot \frac{\mathsf{min}\left(x, y\right)}{t\_2 \cdot \left(t\_1 \cdot t\_1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t\_2} \cdot \mathsf{min}\left(x, y\right)}{t\_0}\\
\end{array}
if x < -6.4000000000000001e185Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if -6.4000000000000001e185 < x < -4.9999999999999999e-17Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
Taylor expanded in x around inf
Applied rewrites66.3%
if -4.9999999999999999e-17 < x < -4.8000000000000001e-137Initial program 69.5%
Taylor expanded in x around 0
lower-+.f6459.4%
Applied rewrites59.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6472.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6472.0%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6472.0%
Applied rewrites72.0%
if -4.8000000000000001e-137 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f6450.9%
Applied rewrites50.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))))
(if (<= (fmin x y) -6.4e+185)
(* (/ (fmax x y) (+ (fmin x y) (fmax x y))) (/ 1.0 (fmin x y)))
(if (<= (fmin x y) -2.9e-91)
(* (/ (fmax x y) (* (- t_0 -1.0) t_0)) 1.0)
(/ (* (/ 1.0 (- (fmax x y) -1.0)) (fmin x y)) t_0)))))double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / (fmin(x, y) + fmax(x, y))) * (1.0 / fmin(x, y));
} else if (fmin(x, y) <= -2.9e-91) {
tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0;
} else {
tmp = ((1.0 / (fmax(x, y) - -1.0)) * fmin(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 (fmin(x, y) <= (-6.4d+185)) then
tmp = (fmax(x, y) / (fmin(x, y) + fmax(x, y))) * (1.0d0 / fmin(x, y))
else if (fmin(x, y) <= (-2.9d-91)) then
tmp = (fmax(x, y) / ((t_0 - (-1.0d0)) * t_0)) * 1.0d0
else
tmp = ((1.0d0 / (fmax(x, y) - (-1.0d0))) * fmin(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 (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / (fmin(x, y) + fmax(x, y))) * (1.0 / fmin(x, y));
} else if (fmin(x, y) <= -2.9e-91) {
tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0;
} else {
tmp = ((1.0 / (fmax(x, y) - -1.0)) * fmin(x, y)) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) tmp = 0 if fmin(x, y) <= -6.4e+185: tmp = (fmax(x, y) / (fmin(x, y) + fmax(x, y))) * (1.0 / fmin(x, y)) elif fmin(x, y) <= -2.9e-91: tmp = (fmax(x, y) / ((t_0 - -1.0) * t_0)) * 1.0 else: tmp = ((1.0 / (fmax(x, y) - -1.0)) * fmin(x, y)) / t_0 return tmp
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) tmp = 0.0 if (fmin(x, y) <= -6.4e+185) tmp = Float64(Float64(fmax(x, y) / Float64(fmin(x, y) + fmax(x, y))) * Float64(1.0 / fmin(x, y))); elseif (fmin(x, y) <= -2.9e-91) tmp = Float64(Float64(fmax(x, y) / Float64(Float64(t_0 - -1.0) * t_0)) * 1.0); else tmp = Float64(Float64(Float64(1.0 / Float64(fmax(x, y) - -1.0)) * fmin(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 (min(x, y) <= -6.4e+185) tmp = (max(x, y) / (min(x, y) + max(x, y))) * (1.0 / min(x, y)); elseif (min(x, y) <= -2.9e-91) tmp = (max(x, y) / ((t_0 - -1.0) * t_0)) * 1.0; else tmp = ((1.0 / (max(x, y) - -1.0)) * min(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[Min[x, y], $MachinePrecision], -6.4e+185], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[Min[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], -2.9e-91], N[(N[(N[Max[x, y], $MachinePrecision] / N[(N[(t$95$0 - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $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{min}\left(x, y\right) \leq -6.4 \cdot 10^{+185}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right) + \mathsf{max}\left(x, y\right)} \cdot \frac{1}{\mathsf{min}\left(x, y\right)}\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\frac{\mathsf{max}\left(x, y\right)}{\left(t\_0 - -1\right) \cdot t\_0} \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{max}\left(x, y\right) - -1} \cdot \mathsf{min}\left(x, y\right)}{t\_0}\\
\end{array}
if x < -6.4000000000000001e185Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
times-fracN/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if -6.4000000000000001e185 < x < -2.9000000000000001e-91Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.5%
Taylor expanded in x around inf
Applied rewrites66.3%
if -2.9000000000000001e-91 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f6450.9%
Applied rewrites50.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))))
(if (<= (fmin x y) -6.4e+185)
(/ (/ (fmax x y) (fmin x y)) t_0)
(if (<= (fmin x y) -2.9e-91)
(/ (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 (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / fmin(x, y)) / t_0;
} else if (fmin(x, y) <= -2.9e-91) {
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 (fmin(x, y) <= (-6.4d+185)) then
tmp = (fmax(x, y) / fmin(x, y)) / t_0
else if (fmin(x, y) <= (-2.9d-91)) 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 (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / fmin(x, y)) / t_0;
} else if (fmin(x, y) <= -2.9e-91) {
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 fmin(x, y) <= -6.4e+185: tmp = (fmax(x, y) / fmin(x, y)) / t_0 elif fmin(x, y) <= -2.9e-91: 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 (fmin(x, y) <= -6.4e+185) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) / t_0); elseif (fmin(x, y) <= -2.9e-91) 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 (min(x, y) <= -6.4e+185) tmp = (max(x, y) / min(x, y)) / t_0; elseif (min(x, y) <= -2.9e-91) 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[Min[x, y], $MachinePrecision], -6.4e+185], N[(N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[N[Min[x, y], $MachinePrecision], -2.9e-91], 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{min}\left(x, y\right) \leq -6.4 \cdot 10^{+185}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}}{t\_0}\\
\mathbf{elif}\;\mathsf{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\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 x < -6.4000000000000001e185Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if -6.4000000000000001e185 < x < -2.9000000000000001e-91Initial program 69.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
if -2.9000000000000001e-91 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
(FPCore (x y)
:precision binary64
(if (<= (fmin x y) -6.4e+185)
(/ (/ (fmax x y) (fmin x y)) (+ (fmax x y) (fmin x y)))
(if (<= (fmin x y) -2.9e-91)
(/ (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 (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y));
} else if (fmin(x, y) <= -2.9e-91) {
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 (fmin(x, y) <= (-6.4d+185)) then
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y))
else if (fmin(x, y) <= (-2.9d-91)) 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 (fmin(x, y) <= -6.4e+185) {
tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y));
} else if (fmin(x, y) <= -2.9e-91) {
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 fmin(x, y) <= -6.4e+185: tmp = (fmax(x, y) / fmin(x, y)) / (fmax(x, y) + fmin(x, y)) elif fmin(x, y) <= -2.9e-91: 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 (fmin(x, y) <= -6.4e+185) tmp = Float64(Float64(fmax(x, y) / fmin(x, y)) / Float64(fmax(x, y) + fmin(x, y))); elseif (fmin(x, y) <= -2.9e-91) 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 (min(x, y) <= -6.4e+185) tmp = (max(x, y) / min(x, y)) / (max(x, y) + min(x, y)); elseif (min(x, y) <= -2.9e-91) 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[Min[x, y], $MachinePrecision], -6.4e+185], 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[Min[x, y], $MachinePrecision], -2.9e-91], 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{min}\left(x, y\right) \leq -6.4 \cdot 10^{+185}:\\
\;\;\;\;\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{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\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 x < -6.4000000000000001e185Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around inf
lower-/.f6438.2%
Applied rewrites38.2%
if -6.4000000000000001e185 < x < -2.9000000000000001e-91Initial program 69.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
if -2.9000000000000001e-91 < x Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6450.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6450.4%
Applied rewrites50.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))))
(if (<= (fmin x y) -2.9e-91)
(/ (/ (fmax x y) (+ 1.0 (fmin x y))) t_0)
(/ (* (/ 1.0 (- (fmax x y) -1.0)) (fmin x y)) t_0))))double code(double x, double y) {
double t_0 = fmax(x, y) + fmin(x, y);
double tmp;
if (fmin(x, y) <= -2.9e-91) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_0;
} else {
tmp = ((1.0 / (fmax(x, y) - -1.0)) * fmin(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 (fmin(x, y) <= (-2.9d-91)) then
tmp = (fmax(x, y) / (1.0d0 + fmin(x, y))) / t_0
else
tmp = ((1.0d0 / (fmax(x, y) - (-1.0d0))) * fmin(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 (fmin(x, y) <= -2.9e-91) {
tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_0;
} else {
tmp = ((1.0 / (fmax(x, y) - -1.0)) * fmin(x, y)) / t_0;
}
return tmp;
}
def code(x, y): t_0 = fmax(x, y) + fmin(x, y) tmp = 0 if fmin(x, y) <= -2.9e-91: tmp = (fmax(x, y) / (1.0 + fmin(x, y))) / t_0 else: tmp = ((1.0 / (fmax(x, y) - -1.0)) * fmin(x, y)) / t_0 return tmp
function code(x, y) t_0 = Float64(fmax(x, y) + fmin(x, y)) tmp = 0.0 if (fmin(x, y) <= -2.9e-91) tmp = Float64(Float64(fmax(x, y) / Float64(1.0 + fmin(x, y))) / t_0); else tmp = Float64(Float64(Float64(1.0 / Float64(fmax(x, y) - -1.0)) * fmin(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 (min(x, y) <= -2.9e-91) tmp = (max(x, y) / (1.0 + min(x, y))) / t_0; else tmp = ((1.0 / (max(x, y) - -1.0)) * min(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[Min[x, y], $MachinePrecision], -2.9e-91], N[(N[(N[Max[x, y], $MachinePrecision] / N[(1.0 + N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / N[(N[Max[x, y], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[Min[x, y], $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{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\frac{\frac{\mathsf{max}\left(x, y\right)}{1 + \mathsf{min}\left(x, y\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\mathsf{max}\left(x, y\right) - -1} \cdot \mathsf{min}\left(x, y\right)}{t\_0}\\
\end{array}
if x < -2.9000000000000001e-91Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
if -2.9000000000000001e-91 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f6450.9%
Applied rewrites50.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ (fmax x y) (fmin x y))))
(if (<= (fmin x y) -2.9e-91)
(/ (/ (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 (fmin(x, y) <= -2.9e-91) {
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 (fmin(x, y) <= (-2.9d-91)) 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 (fmin(x, y) <= -2.9e-91) {
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 fmin(x, y) <= -2.9e-91: 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 (fmin(x, y) <= -2.9e-91) 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 (min(x, y) <= -2.9e-91) 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[Min[x, y], $MachinePrecision], -2.9e-91], 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{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\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 x < -2.9000000000000001e-91Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
if -2.9000000000000001e-91 < x Initial program 69.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites99.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-+.f6450.9%
Applied rewrites50.9%
(FPCore (x y) :precision binary64 (if (<= (fmin x y) -2.9e-91) (/ (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 (fmin(x, y) <= -2.9e-91) {
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 (fmin(x, y) <= (-2.9d-91)) 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 (fmin(x, y) <= -2.9e-91) {
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 fmin(x, y) <= -2.9e-91: 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 (fmin(x, y) <= -2.9e-91) 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 (min(x, y) <= -2.9e-91) 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[Min[x, y], $MachinePrecision], -2.9e-91], 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{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\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 x < -2.9000000000000001e-91Initial program 69.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
if -2.9000000000000001e-91 < x Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6450.4%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6450.4%
Applied rewrites50.4%
(FPCore (x y) :precision binary64 (if (<= (fmin x y) -2.9e-91) (/ (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 (fmin(x, y) <= -2.9e-91) {
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 (fmin(x, y) <= -2.9e-91) 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[Min[x, y], $MachinePrecision], -2.9e-91], 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{min}\left(x, y\right) \leq -2.9 \cdot 10^{-91}:\\
\;\;\;\;\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 x < -2.9000000000000001e-91Initial program 69.5%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
if -2.9000000000000001e-91 < x Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6448.8%
Applied rewrites48.8%
(FPCore (x y) :precision binary64 (/ (fmin x y) (fma (fmax x y) (fmax x y) (fmax x y))))
double code(double x, double y) {
return fmin(x, y) / fma(fmax(x, y), fmax(x, y), fmax(x, y));
}
function code(x, y) return Float64(fmin(x, y) / fma(fmax(x, y), fmax(x, y), fmax(x, y))) end
code[x_, y_] := N[(N[Min[x, y], $MachinePrecision] / N[(N[Max[x, y], $MachinePrecision] * N[Max[x, y], $MachinePrecision] + N[Max[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\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)}
Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6448.8%
Applied rewrites48.8%
(FPCore (x y) :precision binary64 (/ 1.0 (/ (fmax x y) (fmin x y))))
double code(double x, double y) {
return 1.0 / (fmax(x, y) / fmin(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 = 1.0d0 / (fmax(x, y) / fmin(x, y))
end function
public static double code(double x, double y) {
return 1.0 / (fmax(x, y) / fmin(x, y));
}
def code(x, y): return 1.0 / (fmax(x, y) / fmin(x, y))
function code(x, y) return Float64(1.0 / Float64(fmax(x, y) / fmin(x, y))) end
function tmp = code(x, y) tmp = 1.0 / (max(x, y) / min(x, y)); end
code[x_, y_] := N[(1.0 / N[(N[Max[x, y], $MachinePrecision] / N[Min[x, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{\frac{\mathsf{max}\left(x, y\right)}{\mathsf{min}\left(x, y\right)}}
Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6448.8%
Applied rewrites48.8%
Taylor expanded in y around 0
lower-/.f6427.1%
Applied rewrites27.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6427.5%
Applied rewrites27.5%
(FPCore (x y) :precision binary64 (/ (fmin x y) (fmax x y)))
double code(double x, double y) {
return fmin(x, y) / fmax(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 = fmin(x, y) / fmax(x, y)
end function
public static double code(double x, double y) {
return fmin(x, y) / fmax(x, y);
}
def code(x, y): return fmin(x, y) / fmax(x, y)
function code(x, y) return Float64(fmin(x, y) / fmax(x, y)) end
function tmp = code(x, y) tmp = min(x, y) / max(x, y); end
code[x_, y_] := N[(N[Min[x, y], $MachinePrecision] / N[Max[x, y], $MachinePrecision]), $MachinePrecision]
\frac{\mathsf{min}\left(x, y\right)}{\mathsf{max}\left(x, y\right)}
Initial program 69.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6448.8%
Applied rewrites48.8%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f6448.8%
Applied rewrites48.8%
Taylor expanded in y around 0
lower-/.f6427.1%
Applied rewrites27.1%
herbie shell --seed 2025212
(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))))