
(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]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
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]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
(FPCore (x y) :precision binary64 (if (<= x -7500000000000.0) (- (/ (- x 1.0) y) -1.0) (if (<= x 3e+16) (/ (fma (/ x y) x x) (- x -1.0)) (- (/ x y) -1.0))))
double code(double x, double y) {
double tmp;
if (x <= -7500000000000.0) {
tmp = ((x - 1.0) / y) - -1.0;
} else if (x <= 3e+16) {
tmp = fma((x / y), x, x) / (x - -1.0);
} else {
tmp = (x / y) - -1.0;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -7500000000000.0) tmp = Float64(Float64(Float64(x - 1.0) / y) - -1.0); elseif (x <= 3e+16) tmp = Float64(fma(Float64(x / y), x, x) / Float64(x - -1.0)); else tmp = Float64(Float64(x / y) - -1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, -7500000000000.0], N[(N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision], If[LessEqual[x, 3e+16], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7500000000000:\\
\;\;\;\;\frac{x - 1}{y} - -1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+16}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - -1\\
\end{array}
\end{array}
if x < -7.5e12Initial program 76.4%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if -7.5e12 < x < 3e16Initial program 99.8%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lift-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.8
Applied rewrites99.8%
if 3e16 < x Initial program 76.0%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites100.0%
(FPCore (x y) :precision binary64 (if (<= x -3400000000000.0) (- (/ (- x 1.0) y) -1.0) (if (<= x 6.5e+14) (* x (/ (+ y x) (fma y x y))) (- (/ x y) -1.0))))
double code(double x, double y) {
double tmp;
if (x <= -3400000000000.0) {
tmp = ((x - 1.0) / y) - -1.0;
} else if (x <= 6.5e+14) {
tmp = x * ((y + x) / fma(y, x, y));
} else {
tmp = (x / y) - -1.0;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= -3400000000000.0) tmp = Float64(Float64(Float64(x - 1.0) / y) - -1.0); elseif (x <= 6.5e+14) tmp = Float64(x * Float64(Float64(y + x) / fma(y, x, y))); else tmp = Float64(Float64(x / y) - -1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, -3400000000000.0], N[(N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision], If[LessEqual[x, 6.5e+14], N[(x * N[(N[(y + x), $MachinePrecision] / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3400000000000:\\
\;\;\;\;\frac{x - 1}{y} - -1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{y + x}{\mathsf{fma}\left(y, x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - -1\\
\end{array}
\end{array}
if x < -3.4e12Initial program 76.4%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if -3.4e12 < x < 6.5e14Initial program 99.8%
Applied rewrites99.8%
if 6.5e14 < x Initial program 76.2%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
Applied rewrites100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (- (/ (- x 1.0) y) -1.0))) (if (<= x -1.0) t_0 (if (<= x 1.3) (/ (fma (/ x y) x x) 1.0) t_0))))
double code(double x, double y) {
double t_0 = ((x - 1.0) / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= 1.3) {
tmp = fma((x / y), x, x) / 1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(Float64(x - 1.0) / y) - -1.0) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= 1.3) tmp = Float64(fma(Float64(x / y), x, x) / 1.0); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, 1.3], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - 1}{y} - -1\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 1.30000000000000004 < x Initial program 77.3%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6498.3
Applied rewrites98.3%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6498.5
Applied rewrites98.5%
if -1 < x < 1.30000000000000004Initial program 99.9%
lift-*.f64N/A
lift-+.f64N/A
lift-/.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lift-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites97.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (/ x (fma y x y))))
(t_1 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_1 -1e+213)
(/ (- x 1.0) y)
(if (<= t_1 -5e-64)
t_0
(if (<= t_1 2.0) (/ x (- x -1.0)) (if (<= t_1 5e+206) t_0 (/ x y)))))))
double code(double x, double y) {
double t_0 = x * (x / fma(y, x, y));
double t_1 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_1 <= -1e+213) {
tmp = (x - 1.0) / y;
} else if (t_1 <= -5e-64) {
tmp = t_0;
} else if (t_1 <= 2.0) {
tmp = x / (x - -1.0);
} else if (t_1 <= 5e+206) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
function code(x, y) t_0 = Float64(x * Float64(x / fma(y, x, y))) t_1 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -1e+213) tmp = Float64(Float64(x - 1.0) / y); elseif (t_1 <= -5e-64) tmp = t_0; elseif (t_1 <= 2.0) tmp = Float64(x / Float64(x - -1.0)); elseif (t_1 <= 5e+206) tmp = t_0; else tmp = Float64(x / y); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+213], N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$1, -5e-64], t$95$0, If[LessEqual[t$95$1, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+206], t$95$0, N[(x / y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+213}:\\
\;\;\;\;\frac{x - 1}{y}\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+206}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -9.99999999999999984e212Initial program 55.5%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6497.7
Applied rewrites97.7%
Taylor expanded in y around 0
lift-/.f64N/A
lift--.f6497.7
Applied rewrites97.7%
if -9.99999999999999984e212 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -5.00000000000000033e-64 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000002e206Initial program 99.8%
Taylor expanded in y around 0
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6475.8
Applied rewrites75.8%
if -5.00000000000000033e-64 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6489.6
Applied rewrites89.6%
if 5.0000000000000002e206 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 99.8%
Taylor expanded in x around inf
lift-/.f6452.1
Applied rewrites52.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (/ (- x 1.0) y) -1.0)))
(if (<= x -1.0)
t_0
(if (<= x -2.9e-63)
(/ (* x x) y)
(if (<= x 220.0) (/ x (- x -1.0)) t_0)))))
double code(double x, double y) {
double t_0 = ((x - 1.0) / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -2.9e-63) {
tmp = (x * x) / y;
} else if (x <= 220.0) {
tmp = x / (x - -1.0);
} 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) / y) - (-1.0d0)
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= (-2.9d-63)) then
tmp = (x * x) / y
else if (x <= 220.0d0) then
tmp = x / (x - (-1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = ((x - 1.0) / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -2.9e-63) {
tmp = (x * x) / y;
} else if (x <= 220.0) {
tmp = x / (x - -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = ((x - 1.0) / y) - -1.0 tmp = 0 if x <= -1.0: tmp = t_0 elif x <= -2.9e-63: tmp = (x * x) / y elif x <= 220.0: tmp = x / (x - -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(Float64(x - 1.0) / y) - -1.0) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= -2.9e-63) tmp = Float64(Float64(x * x) / y); elseif (x <= 220.0) tmp = Float64(x / Float64(x - -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = ((x - 1.0) / y) - -1.0; tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= -2.9e-63) tmp = (x * x) / y; elseif (x <= 220.0) tmp = x / (x - -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, -2.9e-63], N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 220.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - 1}{y} - -1\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-63}:\\
\;\;\;\;\frac{x \cdot x}{y}\\
\mathbf{elif}\;x \leq 220:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 220 < x Initial program 77.2%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6498.6
Applied rewrites98.6%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6498.8
Applied rewrites98.8%
if -1 < x < -2.89999999999999975e-63Initial program 99.8%
Taylor expanded in y around 0
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6446.0
Applied rewrites46.0%
Taylor expanded in x around 0
Applied rewrites41.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6441.4
Applied rewrites41.4%
if -2.89999999999999975e-63 < x < 220Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6477.6
Applied rewrites77.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (/ x y) -1.0)))
(if (<= x -1.0)
t_0
(if (<= x -2.9e-63)
(/ (* x x) y)
(if (<= x 12500000.0) (/ x (- x -1.0)) t_0)))))
double code(double x, double y) {
double t_0 = (x / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -2.9e-63) {
tmp = (x * x) / y;
} else if (x <= 12500000.0) {
tmp = x / (x - -1.0);
} 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 / y) - (-1.0d0)
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= (-2.9d-63)) then
tmp = (x * x) / y
else if (x <= 12500000.0d0) then
tmp = x / (x - (-1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -2.9e-63) {
tmp = (x * x) / y;
} else if (x <= 12500000.0) {
tmp = x / (x - -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x / y) - -1.0 tmp = 0 if x <= -1.0: tmp = t_0 elif x <= -2.9e-63: tmp = (x * x) / y elif x <= 12500000.0: tmp = x / (x - -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x / y) - -1.0) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= -2.9e-63) tmp = Float64(Float64(x * x) / y); elseif (x <= 12500000.0) tmp = Float64(x / Float64(x - -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x / y) - -1.0; tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= -2.9e-63) tmp = (x * x) / y; elseif (x <= 12500000.0) tmp = x / (x - -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, -2.9e-63], N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 12500000.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} - -1\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-63}:\\
\;\;\;\;\frac{x \cdot x}{y}\\
\mathbf{elif}\;x \leq 12500000:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 1.25e7 < x Initial program 77.0%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6498.8
Applied rewrites98.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites98.6%
if -1 < x < -2.89999999999999975e-63Initial program 99.8%
Taylor expanded in y around 0
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6446.0
Applied rewrites46.0%
Taylor expanded in x around 0
Applied rewrites41.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6441.4
Applied rewrites41.4%
if -2.89999999999999975e-63 < x < 1.25e7Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6477.3
Applied rewrites77.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- (/ x y) -1.0)))
(if (<= x -1.0)
t_0
(if (<= x -2.9e-63)
(* x (/ x y))
(if (<= x 12500000.0) (/ x (- x -1.0)) t_0)))))
double code(double x, double y) {
double t_0 = (x / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -2.9e-63) {
tmp = x * (x / y);
} else if (x <= 12500000.0) {
tmp = x / (x - -1.0);
} 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 / y) - (-1.0d0)
if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= (-2.9d-63)) then
tmp = x * (x / y)
else if (x <= 12500000.0d0) then
tmp = x / (x - (-1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x / y) - -1.0;
double tmp;
if (x <= -1.0) {
tmp = t_0;
} else if (x <= -2.9e-63) {
tmp = x * (x / y);
} else if (x <= 12500000.0) {
tmp = x / (x - -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x / y) - -1.0 tmp = 0 if x <= -1.0: tmp = t_0 elif x <= -2.9e-63: tmp = x * (x / y) elif x <= 12500000.0: tmp = x / (x - -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x / y) - -1.0) tmp = 0.0 if (x <= -1.0) tmp = t_0; elseif (x <= -2.9e-63) tmp = Float64(x * Float64(x / y)); elseif (x <= 12500000.0) tmp = Float64(x / Float64(x - -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x / y) - -1.0; tmp = 0.0; if (x <= -1.0) tmp = t_0; elseif (x <= -2.9e-63) tmp = x * (x / y); elseif (x <= 12500000.0) tmp = x / (x - -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, -2.9e-63], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 12500000.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} - -1\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-63}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 12500000:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1 or 1.25e7 < x Initial program 77.0%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6498.8
Applied rewrites98.8%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6499.1
Applied rewrites99.1%
Taylor expanded in x around inf
Applied rewrites98.6%
if -1 < x < -2.89999999999999975e-63Initial program 99.8%
Taylor expanded in y around 0
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6446.0
Applied rewrites46.0%
Taylor expanded in x around 0
Applied rewrites41.4%
if -2.89999999999999975e-63 < x < 1.25e7Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6477.3
Applied rewrites77.3%
(FPCore (x y) :precision binary64 (let* ((t_0 (- (/ x y) -1.0))) (if (<= x -3950.0) t_0 (if (<= x 12500000.0) (/ x (- x -1.0)) t_0))))
double code(double x, double y) {
double t_0 = (x / y) - -1.0;
double tmp;
if (x <= -3950.0) {
tmp = t_0;
} else if (x <= 12500000.0) {
tmp = x / (x - -1.0);
} 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 / y) - (-1.0d0)
if (x <= (-3950.0d0)) then
tmp = t_0
else if (x <= 12500000.0d0) then
tmp = x / (x - (-1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x / y) - -1.0;
double tmp;
if (x <= -3950.0) {
tmp = t_0;
} else if (x <= 12500000.0) {
tmp = x / (x - -1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x / y) - -1.0 tmp = 0 if x <= -3950.0: tmp = t_0 elif x <= 12500000.0: tmp = x / (x - -1.0) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x / y) - -1.0) tmp = 0.0 if (x <= -3950.0) tmp = t_0; elseif (x <= 12500000.0) tmp = Float64(x / Float64(x - -1.0)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x / y) - -1.0; tmp = 0.0; if (x <= -3950.0) tmp = t_0; elseif (x <= 12500000.0) tmp = x / (x - -1.0); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[x, -3950.0], t$95$0, If[LessEqual[x, 12500000.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y} - -1\\
\mathbf{if}\;x \leq -3950:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 12500000:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3950 or 1.25e7 < x Initial program 76.9%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6499.2
Applied rewrites99.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6499.5
Applied rewrites99.5%
Taylor expanded in x around inf
Applied rewrites99.0%
if -3950 < x < 1.25e7Initial program 99.9%
Taylor expanded in y around inf
lower-/.f64N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
distribute-lft-inN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lft-mult-inverseN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6474.9
Applied rewrites74.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))) (t_1 (- (/ x y) -1.0))) (if (<= t_0 -400.0) t_1 (if (<= t_0 0.1) x t_1))))
double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = (x / y) - -1.0;
double tmp;
if (t_0 <= -400.0) {
tmp = t_1;
} else if (t_0 <= 0.1) {
tmp = 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 / y) - (-1.0d0)
if (t_0 <= (-400.0d0)) then
tmp = t_1
else if (t_0 <= 0.1d0) then
tmp = 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 / y) - -1.0;
double tmp;
if (t_0 <= -400.0) {
tmp = t_1;
} else if (t_0 <= 0.1) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) t_1 = (x / y) - -1.0 tmp = 0 if t_0 <= -400.0: tmp = t_1 elif t_0 <= 0.1: tmp = 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(x / y) - -1.0) tmp = 0.0 if (t_0 <= -400.0) tmp = t_1; elseif (t_0 <= 0.1) tmp = 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 / y) - -1.0; tmp = 0.0; if (t_0 <= -400.0) tmp = t_1; elseif (t_0 <= 0.1) tmp = 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[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -400.0], t$95$1, If[LessEqual[t$95$0, 0.1], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
t_1 := \frac{x}{y} - -1\\
\mathbf{if}\;t\_0 \leq -400:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -400 or 0.10000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 79.8%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6487.2
Applied rewrites87.2%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6487.4
Applied rewrites87.4%
Taylor expanded in x around inf
Applied rewrites87.3%
if -400 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.10000000000000001Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites84.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 -400.0)
(/ (- x 1.0) y)
(if (<= t_0 0.1) x (if (<= t_0 200.0) 1.0 (/ x y))))))
double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -400.0) {
tmp = (x - 1.0) / y;
} else if (t_0 <= 0.1) {
tmp = x;
} else if (t_0 <= 200.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
if (t_0 <= (-400.0d0)) then
tmp = (x - 1.0d0) / y
else if (t_0 <= 0.1d0) then
tmp = x
else if (t_0 <= 200.0d0) then
tmp = 1.0d0
else
tmp = x / y
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 <= -400.0) {
tmp = (x - 1.0) / y;
} else if (t_0 <= 0.1) {
tmp = x;
} else if (t_0 <= 200.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) tmp = 0 if t_0 <= -400.0: tmp = (x - 1.0) / y elif t_0 <= 0.1: tmp = x elif t_0 <= 200.0: tmp = 1.0 else: tmp = x / y 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 <= -400.0) tmp = Float64(Float64(x - 1.0) / y); elseif (t_0 <= 0.1) tmp = x; elseif (t_0 <= 200.0) tmp = 1.0; else tmp = Float64(x / y); 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 <= -400.0) tmp = (x - 1.0) / y; elseif (t_0 <= 0.1) tmp = x; elseif (t_0 <= 200.0) tmp = 1.0; else tmp = x / y; 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, -400.0], N[(N[(x - 1.0), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t$95$0, 0.1], x, If[LessEqual[t$95$0, 200.0], 1.0, N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -400:\\
\;\;\;\;\frac{x - 1}{y}\\
\mathbf{elif}\;t\_0 \leq 0.1:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_0 \leq 200:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -400Initial program 73.6%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6484.6
Applied rewrites84.6%
Taylor expanded in x around 0
associate--l+N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6484.8
Applied rewrites84.8%
Taylor expanded in y around 0
lift-/.f64N/A
lift--.f6484.0
Applied rewrites84.0%
if -400 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.10000000000000001Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites84.9%
if 0.10000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 200Initial program 100.0%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.6
Applied rewrites95.6%
Taylor expanded in y around inf
Applied rewrites90.5%
if 200 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 73.3%
Taylor expanded in x around inf
lift-/.f6483.9
Applied rewrites83.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 -400.0)
(/ x y)
(if (<= t_0 0.1) x (if (<= t_0 200.0) 1.0 (/ x y))))))
double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double tmp;
if (t_0 <= -400.0) {
tmp = x / y;
} else if (t_0 <= 0.1) {
tmp = x;
} else if (t_0 <= 200.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
if (t_0 <= (-400.0d0)) then
tmp = x / y
else if (t_0 <= 0.1d0) then
tmp = x
else if (t_0 <= 200.0d0) then
tmp = 1.0d0
else
tmp = x / y
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 <= -400.0) {
tmp = x / y;
} else if (t_0 <= 0.1) {
tmp = x;
} else if (t_0 <= 200.0) {
tmp = 1.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = (x * ((x / y) + 1.0)) / (x + 1.0) tmp = 0 if t_0 <= -400.0: tmp = x / y elif t_0 <= 0.1: tmp = x elif t_0 <= 200.0: tmp = 1.0 else: tmp = x / y 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 <= -400.0) tmp = Float64(x / y); elseif (t_0 <= 0.1) tmp = x; elseif (t_0 <= 200.0) tmp = 1.0; else tmp = Float64(x / y); 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 <= -400.0) tmp = x / y; elseif (t_0 <= 0.1) tmp = x; elseif (t_0 <= 200.0) tmp = 1.0; else tmp = x / y; 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, -400.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.1], x, If[LessEqual[t$95$0, 200.0], 1.0, N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -400:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;t\_0 \leq 0.1:\\
\;\;\;\;x\\
\mathbf{elif}\;t\_0 \leq 200:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -400 or 200 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 73.5%
Taylor expanded in x around inf
lift-/.f6483.9
Applied rewrites83.9%
if -400 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.10000000000000001Initial program 99.9%
Taylor expanded in x around 0
Applied rewrites84.9%
if 0.10000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 200Initial program 100.0%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6495.6
Applied rewrites95.6%
Taylor expanded in y around inf
Applied rewrites90.5%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)) 0.1) x 1.0))
double code(double x, double y) {
double tmp;
if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.1) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (((x * ((x / y) + 1.0d0)) / (x + 1.0d0)) <= 0.1d0) then
tmp = x
else
tmp = 1.0d0
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.1) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.1: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) <= 0.1) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.1) tmp = x; else tmp = 1.0; 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.1], x, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 0.1:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.10000000000000001Initial program 90.9%
Taylor expanded in x around 0
Applied rewrites57.1%
if 0.10000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 83.7%
Taylor expanded in x around inf
associate--l+N/A
+-commutativeN/A
distribute-rgt-inN/A
lft-mult-inverseN/A
lower-fma.f64N/A
associate-/r*N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f6488.9
Applied rewrites88.9%
Taylor expanded in y around inf
Applied rewrites38.3%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return 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
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 88.4%
Taylor expanded in x around 0
Applied rewrites38.6%
herbie shell --seed 2025130
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))