
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
(FPCore (x y) :precision binary64 (* (/ x (- -1.0 x)) (- -1.0 (/ x y))))
double code(double x, double y) {
return (x / (-1.0 - x)) * (-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 = (x / ((-1.0d0) - x)) * ((-1.0d0) - (x / y))
end function
public static double code(double x, double y) {
return (x / (-1.0 - x)) * (-1.0 - (x / y));
}
def code(x, y): return (x / (-1.0 - x)) * (-1.0 - (x / y))
function code(x, y) return Float64(Float64(x / Float64(-1.0 - x)) * Float64(-1.0 - Float64(x / y))) end
function tmp = code(x, y) tmp = (x / (-1.0 - x)) * (-1.0 - (x / y)); end
code[x_, y_] := N[(N[(x / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x}{-1 - x} \cdot \left(-1 - \frac{x}{y}\right)
Initial program 88.4%
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
lift-+.f64N/A
*-rgt-identityN/A
distribute-lft1-inN/A
lift-+.f64N/A
times-fracN/A
Applied rewrites99.9%
(FPCore (x y) :precision binary64 (* (/ (+ y x) y) (/ x (- x -1.0))))
double code(double x, double y) {
return ((y + x) / y) * (x / (x - -1.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((y + x) / y) * (x / (x - (-1.0d0)))
end function
public static double code(double x, double y) {
return ((y + x) / y) * (x / (x - -1.0));
}
def code(x, y): return ((y + x) / y) * (x / (x - -1.0))
function code(x, y) return Float64(Float64(Float64(y + x) / y) * Float64(x / Float64(x - -1.0))) end
function tmp = code(x, y) tmp = ((y + x) / y) * (x / (x - -1.0)); end
code[x_, y_] := N[(N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision] * N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{y + x}{y} \cdot \frac{x}{x - -1}
Initial program 88.4%
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
lift-+.f64N/A
*-rgt-identityN/A
distribute-lft1-inN/A
lift-+.f64N/A
times-fracN/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
metadata-evalN/A
add-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 (- INFINITY))
(/ 1.0 (/ y x))
(if (<= t_0 5e+209)
(/ (fma (/ x y) x x) (- x -1.0))
(* (/ 1.0 y) x)))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = 1.0 / (y / x);
} else if (t_0 <= 5e+209) {
tmp = fma((x / y), x, x) / (x - -1.0);
} else {
tmp = (1.0 / y) * x;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(1.0 / Float64(y / x)); elseif (t_0 <= 5e+209) tmp = Float64(fma(Float64(x / y), x, x) / Float64(x - -1.0)); else tmp = Float64(Float64(1.0 / y) * x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+209], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+209}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot x\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0Initial program 88.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.2%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.2%
Applied rewrites88.2%
Taylor expanded in x around 0
lower-/.f6438.3%
Applied rewrites38.3%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999996e209Initial program 88.4%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.4%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.4%
Applied rewrites88.4%
if 4.9999999999999996e209 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
(t_1 (* (/ (/ x (- x -1.0)) y) x)))
(if (<= t_0 -1e+22)
t_1
(if (<= t_0 0.99999999999998)
(* (/ (+ x y) (fma x y y)) x)
(if (<= t_0 2.0) (/ x (+ 1.0 x)) t_1)))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = ((x / (x - -1.0)) / y) * x;
double tmp;
if (t_0 <= -1e+22) {
tmp = t_1;
} else if (t_0 <= 0.99999999999998) {
tmp = ((x + y) / fma(x, y, y)) * x;
} else if (t_0 <= 2.0) {
tmp = x / (1.0 + x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) t_1 = Float64(Float64(Float64(x / Float64(x - -1.0)) / y) * x) tmp = 0.0 if (t_0 <= -1e+22) tmp = t_1; elseif (t_0 <= 0.99999999999998) tmp = Float64(Float64(Float64(x + y) / fma(x, y, y)) * x); elseif (t_0 <= 2.0) tmp = Float64(x / Float64(1.0 + x)); else tmp = t_1; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+22], t$95$1, If[LessEqual[t$95$0, 0.99999999999998], N[(N[(N[(x + y), $MachinePrecision] / N[(x * y + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
t_1 := \frac{\frac{x}{x - -1}}{y} \cdot x\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.99999999999998:\\
\;\;\;\;\frac{x + y}{\mathsf{fma}\left(x, y, y\right)} \cdot x\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e22 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6446.1%
Applied rewrites46.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6452.0%
Applied rewrites52.0%
if -1e22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.99999999999998002Initial program 88.4%
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
lift-+.f64N/A
*-rgt-identityN/A
distribute-lft1-inN/A
lift-+.f64N/A
times-fracN/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift--.f64N/A
sub-negate-revN/A
metadata-evalN/A
add-flipN/A
lift-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
frac-2negN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
div-addN/A
*-inversesN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.7%
if 0.99999999999998002 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
(t_1 (* (/ (/ x (- x -1.0)) y) x)))
(if (<= t_0 -1e+22)
t_1
(if (<= t_0 1e-22)
(* (* -1.0 x) (- -1.0 (/ x y)))
(if (<= t_0 2.0) (/ 1.0 (/ (+ 1.0 x) x)) t_1)))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = ((x / (x - -1.0)) / y) * x;
double tmp;
if (t_0 <= -1e+22) {
tmp = t_1;
} else if (t_0 <= 1e-22) {
tmp = (-1.0 * x) * (-1.0 - (x / y));
} else if (t_0 <= 2.0) {
tmp = 1.0 / ((1.0 + x) / x);
} else {
tmp = 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 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
t_1 = ((x / (x - (-1.0d0))) / y) * x
if (t_0 <= (-1d+22)) then
tmp = t_1
else if (t_0 <= 1d-22) then
tmp = ((-1.0d0) * x) * ((-1.0d0) - (x / y))
else if (t_0 <= 2.0d0) then
tmp = 1.0d0 / ((1.0d0 + x) / x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = ((x / (x - -1.0)) / y) * x;
double tmp;
if (t_0 <= -1e+22) {
tmp = t_1;
} else if (t_0 <= 1e-22) {
tmp = (-1.0 * x) * (-1.0 - (x / y));
} else if (t_0 <= 2.0) {
tmp = 1.0 / ((1.0 + x) / x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) t_1 = ((x / (x - -1.0)) / y) * x tmp = 0 if t_0 <= -1e+22: tmp = t_1 elif t_0 <= 1e-22: tmp = (-1.0 * x) * (-1.0 - (x / y)) elif t_0 <= 2.0: tmp = 1.0 / ((1.0 + x) / x) else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) t_1 = Float64(Float64(Float64(x / Float64(x - -1.0)) / y) * x) tmp = 0.0 if (t_0 <= -1e+22) tmp = t_1; elseif (t_0 <= 1e-22) tmp = Float64(Float64(-1.0 * x) * Float64(-1.0 - Float64(x / y))); elseif (t_0 <= 2.0) tmp = Float64(1.0 / Float64(Float64(1.0 + x) / x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = (x * ((x / y) + 1.0)) / (x + 1.0); t_1 = ((x / (x - -1.0)) / y) * x; tmp = 0.0; if (t_0 <= -1e+22) tmp = t_1; elseif (t_0 <= 1e-22) tmp = (-1.0 * x) * (-1.0 - (x / y)); elseif (t_0 <= 2.0) tmp = 1.0 / ((1.0 + x) / x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+22], t$95$1, If[LessEqual[t$95$0, 1e-22], N[(N[(-1.0 * x), $MachinePrecision] * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(1.0 / N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
t_1 := \frac{\frac{x}{x - -1}}{y} \cdot x\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-22}:\\
\;\;\;\;\left(-1 \cdot x\right) \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{1}{\frac{1 + x}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e22 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6446.1%
Applied rewrites46.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6452.0%
Applied rewrites52.0%
if -1e22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1e-22Initial program 88.4%
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
lift-+.f64N/A
*-rgt-identityN/A
distribute-lft1-inN/A
lift-+.f64N/A
times-fracN/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-*.f6456.4%
Applied rewrites56.4%
if 1e-22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.2%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.2%
Applied rewrites88.2%
Taylor expanded in x around 0
lower-/.f6438.3%
Applied rewrites38.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.1%
Applied rewrites50.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 -1e+56)
(/ 1.0 (/ y x))
(if (<= t_0 1e-22)
(* (* -1.0 x) (- -1.0 (/ x y)))
(if (<= t_0 2.0) (/ 1.0 (/ (+ 1.0 x) x)) (* (/ 1.0 y) x))))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -1e+56) {
tmp = 1.0 / (y / x);
} else if (t_0 <= 1e-22) {
tmp = (-1.0 * x) * (-1.0 - (x / y));
} else if (t_0 <= 2.0) {
tmp = 1.0 / ((1.0 + x) / x);
} else {
tmp = (1.0 / y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
if (t_0 <= (-1d+56)) then
tmp = 1.0d0 / (y / x)
else if (t_0 <= 1d-22) then
tmp = ((-1.0d0) * x) * ((-1.0d0) - (x / y))
else if (t_0 <= 2.0d0) then
tmp = 1.0d0 / ((1.0d0 + x) / x)
else
tmp = (1.0d0 / y) * x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -1e+56) {
tmp = 1.0 / (y / x);
} else if (t_0 <= 1e-22) {
tmp = (-1.0 * x) * (-1.0 - (x / y));
} else if (t_0 <= 2.0) {
tmp = 1.0 / ((1.0 + x) / x);
} else {
tmp = (1.0 / y) * x;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) tmp = 0 if t_0 <= -1e+56: tmp = 1.0 / (y / x) elif t_0 <= 1e-22: tmp = (-1.0 * x) * (-1.0 - (x / y)) elif t_0 <= 2.0: tmp = 1.0 / ((1.0 + x) / x) else: tmp = (1.0 / y) * x return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= -1e+56) tmp = Float64(1.0 / Float64(y / x)); elseif (t_0 <= 1e-22) tmp = Float64(Float64(-1.0 * x) * Float64(-1.0 - Float64(x / y))); elseif (t_0 <= 2.0) tmp = Float64(1.0 / Float64(Float64(1.0 + x) / x)); else tmp = Float64(Float64(1.0 / y) * x); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * ((x / y) + 1.0)) / (x + 1.0); tmp = 0.0; if (t_0 <= -1e+56) tmp = 1.0 / (y / x); elseif (t_0 <= 1e-22) tmp = (-1.0 * x) * (-1.0 - (x / y)); elseif (t_0 <= 2.0) tmp = 1.0 / ((1.0 + x) / x); else tmp = (1.0 / y) * x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+56], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-22], N[(N[(-1.0 * x), $MachinePrecision] * N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(1.0 / N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * x), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+56}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\mathbf{elif}\;t\_0 \leq 10^{-22}:\\
\;\;\;\;\left(-1 \cdot x\right) \cdot \left(-1 - \frac{x}{y}\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{1}{\frac{1 + x}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot x\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1.0000000000000001e56Initial program 88.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.2%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.2%
Applied rewrites88.2%
Taylor expanded in x around 0
lower-/.f6438.3%
Applied rewrites38.3%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
if -1.0000000000000001e56 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1e-22Initial program 88.4%
lift-/.f64N/A
frac-2negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
lift-+.f64N/A
*-rgt-identityN/A
distribute-lft1-inN/A
lift-+.f64N/A
times-fracN/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower-*.f6456.4%
Applied rewrites56.4%
if 1e-22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.2%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.2%
Applied rewrites88.2%
Taylor expanded in x around 0
lower-/.f6438.3%
Applied rewrites38.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.1%
Applied rewrites50.1%
if 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 -1e+22)
(/ 1.0 (/ y x))
(if (<= t_0 2.0) (/ x (+ 1.0 x)) (* (/ 1.0 y) x)))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -1e+22) {
tmp = 1.0 / (y / x);
} else if (t_0 <= 2.0) {
tmp = x / (1.0 + x);
} else {
tmp = (1.0 / y) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
if (t_0 <= (-1d+22)) then
tmp = 1.0d0 / (y / x)
else if (t_0 <= 2.0d0) then
tmp = x / (1.0d0 + x)
else
tmp = (1.0d0 / y) * x
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -1e+22) {
tmp = 1.0 / (y / x);
} else if (t_0 <= 2.0) {
tmp = x / (1.0 + x);
} else {
tmp = (1.0 / y) * x;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) tmp = 0 if t_0 <= -1e+22: tmp = 1.0 / (y / x) elif t_0 <= 2.0: tmp = x / (1.0 + x) else: tmp = (1.0 / y) * x return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) tmp = 0.0 if (t_0 <= -1e+22) tmp = Float64(1.0 / Float64(y / x)); elseif (t_0 <= 2.0) tmp = Float64(x / Float64(1.0 + x)); else tmp = Float64(Float64(1.0 / y) * x); end return tmp end
function tmp_2 = code(x, y) t_0 = (x * ((x / y) + 1.0)) / (x + 1.0); tmp = 0.0; if (t_0 <= -1e+22) tmp = 1.0 / (y / x); elseif (t_0 <= 2.0) tmp = x / (1.0 + x); else tmp = (1.0 / y) * x; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+22], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+22}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot x\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e22Initial program 88.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6488.2%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.2%
Applied rewrites88.2%
Taylor expanded in x around 0
lower-/.f6438.3%
Applied rewrites38.3%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
if -1e22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
if 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
(t_1 (* (/ 1.0 y) x)))
(if (<= t_0 -1e+22) t_1 (if (<= t_0 2.0) (/ x (+ 1.0 x)) t_1))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = (1.0 / y) * x;
double tmp;
if (t_0 <= -1e+22) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = x / (1.0 + x);
} else {
tmp = 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 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
t_1 = (1.0d0 / y) * x
if (t_0 <= (-1d+22)) then
tmp = t_1
else if (t_0 <= 2.0d0) then
tmp = x / (1.0d0 + x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = (1.0 / y) * x;
double tmp;
if (t_0 <= -1e+22) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = x / (1.0 + x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) t_1 = (1.0 / y) * x tmp = 0 if t_0 <= -1e+22: tmp = t_1 elif t_0 <= 2.0: tmp = x / (1.0 + x) else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) t_1 = Float64(Float64(1.0 / y) * x) tmp = 0.0 if (t_0 <= -1e+22) tmp = t_1; elseif (t_0 <= 2.0) tmp = Float64(x / Float64(1.0 + x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = (x * ((x / y) + 1.0)) / (x + 1.0); t_1 = (1.0 / y) * x; tmp = 0.0; if (t_0 <= -1e+22) tmp = t_1; elseif (t_0 <= 2.0) tmp = x / (1.0 + x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+22], t$95$1, If[LessEqual[t$95$0, 2.0], N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
t_1 := \frac{1}{y} \cdot x\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{1 + x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e22 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in x around inf
lower-/.f6439.3%
Applied rewrites39.3%
if -1e22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (+ 1.0 x)))) (if (<= y -1.8e-142) t_0 (if (<= y 1.05e-177) (* (/ x y) x) t_0))))
double code(double x, double y) {
double t_0 = x / (1.0 + x);
double tmp;
if (y <= -1.8e-142) {
tmp = t_0;
} else if (y <= 1.05e-177) {
tmp = (x / y) * x;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = x / (1.0d0 + x)
if (y <= (-1.8d-142)) then
tmp = t_0
else if (y <= 1.05d-177) then
tmp = (x / y) * x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (1.0 + x);
double tmp;
if (y <= -1.8e-142) {
tmp = t_0;
} else if (y <= 1.05e-177) {
tmp = (x / y) * x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = x / (1.0 + x) tmp = 0 if y <= -1.8e-142: tmp = t_0 elif y <= 1.05e-177: tmp = (x / y) * x else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(x / Float64(1.0 + x)) tmp = 0.0 if (y <= -1.8e-142) tmp = t_0; elseif (y <= 1.05e-177) tmp = Float64(Float64(x / y) * x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (1.0 + x); tmp = 0.0; if (y <= -1.8e-142) tmp = t_0; elseif (y <= 1.05e-177) tmp = (x / y) * x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e-142], t$95$0, If[LessEqual[y, 1.05e-177], N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{x}{1 + x}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{-142}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-177}:\\
\;\;\;\;\frac{x}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.8e-142 or 1.05e-177 < y Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
if -1.8e-142 < y < 1.05e-177Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/l/N/A
lower-/.f64N/A
*-lft-identityN/A
lower-+.f64N/A
lower-*.f6487.7%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval87.7%
Applied rewrites87.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f6446.1%
Applied rewrites46.1%
Taylor expanded in x around 0
lower-/.f6421.7%
Applied rewrites21.7%
(FPCore (x y) :precision binary64 (/ x (+ 1.0 x)))
double code(double x, double y) {
return x / (1.0 + x);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / (1.0d0 + x)
end function
public static double code(double x, double y) {
return x / (1.0 + x);
}
def code(x, y): return x / (1.0 + x)
function code(x, y) return Float64(x / Float64(1.0 + x)) end
function tmp = code(x, y) tmp = x / (1.0 + x); end
code[x_, y_] := N[(x / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]
\frac{x}{1 + x}
Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)) 0.002) (/ x 1.0) (/ (- x 1.0) x)))
double code(double x, double y) {
double tmp;
if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.002) {
tmp = x / 1.0;
} else {
tmp = (x - 1.0) / x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((x * ((x / y) + 1.0d0)) / (x + 1.0d0)) <= 0.002d0) then
tmp = x / 1.0d0
else
tmp = (x - 1.0d0) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.002) {
tmp = x / 1.0;
} else {
tmp = (x - 1.0) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.002: tmp = x / 1.0 else: tmp = (x - 1.0) / x return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) <= 0.002) tmp = Float64(x / 1.0); else tmp = Float64(Float64(x - 1.0) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.002) tmp = x / 1.0; else tmp = (x - 1.0) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 0.002], N[(x / 1.0), $MachinePrecision], N[(N[(x - 1.0), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 0.002:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - 1}{x}\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2e-3Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
Applied rewrites38.4%
if 2e-3 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around inf
lower--.f64N/A
lower-/.f6413.8%
Applied rewrites13.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
*-lft-identityN/A
lower--.f6413.8%
Applied rewrites13.8%
(FPCore (x y) :precision binary64 (/ x 1.0))
double code(double x, double y) {
return x / 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / 1.0d0
end function
public static double code(double x, double y) {
return x / 1.0;
}
def code(x, y): return x / 1.0
function code(x, y) return Float64(x / 1.0) end
function tmp = code(x, y) tmp = x / 1.0; end
code[x_, y_] := N[(x / 1.0), $MachinePrecision]
\frac{x}{1}
Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around 0
Applied rewrites38.4%
(FPCore (x y) :precision binary64 (/ -1.0 x))
double code(double x, double y) {
return -1.0 / x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (-1.0d0) / x
end function
public static double code(double x, double y) {
return -1.0 / x;
}
def code(x, y): return -1.0 / x
function code(x, y) return Float64(-1.0 / x) end
function tmp = code(x, y) tmp = -1.0 / x; end
code[x_, y_] := N[(-1.0 / x), $MachinePrecision]
\frac{-1}{x}
Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.2%
Applied rewrites50.2%
Taylor expanded in x around inf
lower--.f64N/A
lower-/.f6413.8%
Applied rewrites13.8%
Taylor expanded in x around 0
lower-/.f642.4%
Applied rewrites2.4%
herbie shell --seed 2025212
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))