
(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 10 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 (- x -1.0)) (- (/ x y) -1.0)))
double code(double x, double y) {
return (x / (x - -1.0)) * ((x / y) - -1.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / (x - (-1.0d0))) * ((x / y) - (-1.0d0))
end function
public static double code(double x, double y) {
return (x / (x - -1.0)) * ((x / y) - -1.0);
}
def code(x, y): return (x / (x - -1.0)) * ((x / y) - -1.0)
function code(x, y) return Float64(Float64(x / Float64(x - -1.0)) * Float64(Float64(x / y) - -1.0)) end
function tmp = code(x, y) tmp = (x / (x - -1.0)) * ((x / y) - -1.0); end
code[x_, y_] := N[(N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x / y), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]
\frac{x}{x - -1} \cdot \left(\frac{x}{y} - -1\right)
Initial program 88.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval99.9%
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
(t_1 (* (/ (/ x y) (- x -1.0)) x)))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 500000000.0) (/ (fma (/ x y) x x) (- x -1.0)) t_1))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = ((x / y) / (x - -1.0)) * x;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= 500000000.0) {
tmp = fma((x / y), x, x) / (x - -1.0);
} 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 / y) / Float64(x - -1.0)) * x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = t_1; elseif (t_0 <= 500000000.0) tmp = Float64(fma(Float64(x / y), x, x) / Float64(x - -1.0)); 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 / y), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], t$95$1, If[LessEqual[t$95$0, 500000000.0], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / N[(x - -1.0), $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}{y}}{x - -1} \cdot x\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 500000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 5e8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
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-+.f6445.5%
Applied rewrites45.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5e8Initial program 88.3%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.3%
Applied rewrites88.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
(t_1 (* (/ (/ x y) (- x -1.0)) x)))
(if (<= t_0 -50.0)
t_1
(if (<= t_0 1e-7)
(* (fma (- (/ 1.0 y) 1.0) x 1.0) x)
(if (<= t_0 2.0) (/ x (- x -1.0)) t_1)))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = ((x / y) / (x - -1.0)) * x;
double tmp;
if (t_0 <= -50.0) {
tmp = t_1;
} else if (t_0 <= 1e-7) {
tmp = fma(((1.0 / y) - 1.0), x, 1.0) * x;
} else if (t_0 <= 2.0) {
tmp = x / (x - -1.0);
} 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 / y) / Float64(x - -1.0)) * x) tmp = 0.0 if (t_0 <= -50.0) tmp = t_1; elseif (t_0 <= 1e-7) tmp = Float64(fma(Float64(Float64(1.0 / y) - 1.0), x, 1.0) * x); elseif (t_0 <= 2.0) tmp = Float64(x / Float64(x - -1.0)); 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 / y), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], t$95$1, If[LessEqual[t$95$0, 1e-7], N[(N[(N[(N[(1.0 / y), $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $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}{y}}{x - -1} \cdot x\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{y} - 1, x, 1\right) \cdot x\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -50 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
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-+.f6445.5%
Applied rewrites45.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
if -50 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999995e-8Initial program 88.3%
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 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f6456.1%
Applied rewrites56.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6456.1%
Applied rewrites56.1%
if 9.9999999999999995e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
(t_1 (* (/ (/ x y) (- x -1.0)) x)))
(if (<= t_0 -50.0)
t_1
(if (<= t_0 1e-7)
(/ (fma (/ x y) x x) 1.0)
(if (<= t_0 2.0) (/ x (- x -1.0)) t_1)))))double code(double x, double y) {
double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
double t_1 = ((x / y) / (x - -1.0)) * x;
double tmp;
if (t_0 <= -50.0) {
tmp = t_1;
} else if (t_0 <= 1e-7) {
tmp = fma((x / y), x, x) / 1.0;
} else if (t_0 <= 2.0) {
tmp = x / (x - -1.0);
} 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 / y) / Float64(x - -1.0)) * x) tmp = 0.0 if (t_0 <= -50.0) tmp = t_1; elseif (t_0 <= 1e-7) tmp = Float64(fma(Float64(x / y), x, x) / 1.0); elseif (t_0 <= 2.0) tmp = Float64(x / Float64(x - -1.0)); 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 / y), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, -50.0], t$95$1, If[LessEqual[t$95$0, 1e-7], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $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}{y}}{x - -1} \cdot x\\
\mathbf{if}\;t\_0 \leq -50:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -50 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
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-+.f6445.5%
Applied rewrites45.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
if -50 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999995e-8Initial program 88.3%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.3%
Applied rewrites88.3%
Taylor expanded in x around 0
Applied rewrites56.2%
if 9.9999999999999995e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 -50.0)
(* (/ x (fma y x y)) x)
(if (<= t_0 1e-7)
(/ (fma (/ x y) x x) 1.0)
(if (<= t_0 2.0) (/ 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 <= -50.0) {
tmp = (x / fma(y, x, y)) * x;
} else if (t_0 <= 1e-7) {
tmp = fma((x / y), x, x) / 1.0;
} else if (t_0 <= 2.0) {
tmp = 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 <= -50.0) tmp = Float64(Float64(x / fma(y, x, y)) * x); elseif (t_0 <= 1e-7) tmp = Float64(fma(Float64(x / y), x, x) / 1.0); elseif (t_0 <= 2.0) tmp = Float64(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, -50.0], N[(N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$0, 1e-7], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / 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 -50:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, x, y\right)} \cdot x\\
\mathbf{elif}\;t\_0 \leq 10^{-7}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{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))) < -50Initial program 88.3%
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-+.f6445.5%
Applied rewrites45.5%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6445.5%
Applied rewrites45.5%
if -50 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999995e-8Initial program 88.3%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
distribute-lft1-inN/A
lower-fma.f6488.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
metadata-eval88.3%
Applied rewrites88.3%
Taylor expanded in x around 0
Applied rewrites56.2%
if 9.9999999999999995e-8 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
if 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
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.4%
Applied rewrites39.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
(if (<= t_0 -50.0)
(* (/ x (fma y x y)) x)
(if (<= t_0 2.0) (/ 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 <= -50.0) {
tmp = (x / fma(y, x, y)) * x;
} else if (t_0 <= 2.0) {
tmp = 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 <= -50.0) tmp = Float64(Float64(x / fma(y, x, y)) * x); elseif (t_0 <= 2.0) tmp = Float64(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, -50.0], N[(N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / 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 -50:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(y, x, y\right)} \cdot x\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{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))) < -50Initial program 88.3%
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-+.f6445.5%
Applied rewrites45.5%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f6445.5%
Applied rewrites45.5%
if -50 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
if 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
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.4%
Applied rewrites39.4%
(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 -50.0) t_1 (if (<= t_0 2.0) (/ x (- x -1.0)) 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 <= -50.0) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = x / (x - -1.0);
} 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 <= (-50.0d0)) then
tmp = t_1
else if (t_0 <= 2.0d0) then
tmp = x / (x - (-1.0d0))
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 <= -50.0) {
tmp = t_1;
} else if (t_0 <= 2.0) {
tmp = x / (x - -1.0);
} 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 <= -50.0: tmp = t_1 elif t_0 <= 2.0: tmp = x / (x - -1.0) 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 <= -50.0) tmp = t_1; elseif (t_0 <= 2.0) tmp = Float64(x / Float64(x - -1.0)); 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 <= -50.0) tmp = t_1; elseif (t_0 <= 2.0) tmp = x / (x - -1.0); 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, -50.0], t$95$1, If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $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 -50:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\frac{x}{x - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -50 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
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.4%
Applied rewrites39.4%
if -50 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
(FPCore (x y) :precision binary64 (/ x (- x -1.0)))
double code(double x, double y) {
return 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 = x / (x - (-1.0d0))
end function
public static double code(double x, double y) {
return x / (x - -1.0);
}
def code(x, y): return x / (x - -1.0)
function code(x, y) return Float64(x / Float64(x - -1.0)) end
function tmp = code(x, y) tmp = x / (x - -1.0); end
code[x_, y_] := N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]
\frac{x}{x - -1}
Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
(FPCore (x y) :precision binary64 (if (<= (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)) 5e-9) x (- 1.0 (/ 1.0 x))))
double code(double x, double y) {
double tmp;
if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 5e-9) {
tmp = x;
} else {
tmp = 1.0 - (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)) <= 5d-9) then
tmp = x
else
tmp = 1.0d0 - (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)) <= 5e-9) {
tmp = x;
} else {
tmp = 1.0 - (1.0 / x);
}
return tmp;
}
def code(x, y): tmp = 0 if ((x * ((x / y) + 1.0)) / (x + 1.0)) <= 5e-9: tmp = x else: tmp = 1.0 - (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)) <= 5e-9) tmp = x; else tmp = Float64(1.0 - Float64(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)) <= 5e-9) tmp = x; else tmp = 1.0 - (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], 5e-9], x, N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{1}{x}\\
\end{array}
if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000001e-9Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites39.0%
if 5.0000000000000001e-9 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-+.f6450.7%
Applied rewrites50.7%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lift--.f6450.7%
Applied rewrites50.7%
Taylor expanded in x around inf
lower--.f64N/A
lower-/.f6413.8%
Applied rewrites13.8%
(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
x
Initial program 88.3%
Taylor expanded in x around 0
Applied rewrites39.0%
herbie shell --seed 2025192
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))