
(FPCore (x y) :precision binary64 (- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))
double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - (1.0d0 / (x * 9.0d0))) - (y / (3.0d0 * sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * Math.sqrt(x)));
}
def code(x, y): return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(1.0 / Float64(x * 9.0))) - Float64(y / Float64(3.0 * sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{1}{x \cdot 9}\right) - \frac{y}{3 \cdot \sqrt{x}}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))
double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 - (1.0d0 / (x * 9.0d0))) - (y / (3.0d0 * sqrt(x)))
end function
public static double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * Math.sqrt(x)));
}
def code(x, y): return (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * math.sqrt(x)))
function code(x, y) return Float64(Float64(1.0 - Float64(1.0 / Float64(x * 9.0))) - Float64(y / Float64(3.0 * sqrt(x)))) end
function tmp = code(x, y) tmp = (1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x))); end
code[x_, y_] := N[(N[(1.0 - N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{1}{x \cdot 9}\right) - \frac{y}{3 \cdot \sqrt{x}}
\end{array}
(FPCore (x y) :precision binary64 (fma (/ -0.3333333333333333 (sqrt x)) y (- 1.0 (/ 0.1111111111111111 x))))
double code(double x, double y) {
return fma((-0.3333333333333333 / sqrt(x)), y, (1.0 - (0.1111111111111111 / x)));
}
function code(x, y) return fma(Float64(-0.3333333333333333 / sqrt(x)), y, Float64(1.0 - Float64(0.1111111111111111 / x))) end
code[x_, y_] := N[(N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * y + N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{-0.3333333333333333}{\sqrt{x}}, y, 1 - \frac{0.1111111111111111}{x}\right)
\end{array}
Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-eval99.6
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.6
Applied rewrites99.6%
(FPCore (x y) :precision binary64 (- (/ -0.1111111111111111 x) (fma (/ y (sqrt x)) 0.3333333333333333 -1.0)))
double code(double x, double y) {
return (-0.1111111111111111 / x) - fma((y / sqrt(x)), 0.3333333333333333, -1.0);
}
function code(x, y) return Float64(Float64(-0.1111111111111111 / x) - fma(Float64(y / sqrt(x)), 0.3333333333333333, -1.0)) end
code[x_, y_] := N[(N[(-0.1111111111111111 / x), $MachinePrecision] - N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.1111111111111111}{x} - \mathsf{fma}\left(\frac{y}{\sqrt{x}}, 0.3333333333333333, -1\right)
\end{array}
Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
(FPCore (x y) :precision binary64 (if (<= x 1.1e+102) (/ (fma (* y -0.3333333333333333) (sqrt x) (- x 0.1111111111111111)) x) (fma (* (sqrt (/ 1.0 x)) y) -0.3333333333333333 1.0)))
double code(double x, double y) {
double tmp;
if (x <= 1.1e+102) {
tmp = fma((y * -0.3333333333333333), sqrt(x), (x - 0.1111111111111111)) / x;
} else {
tmp = fma((sqrt((1.0 / x)) * y), -0.3333333333333333, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 1.1e+102) tmp = Float64(fma(Float64(y * -0.3333333333333333), sqrt(x), Float64(x - 0.1111111111111111)) / x); else tmp = fma(Float64(sqrt(Float64(1.0 / x)) * y), -0.3333333333333333, 1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, 1.1e+102], N[(N[(N[(y * -0.3333333333333333), $MachinePrecision] * N[Sqrt[x], $MachinePrecision] + N[(x - 0.1111111111111111), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{+102}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y \cdot -0.3333333333333333, \sqrt{x}, x - 0.1111111111111111\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{1}{x}} \cdot y, -0.3333333333333333, 1\right)\\
\end{array}
\end{array}
if x < 1.10000000000000004e102Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
mult-flipN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-eval99.6
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval99.6
Applied rewrites99.6%
Applied rewrites93.7%
if 1.10000000000000004e102 < x Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
(FPCore (x y) :precision binary64 (if (<= x 0.056) (- (/ -0.1111111111111111 x) (/ y (* 3.0 (sqrt x)))) (fma (* (sqrt (/ 1.0 x)) y) -0.3333333333333333 1.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.056) {
tmp = (-0.1111111111111111 / x) - (y / (3.0 * sqrt(x)));
} else {
tmp = fma((sqrt((1.0 / x)) * y), -0.3333333333333333, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.056) tmp = Float64(Float64(-0.1111111111111111 / x) - Float64(y / Float64(3.0 * sqrt(x)))); else tmp = fma(Float64(sqrt(Float64(1.0 / x)) * y), -0.3333333333333333, 1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.056], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.056:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - \frac{y}{3 \cdot \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{1}{x}} \cdot y, -0.3333333333333333, 1\right)\\
\end{array}
\end{array}
if x < 0.0560000000000000012Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6467.6
Applied rewrites67.6%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
associate-*l/N/A
associate-/l*N/A
metadata-evalN/A
associate-/r*N/A
lift-sqrt.f64N/A
mult-flipN/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-*.f6467.7
Applied rewrites67.7%
if 0.0560000000000000012 < x Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
(FPCore (x y) :precision binary64 (if (<= x 0.056) (- (/ -0.1111111111111111 x) (* 0.3333333333333333 (/ y (sqrt x)))) (fma (* (sqrt (/ 1.0 x)) y) -0.3333333333333333 1.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.056) {
tmp = (-0.1111111111111111 / x) - (0.3333333333333333 * (y / sqrt(x)));
} else {
tmp = fma((sqrt((1.0 / x)) * y), -0.3333333333333333, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.056) tmp = Float64(Float64(-0.1111111111111111 / x) - Float64(0.3333333333333333 * Float64(y / sqrt(x)))); else tmp = fma(Float64(sqrt(Float64(1.0 / x)) * y), -0.3333333333333333, 1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.056], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - N[(0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.056:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - 0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{1}{x}} \cdot y, -0.3333333333333333, 1\right)\\
\end{array}
\end{array}
if x < 0.0560000000000000012Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6467.6
Applied rewrites67.6%
if 0.0560000000000000012 < x Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
(FPCore (x y) :precision binary64 (if (<= x 0.11) (/ (- (* -0.3333333333333333 (* y (sqrt x))) 0.1111111111111111) x) (fma (* (sqrt (/ 1.0 x)) y) -0.3333333333333333 1.0)))
double code(double x, double y) {
double tmp;
if (x <= 0.11) {
tmp = ((-0.3333333333333333 * (y * sqrt(x))) - 0.1111111111111111) / x;
} else {
tmp = fma((sqrt((1.0 / x)) * y), -0.3333333333333333, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.11) tmp = Float64(Float64(Float64(-0.3333333333333333 * Float64(y * sqrt(x))) - 0.1111111111111111) / x); else tmp = fma(Float64(sqrt(Float64(1.0 / x)) * y), -0.3333333333333333, 1.0); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.11], N[(N[(N[(-0.3333333333333333 * N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.1111111111111111), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.11:\\
\;\;\;\;\frac{-0.3333333333333333 \cdot \left(y \cdot \sqrt{x}\right) - 0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{\frac{1}{x}} \cdot y, -0.3333333333333333, 1\right)\\
\end{array}
\end{array}
if x < 0.110000000000000001Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f6461.7
Applied rewrites61.7%
if 0.110000000000000001 < x Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (fma (* (sqrt (/ 1.0 x)) y) -0.3333333333333333 1.0)))
(if (<= y -2.95e+20)
t_0
(if (<= y 1.5e+43) (- (/ -0.1111111111111111 x) -1.0) t_0))))
double code(double x, double y) {
double t_0 = fma((sqrt((1.0 / x)) * y), -0.3333333333333333, 1.0);
double tmp;
if (y <= -2.95e+20) {
tmp = t_0;
} else if (y <= 1.5e+43) {
tmp = (-0.1111111111111111 / x) - -1.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = fma(Float64(sqrt(Float64(1.0 / x)) * y), -0.3333333333333333, 1.0) tmp = 0.0 if (y <= -2.95e+20) tmp = t_0; elseif (y <= 1.5e+43) tmp = Float64(Float64(-0.1111111111111111 / x) - -1.0); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(1.0 / x), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]}, If[LessEqual[y, -2.95e+20], t$95$0, If[LessEqual[y, 1.5e+43], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\sqrt{\frac{1}{x}} \cdot y, -0.3333333333333333, 1\right)\\
\mathbf{if}\;y \leq -2.95 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{+43}:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.95e20 or 1.50000000000000008e43 < y Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in x around inf
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
if -2.95e20 < y < 1.50000000000000008e43Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites62.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (/ y (sqrt x)) -3.0)))
(if (<= y -7e+59)
t_0
(if (<= y 2.15e+49) (- (/ -0.1111111111111111 x) -1.0) t_0))))
double code(double x, double y) {
double t_0 = (y / sqrt(x)) / -3.0;
double tmp;
if (y <= -7e+59) {
tmp = t_0;
} else if (y <= 2.15e+49) {
tmp = (-0.1111111111111111 / 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 = (y / sqrt(x)) / (-3.0d0)
if (y <= (-7d+59)) then
tmp = t_0
else if (y <= 2.15d+49) then
tmp = ((-0.1111111111111111d0) / x) - (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y / Math.sqrt(x)) / -3.0;
double tmp;
if (y <= -7e+59) {
tmp = t_0;
} else if (y <= 2.15e+49) {
tmp = (-0.1111111111111111 / x) - -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (y / math.sqrt(x)) / -3.0 tmp = 0 if y <= -7e+59: tmp = t_0 elif y <= 2.15e+49: tmp = (-0.1111111111111111 / x) - -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(y / sqrt(x)) / -3.0) tmp = 0.0 if (y <= -7e+59) tmp = t_0; elseif (y <= 2.15e+49) tmp = Float64(Float64(-0.1111111111111111 / x) - -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (y / sqrt(x)) / -3.0; tmp = 0.0; if (y <= -7e+59) tmp = t_0; elseif (y <= 2.15e+49) tmp = (-0.1111111111111111 / x) - -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / -3.0), $MachinePrecision]}, If[LessEqual[y, -7e+59], t$95$0, If[LessEqual[y, 2.15e+49], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{y}{\sqrt{x}}}{-3}\\
\mathbf{if}\;y \leq -7 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+49}:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7e59 or 2.15e49 < y Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f6432.2
Applied rewrites32.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6434.9
Applied rewrites34.9%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
mult-flipN/A
lift-sqrt.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
Applied rewrites38.2%
if -7e59 < y < 2.15e49Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites62.8%
(FPCore (x y)
:precision binary64
(if (<= y -7e+59)
(* -0.3333333333333333 (/ y (sqrt x)))
(if (<= y 2.15e+49)
(- (/ -0.1111111111111111 x) -1.0)
(* (/ -0.3333333333333333 (sqrt x)) y))))
double code(double x, double y) {
double tmp;
if (y <= -7e+59) {
tmp = -0.3333333333333333 * (y / sqrt(x));
} else if (y <= 2.15e+49) {
tmp = (-0.1111111111111111 / x) - -1.0;
} else {
tmp = (-0.3333333333333333 / sqrt(x)) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-7d+59)) then
tmp = (-0.3333333333333333d0) * (y / sqrt(x))
else if (y <= 2.15d+49) then
tmp = ((-0.1111111111111111d0) / x) - (-1.0d0)
else
tmp = ((-0.3333333333333333d0) / sqrt(x)) * y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -7e+59) {
tmp = -0.3333333333333333 * (y / Math.sqrt(x));
} else if (y <= 2.15e+49) {
tmp = (-0.1111111111111111 / x) - -1.0;
} else {
tmp = (-0.3333333333333333 / Math.sqrt(x)) * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -7e+59: tmp = -0.3333333333333333 * (y / math.sqrt(x)) elif y <= 2.15e+49: tmp = (-0.1111111111111111 / x) - -1.0 else: tmp = (-0.3333333333333333 / math.sqrt(x)) * y return tmp
function code(x, y) tmp = 0.0 if (y <= -7e+59) tmp = Float64(-0.3333333333333333 * Float64(y / sqrt(x))); elseif (y <= 2.15e+49) tmp = Float64(Float64(-0.1111111111111111 / x) - -1.0); else tmp = Float64(Float64(-0.3333333333333333 / sqrt(x)) * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -7e+59) tmp = -0.3333333333333333 * (y / sqrt(x)); elseif (y <= 2.15e+49) tmp = (-0.1111111111111111 / x) - -1.0; else tmp = (-0.3333333333333333 / sqrt(x)) * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -7e+59], N[(-0.3333333333333333 * N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.15e+49], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - -1.0), $MachinePrecision], N[(N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+59}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{y}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+49}:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - -1\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.3333333333333333}{\sqrt{x}} \cdot y\\
\end{array}
\end{array}
if y < -7e59Initial program 99.7%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f64N/A
lower-sqrt.f6438.2
Applied rewrites38.2%
if -7e59 < y < 2.15e49Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites62.8%
if 2.15e49 < y Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f6432.2
Applied rewrites32.2%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
mult-flipN/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ -0.3333333333333333 (sqrt x)) y)))
(if (<= y -7e+59)
t_0
(if (<= y 2.15e+49) (- (/ -0.1111111111111111 x) -1.0) t_0))))
double code(double x, double y) {
double t_0 = (-0.3333333333333333 / sqrt(x)) * y;
double tmp;
if (y <= -7e+59) {
tmp = t_0;
} else if (y <= 2.15e+49) {
tmp = (-0.1111111111111111 / 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 = ((-0.3333333333333333d0) / sqrt(x)) * y
if (y <= (-7d+59)) then
tmp = t_0
else if (y <= 2.15d+49) then
tmp = ((-0.1111111111111111d0) / x) - (-1.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (-0.3333333333333333 / Math.sqrt(x)) * y;
double tmp;
if (y <= -7e+59) {
tmp = t_0;
} else if (y <= 2.15e+49) {
tmp = (-0.1111111111111111 / x) - -1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (-0.3333333333333333 / math.sqrt(x)) * y tmp = 0 if y <= -7e+59: tmp = t_0 elif y <= 2.15e+49: tmp = (-0.1111111111111111 / x) - -1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(-0.3333333333333333 / sqrt(x)) * y) tmp = 0.0 if (y <= -7e+59) tmp = t_0; elseif (y <= 2.15e+49) tmp = Float64(Float64(-0.1111111111111111 / x) - -1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (-0.3333333333333333 / sqrt(x)) * y; tmp = 0.0; if (y <= -7e+59) tmp = t_0; elseif (y <= 2.15e+49) tmp = (-0.1111111111111111 / x) - -1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -7e+59], t$95$0, If[LessEqual[y, 2.15e+49], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - -1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333}{\sqrt{x}} \cdot y\\
\mathbf{if}\;y \leq -7 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+49}:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - -1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -7e59 or 2.15e49 < y Initial program 99.7%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
distribute-neg-fracN/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-upN/A
inv-powN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-fma.f64N/A
Applied rewrites99.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sqrt.f6432.2
Applied rewrites32.2%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
lift-sqrt.f64N/A
pow1/2N/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
mult-flipN/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if -7e59 < y < 2.15e49Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites62.8%
(FPCore (x y) :precision binary64 (- (/ -0.1111111111111111 x) -1.0))
double code(double x, double y) {
return (-0.1111111111111111 / 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 = ((-0.1111111111111111d0) / x) - (-1.0d0)
end function
public static double code(double x, double y) {
return (-0.1111111111111111 / x) - -1.0;
}
def code(x, y): return (-0.1111111111111111 / x) - -1.0
function code(x, y) return Float64(Float64(-0.1111111111111111 / x) - -1.0) end
function tmp = code(x, y) tmp = (-0.1111111111111111 / x) - -1.0; end
code[x_, y_] := N[(N[(-0.1111111111111111 / x), $MachinePrecision] - -1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.1111111111111111}{x} - -1
\end{array}
Initial program 99.7%
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-flipN/A
associate--r+N/A
sub-negateN/A
lower--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
distribute-neg-fracN/A
lower-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
add-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites62.8%
(FPCore (x y) :precision binary64 (if (<= (- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))) -50.0) (/ -0.1111111111111111 x) 1.0))
double code(double x, double y) {
double tmp;
if (((1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x)))) <= -50.0) {
tmp = -0.1111111111111111 / 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 (((1.0d0 - (1.0d0 / (x * 9.0d0))) - (y / (3.0d0 * sqrt(x)))) <= (-50.0d0)) then
tmp = (-0.1111111111111111d0) / x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (((1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * Math.sqrt(x)))) <= -50.0) {
tmp = -0.1111111111111111 / x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if ((1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * math.sqrt(x)))) <= -50.0: tmp = -0.1111111111111111 / x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (Float64(Float64(1.0 - Float64(1.0 / Float64(x * 9.0))) - Float64(y / Float64(3.0 * sqrt(x)))) <= -50.0) tmp = Float64(-0.1111111111111111 / x); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (((1.0 - (1.0 / (x * 9.0))) - (y / (3.0 * sqrt(x)))) <= -50.0) tmp = -0.1111111111111111 / x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[(1.0 - N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -50.0], N[(-0.1111111111111111 / x), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \frac{1}{x \cdot 9}\right) - \frac{y}{3 \cdot \sqrt{x}} \leq -50:\\
\;\;\;\;\frac{-0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (-.f64 (-.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) (/.f64 y (*.f64 #s(literal 3 binary64) (sqrt.f64 x)))) < -50Initial program 99.7%
Taylor expanded in x around 0
lower-/.f6431.6
Applied rewrites31.6%
if -50 < (-.f64 (-.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) (*.f64 x #s(literal 9 binary64)))) (/.f64 y (*.f64 #s(literal 3 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites32.3%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 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 = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites32.3%
herbie shell --seed 2025154
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, D"
:precision binary64
(- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))))