
(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 16 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 (- (- 1.0 (/ 1.0 (* x 9.0))) (/ (/ y (sqrt x)) 3.0)))
double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - ((y / sqrt(x)) / 3.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 - (1.0d0 / (x * 9.0d0))) - ((y / sqrt(x)) / 3.0d0)
end function
public static double code(double x, double y) {
return (1.0 - (1.0 / (x * 9.0))) - ((y / Math.sqrt(x)) / 3.0);
}
def code(x, y): return (1.0 - (1.0 / (x * 9.0))) - ((y / math.sqrt(x)) / 3.0)
function code(x, y) return Float64(Float64(1.0 - Float64(1.0 / Float64(x * 9.0))) - Float64(Float64(y / sqrt(x)) / 3.0)) end
function tmp = code(x, y) tmp = (1.0 - (1.0 / (x * 9.0))) - ((y / sqrt(x)) / 3.0); end
code[x_, y_] := N[(N[(1.0 - N[(1.0 / N[(x * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - \frac{1}{x \cdot 9}\right) - \frac{\frac{y}{\sqrt{x}}}{3}
\end{array}
Initial program 99.7%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f6499.7
Applied rewrites99.7%
(FPCore (x y) :precision binary64 (- 1.0 (fma (/ y (sqrt x)) 0.3333333333333333 (/ 1.0 (* 9.0 x)))))
double code(double x, double y) {
return 1.0 - fma((y / sqrt(x)), 0.3333333333333333, (1.0 / (9.0 * x)));
}
function code(x, y) return Float64(1.0 - fma(Float64(y / sqrt(x)), 0.3333333333333333, Float64(1.0 / Float64(9.0 * x)))) end
code[x_, y_] := N[(1.0 - N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + N[(1.0 / N[(9.0 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \mathsf{fma}\left(\frac{y}{\sqrt{x}}, 0.3333333333333333, \frac{1}{9 \cdot x}\right)
\end{array}
Initial program 99.7%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6454.8
Applied rewrites54.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6454.8
Applied rewrites54.8%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.6
Applied rewrites99.6%
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
(FPCore (x y) :precision binary64 (- 1.0 (fma (/ y (sqrt x)) 0.3333333333333333 (/ 0.1111111111111111 x))))
double code(double x, double y) {
return 1.0 - fma((y / sqrt(x)), 0.3333333333333333, (0.1111111111111111 / x));
}
function code(x, y) return Float64(1.0 - fma(Float64(y / sqrt(x)), 0.3333333333333333, Float64(0.1111111111111111 / x))) end
code[x_, y_] := N[(1.0 - N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 0.3333333333333333 + N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \mathsf{fma}\left(\frac{y}{\sqrt{x}}, 0.3333333333333333, \frac{0.1111111111111111}{x}\right)
\end{array}
Initial program 99.7%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6454.8
Applied rewrites54.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6454.8
Applied rewrites54.8%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.6
Applied rewrites99.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (sqrt x))))
(if (<= x 0.11)
(- (/ -0.1111111111111111 x) (* 0.3333333333333333 t_0))
(- 1.0 (/ t_0 3.0)))))
double code(double x, double y) {
double t_0 = y / sqrt(x);
double tmp;
if (x <= 0.11) {
tmp = (-0.1111111111111111 / x) - (0.3333333333333333 * t_0);
} else {
tmp = 1.0 - (t_0 / 3.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)
if (x <= 0.11d0) then
tmp = ((-0.1111111111111111d0) / x) - (0.3333333333333333d0 * t_0)
else
tmp = 1.0d0 - (t_0 / 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / Math.sqrt(x);
double tmp;
if (x <= 0.11) {
tmp = (-0.1111111111111111 / x) - (0.3333333333333333 * t_0);
} else {
tmp = 1.0 - (t_0 / 3.0);
}
return tmp;
}
def code(x, y): t_0 = y / math.sqrt(x) tmp = 0 if x <= 0.11: tmp = (-0.1111111111111111 / x) - (0.3333333333333333 * t_0) else: tmp = 1.0 - (t_0 / 3.0) return tmp
function code(x, y) t_0 = Float64(y / sqrt(x)) tmp = 0.0 if (x <= 0.11) tmp = Float64(Float64(-0.1111111111111111 / x) - Float64(0.3333333333333333 * t_0)); else tmp = Float64(1.0 - Float64(t_0 / 3.0)); end return tmp end
function tmp_2 = code(x, y) t_0 = y / sqrt(x); tmp = 0.0; if (x <= 0.11) tmp = (-0.1111111111111111 / x) - (0.3333333333333333 * t_0); else tmp = 1.0 - (t_0 / 3.0); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.11], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - N[(0.3333333333333333 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(t$95$0 / 3.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sqrt{x}}\\
\mathbf{if}\;x \leq 0.11:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - 0.3333333333333333 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{t\_0}{3}\\
\end{array}
\end{array}
if x < 0.110000000000000001Initial program 99.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f6499.5
Applied rewrites99.5%
Taylor expanded in x around 0
*-inversesN/A
inv-powN/A
unpow-prod-downN/A
inv-powN/A
metadata-evalN/A
*-commutativeN/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
lower-/.f6498.4
Applied rewrites98.4%
Taylor expanded in x around 0
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
frac-2negN/A
frac-2negN/A
lift-sqrt.f64N/A
lift-/.f64N/A
lower-*.f6498.4
Applied rewrites98.4%
if 0.110000000000000001 < x Initial program 99.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-inverses99.0
inv-pow99.0
unpow-prod-down99.0
inv-pow99.0
metadata-eval99.0
*-commutative99.0
associate-*r/99.0
metadata-eval99.0
div-sub99.0
Applied rewrites99.0%
(FPCore (x y) :precision binary64 (if (<= x 0.11) (- (/ -0.1111111111111111 x) (/ y (* 3.0 (sqrt x)))) (- 1.0 (/ (/ y (sqrt x)) 3.0))))
double code(double x, double y) {
double tmp;
if (x <= 0.11) {
tmp = (-0.1111111111111111 / x) - (y / (3.0 * sqrt(x)));
} else {
tmp = 1.0 - ((y / sqrt(x)) / 3.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 <= 0.11d0) then
tmp = ((-0.1111111111111111d0) / x) - (y / (3.0d0 * sqrt(x)))
else
tmp = 1.0d0 - ((y / sqrt(x)) / 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.11) {
tmp = (-0.1111111111111111 / x) - (y / (3.0 * Math.sqrt(x)));
} else {
tmp = 1.0 - ((y / Math.sqrt(x)) / 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.11: tmp = (-0.1111111111111111 / x) - (y / (3.0 * math.sqrt(x))) else: tmp = 1.0 - ((y / math.sqrt(x)) / 3.0) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.11) tmp = Float64(Float64(-0.1111111111111111 / x) - Float64(y / Float64(3.0 * sqrt(x)))); else tmp = Float64(1.0 - Float64(Float64(y / sqrt(x)) / 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.11) tmp = (-0.1111111111111111 / x) - (y / (3.0 * sqrt(x))); else tmp = 1.0 - ((y / sqrt(x)) / 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.11], N[(N[(-0.1111111111111111 / x), $MachinePrecision] - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.11:\\
\;\;\;\;\frac{-0.1111111111111111}{x} - \frac{y}{3 \cdot \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{y}{\sqrt{x}}}{3}\\
\end{array}
\end{array}
if x < 0.110000000000000001Initial program 99.6%
Taylor expanded in x around 0
lower-/.f6498.5
Applied rewrites98.5%
if 0.110000000000000001 < x Initial program 99.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-inverses99.0
inv-pow99.0
unpow-prod-down99.0
inv-pow99.0
metadata-eval99.0
*-commutative99.0
associate-*r/99.0
metadata-eval99.0
div-sub99.0
Applied rewrites99.0%
(FPCore (x y) :precision binary64 (if (<= x 0.11) (fma (/ -0.3333333333333333 (sqrt x)) y (/ -0.1111111111111111 x)) (- 1.0 (/ (/ y (sqrt x)) 3.0))))
double code(double x, double y) {
double tmp;
if (x <= 0.11) {
tmp = fma((-0.3333333333333333 / sqrt(x)), y, (-0.1111111111111111 / x));
} else {
tmp = 1.0 - ((y / sqrt(x)) / 3.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (x <= 0.11) tmp = fma(Float64(-0.3333333333333333 / sqrt(x)), y, Float64(-0.1111111111111111 / x)); else tmp = Float64(1.0 - Float64(Float64(y / sqrt(x)) / 3.0)); end return tmp end
code[x_, y_] := If[LessEqual[x, 0.11], N[(N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * y + N[(-0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.11:\\
\;\;\;\;\mathsf{fma}\left(\frac{-0.3333333333333333}{\sqrt{x}}, y, \frac{-0.1111111111111111}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{\frac{y}{\sqrt{x}}}{3}\\
\end{array}
\end{array}
if x < 0.110000000000000001Initial program 99.6%
Taylor expanded in x around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lower-neg.f6498.4
Applied rewrites98.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6498.4
Applied rewrites98.4%
Taylor expanded in x around inf
*-commutativeN/A
metadata-evalN/A
associate-*l*N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
sqrt-pow2N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.5%
if 0.110000000000000001 < x Initial program 99.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-sqrt.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-inverses99.0
inv-pow99.0
unpow-prod-down99.0
inv-pow99.0
metadata-eval99.0
*-commutative99.0
associate-*r/99.0
metadata-eval99.0
div-sub99.0
Applied rewrites99.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.5e+58)
(- 1.0 (/ y (* 3.0 (sqrt x))))
(if (<= y 1.8e+45)
(- 1.0 (/ 0.1111111111111111 x))
(fma (/ y (sqrt x)) -0.3333333333333333 1.0))))
double code(double x, double y) {
double tmp;
if (y <= -5.5e+58) {
tmp = 1.0 - (y / (3.0 * sqrt(x)));
} else if (y <= 1.8e+45) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = fma((y / sqrt(x)), -0.3333333333333333, 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -5.5e+58) tmp = Float64(1.0 - Float64(y / Float64(3.0 * sqrt(x)))); elseif (y <= 1.8e+45) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = fma(Float64(y / sqrt(x)), -0.3333333333333333, 1.0); end return tmp end
code[x_, y_] := If[LessEqual[y, -5.5e+58], N[(1.0 - N[(y / N[(3.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+45], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+58}:\\
\;\;\;\;1 - \frac{y}{3 \cdot \sqrt{x}}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+45}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{\sqrt{x}}, -0.3333333333333333, 1\right)\\
\end{array}
\end{array}
if y < -5.4999999999999999e58Initial program 99.5%
Taylor expanded in x around inf
Applied rewrites93.1%
if -5.4999999999999999e58 < y < 1.8e45Initial program 99.8%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.9
Applied rewrites52.9%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lift-/.f6496.9
Applied rewrites96.9%
if 1.8e45 < y Initial program 99.6%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6462.5
Applied rewrites62.5%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6462.5
Applied rewrites62.5%
Taylor expanded in x around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f6492.4
Applied rewrites92.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (fma (/ y (sqrt x)) -0.3333333333333333 1.0)))
(if (<= y -5.5e+58)
t_0
(if (<= y 1.8e+45) (- 1.0 (/ 0.1111111111111111 x)) t_0))))
double code(double x, double y) {
double t_0 = fma((y / sqrt(x)), -0.3333333333333333, 1.0);
double tmp;
if (y <= -5.5e+58) {
tmp = t_0;
} else if (y <= 1.8e+45) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = fma(Float64(y / sqrt(x)), -0.3333333333333333, 1.0) tmp = 0.0 if (y <= -5.5e+58) tmp = t_0; elseif (y <= 1.8e+45) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333 + 1.0), $MachinePrecision]}, If[LessEqual[y, -5.5e+58], t$95$0, If[LessEqual[y, 1.8e+45], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{y}{\sqrt{x}}, -0.3333333333333333, 1\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+45}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.4999999999999999e58 or 1.8e45 < y Initial program 99.6%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6457.3
Applied rewrites57.3%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6457.3
Applied rewrites57.3%
Taylor expanded in x around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f6492.7
Applied rewrites92.7%
if -5.4999999999999999e58 < y < 1.8e45Initial program 99.8%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.9
Applied rewrites52.9%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lift-/.f6496.9
Applied rewrites96.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (fma (/ -0.3333333333333333 (sqrt x)) y 1.0)))
(if (<= y -5.5e+58)
t_0
(if (<= y 1.8e+45) (- 1.0 (/ 0.1111111111111111 x)) t_0))))
double code(double x, double y) {
double t_0 = fma((-0.3333333333333333 / sqrt(x)), y, 1.0);
double tmp;
if (y <= -5.5e+58) {
tmp = t_0;
} else if (y <= 1.8e+45) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = fma(Float64(-0.3333333333333333 / sqrt(x)), y, 1.0) tmp = 0.0 if (y <= -5.5e+58) tmp = t_0; elseif (y <= 1.8e+45) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * y + 1.0), $MachinePrecision]}, If[LessEqual[y, -5.5e+58], t$95$0, If[LessEqual[y, 1.8e+45], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{-0.3333333333333333}{\sqrt{x}}, y, 1\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{+58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+45}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.4999999999999999e58 or 1.8e45 < y Initial program 99.6%
Taylor expanded in x around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6492.6
Applied rewrites92.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lower-fma.f64N/A
associate-*r*N/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6492.8
Applied rewrites92.8%
if -5.4999999999999999e58 < y < 1.8e45Initial program 99.8%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.9
Applied rewrites52.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.9
Applied rewrites52.9%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lift-/.f6496.9
Applied rewrites96.9%
(FPCore (x y)
:precision binary64
(if (<= y -5.6e+86)
(/ (* y -0.3333333333333333) (sqrt x))
(if (<= y 2e+69)
(- 1.0 (/ 0.1111111111111111 x))
(* (/ y (sqrt x)) -0.3333333333333333))))
double code(double x, double y) {
double tmp;
if (y <= -5.6e+86) {
tmp = (y * -0.3333333333333333) / sqrt(x);
} else if (y <= 2e+69) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (y / sqrt(x)) * -0.3333333333333333;
}
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 <= (-5.6d+86)) then
tmp = (y * (-0.3333333333333333d0)) / sqrt(x)
else if (y <= 2d+69) then
tmp = 1.0d0 - (0.1111111111111111d0 / x)
else
tmp = (y / sqrt(x)) * (-0.3333333333333333d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.6e+86) {
tmp = (y * -0.3333333333333333) / Math.sqrt(x);
} else if (y <= 2e+69) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (y / Math.sqrt(x)) * -0.3333333333333333;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.6e+86: tmp = (y * -0.3333333333333333) / math.sqrt(x) elif y <= 2e+69: tmp = 1.0 - (0.1111111111111111 / x) else: tmp = (y / math.sqrt(x)) * -0.3333333333333333 return tmp
function code(x, y) tmp = 0.0 if (y <= -5.6e+86) tmp = Float64(Float64(y * -0.3333333333333333) / sqrt(x)); elseif (y <= 2e+69) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = Float64(Float64(y / sqrt(x)) * -0.3333333333333333); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.6e+86) tmp = (y * -0.3333333333333333) / sqrt(x); elseif (y <= 2e+69) tmp = 1.0 - (0.1111111111111111 / x); else tmp = (y / sqrt(x)) * -0.3333333333333333; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.6e+86], N[(N[(y * -0.3333333333333333), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+69], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+86}:\\
\;\;\;\;\frac{y \cdot -0.3333333333333333}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+69}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{x}} \cdot -0.3333333333333333\\
\end{array}
\end{array}
if y < -5.60000000000000008e86Initial program 99.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6491.9
Applied rewrites91.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-sqrt.f6492.0
Applied rewrites92.0%
if -5.60000000000000008e86 < y < 2.0000000000000001e69Initial program 99.8%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.7
Applied rewrites52.7%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lift-/.f6494.2
Applied rewrites94.2%
if 2.0000000000000001e69 < y Initial program 99.6%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6463.8
Applied rewrites63.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6463.8
Applied rewrites63.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f6488.6
Applied rewrites88.6%
(FPCore (x y)
:precision binary64
(if (<= y -5.6e+86)
(/ (* y -0.3333333333333333) (sqrt x))
(if (<= y 2e+69)
(- 1.0 (/ 0.1111111111111111 x))
(* (/ -0.3333333333333333 (sqrt x)) y))))
double code(double x, double y) {
double tmp;
if (y <= -5.6e+86) {
tmp = (y * -0.3333333333333333) / sqrt(x);
} else if (y <= 2e+69) {
tmp = 1.0 - (0.1111111111111111 / x);
} 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 <= (-5.6d+86)) then
tmp = (y * (-0.3333333333333333d0)) / sqrt(x)
else if (y <= 2d+69) then
tmp = 1.0d0 - (0.1111111111111111d0 / x)
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 <= -5.6e+86) {
tmp = (y * -0.3333333333333333) / Math.sqrt(x);
} else if (y <= 2e+69) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = (-0.3333333333333333 / Math.sqrt(x)) * y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.6e+86: tmp = (y * -0.3333333333333333) / math.sqrt(x) elif y <= 2e+69: tmp = 1.0 - (0.1111111111111111 / x) else: tmp = (-0.3333333333333333 / math.sqrt(x)) * y return tmp
function code(x, y) tmp = 0.0 if (y <= -5.6e+86) tmp = Float64(Float64(y * -0.3333333333333333) / sqrt(x)); elseif (y <= 2e+69) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); else tmp = Float64(Float64(-0.3333333333333333 / sqrt(x)) * y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.6e+86) tmp = (y * -0.3333333333333333) / sqrt(x); elseif (y <= 2e+69) tmp = 1.0 - (0.1111111111111111 / x); else tmp = (-0.3333333333333333 / sqrt(x)) * y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.6e+86], N[(N[(y * -0.3333333333333333), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+69], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], N[(N[(-0.3333333333333333 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{+86}:\\
\;\;\;\;\frac{y \cdot -0.3333333333333333}{\sqrt{x}}\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+69}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.3333333333333333}{\sqrt{x}} \cdot y\\
\end{array}
\end{array}
if y < -5.60000000000000008e86Initial program 99.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6491.9
Applied rewrites91.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-sqrt.f6492.0
Applied rewrites92.0%
if -5.60000000000000008e86 < y < 2.0000000000000001e69Initial program 99.8%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.7
Applied rewrites52.7%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lift-/.f6494.2
Applied rewrites94.2%
if 2.0000000000000001e69 < y Initial program 99.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6488.5
Applied rewrites88.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*r*N/A
metadata-evalN/A
sqrt-divN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6488.6
Applied rewrites88.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ -0.3333333333333333 (sqrt x)) y)))
(if (<= y -5.6e+86)
t_0
(if (<= y 2e+69) (- 1.0 (/ 0.1111111111111111 x)) t_0))))
double code(double x, double y) {
double t_0 = (-0.3333333333333333 / sqrt(x)) * y;
double tmp;
if (y <= -5.6e+86) {
tmp = t_0;
} else if (y <= 2e+69) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = ((-0.3333333333333333d0) / sqrt(x)) * y
if (y <= (-5.6d+86)) then
tmp = t_0
else if (y <= 2d+69) then
tmp = 1.0d0 - (0.1111111111111111d0 / x)
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 <= -5.6e+86) {
tmp = t_0;
} else if (y <= 2e+69) {
tmp = 1.0 - (0.1111111111111111 / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (-0.3333333333333333 / math.sqrt(x)) * y tmp = 0 if y <= -5.6e+86: tmp = t_0 elif y <= 2e+69: tmp = 1.0 - (0.1111111111111111 / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(-0.3333333333333333 / sqrt(x)) * y) tmp = 0.0 if (y <= -5.6e+86) tmp = t_0; elseif (y <= 2e+69) tmp = Float64(1.0 - Float64(0.1111111111111111 / x)); 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 <= -5.6e+86) tmp = t_0; elseif (y <= 2e+69) tmp = 1.0 - (0.1111111111111111 / x); 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, -5.6e+86], t$95$0, If[LessEqual[y, 2e+69], N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-0.3333333333333333}{\sqrt{x}} \cdot y\\
\mathbf{if}\;y \leq -5.6 \cdot 10^{+86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+69}:\\
\;\;\;\;1 - \frac{0.1111111111111111}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -5.60000000000000008e86 or 2.0000000000000001e69 < y Initial program 99.5%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6490.1
Applied rewrites90.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*r*N/A
metadata-evalN/A
sqrt-divN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6490.2
Applied rewrites90.2%
if -5.60000000000000008e86 < y < 2.0000000000000001e69Initial program 99.8%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6452.7
Applied rewrites52.7%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
lift-/.f6494.2
Applied rewrites94.2%
(FPCore (x y) :precision binary64 (- 1.0 (/ 0.1111111111111111 x)))
double code(double x, double y) {
return 1.0 - (0.1111111111111111 / 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 - (0.1111111111111111d0 / x)
end function
public static double code(double x, double y) {
return 1.0 - (0.1111111111111111 / x);
}
def code(x, y): return 1.0 - (0.1111111111111111 / x)
function code(x, y) return Float64(1.0 - Float64(0.1111111111111111 / x)) end
function tmp = code(x, y) tmp = 1.0 - (0.1111111111111111 / x); end
code[x_, y_] := N[(1.0 - N[(0.1111111111111111 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \frac{0.1111111111111111}{x}
\end{array}
Initial program 99.7%
lift--.f64N/A
*-inversesN/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
frac-subN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6454.8
Applied rewrites54.8%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6454.8
Applied rewrites54.8%
Taylor expanded in x around inf
lower--.f64N/A
*-commutativeN/A
lower-fma.f64N/A
sqrt-divN/A
metadata-evalN/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sqrt.f64N/A
associate-*r/N/A
metadata-evalN/A
lift-/.f6499.6
Applied rewrites99.6%
Taylor expanded in y around 0
lift-/.f6461.9
Applied rewrites61.9%
(FPCore (x y) :precision binary64 (/ (- x 0.1111111111111111) x))
double code(double x, double y) {
return (x - 0.1111111111111111) / 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 - 0.1111111111111111d0) / x
end function
public static double code(double x, double y) {
return (x - 0.1111111111111111) / x;
}
def code(x, y): return (x - 0.1111111111111111) / x
function code(x, y) return Float64(Float64(x - 0.1111111111111111) / x) end
function tmp = code(x, y) tmp = (x - 0.1111111111111111) / x; end
code[x_, y_] := N[(N[(x - 0.1111111111111111), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - 0.1111111111111111}{x}
\end{array}
Initial program 99.7%
Taylor expanded in y around 0
*-inversesN/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
lower-/.f64N/A
lower--.f6461.9
Applied rewrites61.9%
(FPCore (x y) :precision binary64 (if (<= (- (- 1.0 (/ 1.0 (* x 9.0))) (/ y (* 3.0 (sqrt x)))) -1.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)))) <= -1.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)))) <= (-1.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)))) <= -1.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)))) <= -1.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)))) <= -1.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)))) <= -1.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], -1.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 -1:\\
\;\;\;\;\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)))) < -1Initial program 99.6%
Taylor expanded in y around 0
*-inversesN/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
lower-/.f64N/A
lower--.f6461.7
Applied rewrites61.7%
Taylor expanded in x around 0
Applied rewrites61.2%
if -1 < (-.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.8%
Taylor expanded in x around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6498.4
Applied rewrites98.4%
Taylor expanded in y around 0
Applied rewrites61.9%
(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
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lift-sqrt.f6468.2
Applied rewrites68.2%
Taylor expanded in y around 0
Applied rewrites31.1%
herbie shell --seed 2025130
(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)))))