
(FPCore (alpha beta) :precision binary64 (let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0)))) (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) t_0) t_0) (+ t_0 1.0))))
double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
code = (((((alpha + beta) + (beta * alpha)) + 1.0d0) / t_0) / t_0) / (t_0 + 1.0d0)
end function
public static double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
def code(alpha, beta): t_0 = (alpha + beta) + (2.0 * 1.0) return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0)
function code(alpha, beta) t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) return Float64(Float64(Float64(Float64(Float64(Float64(alpha + beta) + Float64(beta * alpha)) + 1.0) / t_0) / t_0) / Float64(t_0 + 1.0)) end
function tmp = code(alpha, beta) t_0 = (alpha + beta) + (2.0 * 1.0); tmp = (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0); end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(alpha + beta), $MachinePrecision] + N[(beta * alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t\_0}}{t\_0}}{t\_0 + 1}
\end{array}
\end{array}
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (alpha beta) :precision binary64 (let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0)))) (/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) t_0) t_0) (+ t_0 1.0))))
double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
code = (((((alpha + beta) + (beta * alpha)) + 1.0d0) / t_0) / t_0) / (t_0 + 1.0d0)
end function
public static double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0);
}
def code(alpha, beta): t_0 = (alpha + beta) + (2.0 * 1.0) return (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0)
function code(alpha, beta) t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) return Float64(Float64(Float64(Float64(Float64(Float64(alpha + beta) + Float64(beta * alpha)) + 1.0) / t_0) / t_0) / Float64(t_0 + 1.0)) end
function tmp = code(alpha, beta) t_0 = (alpha + beta) + (2.0 * 1.0); tmp = (((((alpha + beta) + (beta * alpha)) + 1.0) / t_0) / t_0) / (t_0 + 1.0); end
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[(N[(N[(alpha + beta), $MachinePrecision] + N[(beta * alpha), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
\frac{\frac{\frac{\left(\left(\alpha + \beta\right) + \beta \cdot \alpha\right) + 1}{t\_0}}{t\_0}}{t\_0 + 1}
\end{array}
\end{array}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (- (+ beta alpha) -2.0)))
(if (<= beta 1.05e+148)
(/
(/ (- (fma beta alpha (+ beta alpha)) -1.0) t_0)
(* t_0 (+ 3.0 (+ beta alpha))))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 beta)))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = (beta + alpha) - -2.0;
double tmp;
if (beta <= 1.05e+148) {
tmp = ((fma(beta, alpha, (beta + alpha)) - -1.0) / t_0) / (t_0 * (3.0 + (beta + alpha)));
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(Float64(beta + alpha) - -2.0) tmp = 0.0 if (beta <= 1.05e+148) tmp = Float64(Float64(Float64(fma(beta, alpha, Float64(beta + alpha)) - -1.0) / t_0) / Float64(t_0 * Float64(3.0 + Float64(beta + alpha)))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + beta)); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] - -2.0), $MachinePrecision]}, If[LessEqual[beta, 1.05e+148], N[(N[(N[(N[(beta * alpha + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 * N[(3.0 + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) - -2\\
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+148}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) - -1}{t\_0}}{t\_0 \cdot \left(3 + \left(\beta + \alpha\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \beta}\\
\end{array}
\end{array}
if beta < 1.04999999999999999e148Initial program 94.6%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
metadata-evalN/A
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
metadata-evalN/A
lift-+.f64N/A
Applied rewrites92.9%
if 1.04999999999999999e148 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (- (+ beta alpha) -2.0)))
(if (<= beta 1.05e+148)
(/
(/ (- (fma beta alpha (+ beta alpha)) -1.0) (* t_0 t_0))
(+ 3.0 (+ beta alpha)))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 beta)))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = (beta + alpha) - -2.0;
double tmp;
if (beta <= 1.05e+148) {
tmp = ((fma(beta, alpha, (beta + alpha)) - -1.0) / (t_0 * t_0)) / (3.0 + (beta + alpha));
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
}
return tmp;
}
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(Float64(beta + alpha) - -2.0) tmp = 0.0 if (beta <= 1.05e+148) tmp = Float64(Float64(Float64(fma(beta, alpha, Float64(beta + alpha)) - -1.0) / Float64(t_0 * t_0)) / Float64(3.0 + Float64(beta + alpha))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + beta)); end return tmp end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] - -2.0), $MachinePrecision]}, If[LessEqual[beta, 1.05e+148], N[(N[(N[(N[(beta * alpha + N[(beta + alpha), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(3.0 + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) - -2\\
\mathbf{if}\;\beta \leq 1.05 \cdot 10^{+148}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\beta, \alpha, \beta + \alpha\right) - -1}{t\_0 \cdot t\_0}}{3 + \left(\beta + \alpha\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \beta}\\
\end{array}
\end{array}
if beta < 1.04999999999999999e148Initial program 94.6%
Applied rewrites92.8%
if 1.04999999999999999e148 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 7.5e-20)
(/ (/ (/ (+ 1.0 alpha) (+ 2.0 alpha)) (+ 2.0 alpha)) (+ (+ 2.0 alpha) 1.0))
(if (<= beta 1.32e+16)
(/
(/ (+ 1.0 beta) (+ 4.0 (* beta (+ 4.0 beta))))
(* (+ (/ 3.0 beta) 1.0) beta))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta))))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 7.5e-20) {
tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0);
} else if (beta <= 1.32e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((3.0 / beta) + 1.0) * beta);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 7.5d-20) then
tmp = (((1.0d0 + alpha) / (2.0d0 + alpha)) / (2.0d0 + alpha)) / ((2.0d0 + alpha) + 1.0d0)
else if (beta <= 1.32d+16) then
tmp = ((1.0d0 + beta) / (4.0d0 + (beta * (4.0d0 + beta)))) / (((3.0d0 / beta) + 1.0d0) * beta)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 7.5e-20) {
tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0);
} else if (beta <= 1.32e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((3.0 / beta) + 1.0) * beta);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 7.5e-20: tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0) elif beta <= 1.32e+16: tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((3.0 / beta) + 1.0) * beta) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 7.5e-20) tmp = Float64(Float64(Float64(Float64(1.0 + alpha) / Float64(2.0 + alpha)) / Float64(2.0 + alpha)) / Float64(Float64(2.0 + alpha) + 1.0)); elseif (beta <= 1.32e+16) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(4.0 + Float64(beta * Float64(4.0 + beta)))) / Float64(Float64(Float64(3.0 / beta) + 1.0) * beta)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 7.5e-20)
tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0);
elseif (beta <= 1.32e+16)
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((3.0 / beta) + 1.0) * beta);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 7.5e-20], N[(N[(N[(N[(1.0 + alpha), $MachinePrecision] / N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision] / N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.32e+16], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(4.0 + N[(beta * N[(4.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(3.0 / beta), $MachinePrecision] + 1.0), $MachinePrecision] * beta), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 7.5 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{\frac{1 + \alpha}{2 + \alpha}}{2 + \alpha}}{\left(2 + \alpha\right) + 1}\\
\mathbf{elif}\;\beta \leq 1.32 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{1 + \beta}{4 + \beta \cdot \left(4 + \beta\right)}}{\left(\frac{3}{\beta} + 1\right) \cdot \beta}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 7.49999999999999981e-20Initial program 94.6%
Taylor expanded in alpha around -inf
mul-1-negN/A
sub-negate-revN/A
mul-1-negN/A
add-flipN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
add-flipN/A
mul-1-negN/A
sub-negate-revN/A
mul-1-negN/A
lower--.f64N/A
lower-neg.f6412.2
Applied rewrites12.2%
Taylor expanded in beta around 0
lower-+.f6410.7
Applied rewrites10.7%
Taylor expanded in beta around 0
lower-+.f6410.1
Applied rewrites10.1%
Taylor expanded in beta around 0
lower-/.f64N/A
lift-+.f64N/A
lift-+.f6446.4
Applied rewrites46.4%
if 7.49999999999999981e-20 < beta < 1.32e16Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
mult-flip-revN/A
div-addN/A
lower-/.f64N/A
lower-+.f6492.7
Applied rewrites92.7%
Taylor expanded in alpha around 0
Applied rewrites92.3%
if 1.32e16 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 3.4e-72)
(/ (/ (/ (+ 1.0 alpha) (+ 2.0 alpha)) (+ 2.0 alpha)) (+ (+ 2.0 alpha) 1.0))
(if (<= beta 1.3e+16)
(/ (/ (+ 1.0 beta) (+ 4.0 (* beta (+ 4.0 beta)))) (+ 3.0 beta))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta))))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4e-72) {
tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0);
} else if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d-72) then
tmp = (((1.0d0 + alpha) / (2.0d0 + alpha)) / (2.0d0 + alpha)) / ((2.0d0 + alpha) + 1.0d0)
else if (beta <= 1.3d+16) then
tmp = ((1.0d0 + beta) / (4.0d0 + (beta * (4.0d0 + beta)))) / (3.0d0 + beta)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4e-72) {
tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0);
} else if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4e-72: tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0) elif beta <= 1.3e+16: tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4e-72) tmp = Float64(Float64(Float64(Float64(1.0 + alpha) / Float64(2.0 + alpha)) / Float64(2.0 + alpha)) / Float64(Float64(2.0 + alpha) + 1.0)); elseif (beta <= 1.3e+16) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(4.0 + Float64(beta * Float64(4.0 + beta)))) / Float64(3.0 + beta)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4e-72)
tmp = (((1.0 + alpha) / (2.0 + alpha)) / (2.0 + alpha)) / ((2.0 + alpha) + 1.0);
elseif (beta <= 1.3e+16)
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4e-72], N[(N[(N[(N[(1.0 + alpha), $MachinePrecision] / N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision] / N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + alpha), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.3e+16], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(4.0 + N[(beta * N[(4.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4 \cdot 10^{-72}:\\
\;\;\;\;\frac{\frac{\frac{1 + \alpha}{2 + \alpha}}{2 + \alpha}}{\left(2 + \alpha\right) + 1}\\
\mathbf{elif}\;\beta \leq 1.3 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{1 + \beta}{4 + \beta \cdot \left(4 + \beta\right)}}{3 + \beta}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 3.3999999999999998e-72Initial program 94.6%
Taylor expanded in alpha around -inf
mul-1-negN/A
sub-negate-revN/A
mul-1-negN/A
add-flipN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
add-flipN/A
mul-1-negN/A
sub-negate-revN/A
mul-1-negN/A
lower--.f64N/A
lower-neg.f6412.2
Applied rewrites12.2%
Taylor expanded in beta around 0
lower-+.f6410.7
Applied rewrites10.7%
Taylor expanded in beta around 0
lower-+.f6410.1
Applied rewrites10.1%
Taylor expanded in beta around 0
lower-/.f64N/A
lift-+.f64N/A
lift-+.f6446.4
Applied rewrites46.4%
if 3.3999999999999998e-72 < beta < 1.3e16Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in alpha around 0
lift-+.f6492.4
Applied rewrites92.4%
if 1.3e16 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 3.4e-72)
(/ (+ 1.0 alpha) (* (+ 3.0 alpha) (* (+ 2.0 alpha) (+ 2.0 alpha))))
(if (<= beta 1.3e+16)
(/ (/ (+ 1.0 beta) (+ 4.0 (* beta (+ 4.0 beta)))) (+ 3.0 beta))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta))))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4e-72) {
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
} else if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d-72) then
tmp = (1.0d0 + alpha) / ((3.0d0 + alpha) * ((2.0d0 + alpha) * (2.0d0 + alpha)))
else if (beta <= 1.3d+16) then
tmp = ((1.0d0 + beta) / (4.0d0 + (beta * (4.0d0 + beta)))) / (3.0d0 + beta)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4e-72) {
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
} else if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4e-72: tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha))) elif beta <= 1.3e+16: tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4e-72) tmp = Float64(Float64(1.0 + alpha) / Float64(Float64(3.0 + alpha) * Float64(Float64(2.0 + alpha) * Float64(2.0 + alpha)))); elseif (beta <= 1.3e+16) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(4.0 + Float64(beta * Float64(4.0 + beta)))) / Float64(3.0 + beta)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4e-72)
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
elseif (beta <= 1.3e+16)
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (3.0 + beta);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4e-72], N[(N[(1.0 + alpha), $MachinePrecision] / N[(N[(3.0 + alpha), $MachinePrecision] * N[(N[(2.0 + alpha), $MachinePrecision] * N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.3e+16], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(4.0 + N[(beta * N[(4.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4 \cdot 10^{-72}:\\
\;\;\;\;\frac{1 + \alpha}{\left(3 + \alpha\right) \cdot \left(\left(2 + \alpha\right) \cdot \left(2 + \alpha\right)\right)}\\
\mathbf{elif}\;\beta \leq 1.3 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{1 + \beta}{4 + \beta \cdot \left(4 + \beta\right)}}{3 + \beta}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 3.3999999999999998e-72Initial program 94.6%
Taylor expanded in beta around 0
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6447.3
Applied rewrites47.3%
if 3.3999999999999998e-72 < beta < 1.3e16Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in alpha around 0
lift-+.f6492.4
Applied rewrites92.4%
if 1.3e16 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 3.4e-72)
(/ (+ 1.0 alpha) (* (+ 3.0 alpha) (* (+ 2.0 alpha) (+ 2.0 alpha))))
(if (<= beta 1.1e+18)
(/ (+ 1.0 beta) (* (+ 3.0 beta) (* (+ 2.0 beta) (+ 2.0 beta))))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta))))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4e-72) {
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
} else if (beta <= 1.1e+18) {
tmp = (1.0 + beta) / ((3.0 + beta) * ((2.0 + beta) * (2.0 + beta)));
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d-72) then
tmp = (1.0d0 + alpha) / ((3.0d0 + alpha) * ((2.0d0 + alpha) * (2.0d0 + alpha)))
else if (beta <= 1.1d+18) then
tmp = (1.0d0 + beta) / ((3.0d0 + beta) * ((2.0d0 + beta) * (2.0d0 + beta)))
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4e-72) {
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
} else if (beta <= 1.1e+18) {
tmp = (1.0 + beta) / ((3.0 + beta) * ((2.0 + beta) * (2.0 + beta)));
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4e-72: tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha))) elif beta <= 1.1e+18: tmp = (1.0 + beta) / ((3.0 + beta) * ((2.0 + beta) * (2.0 + beta))) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4e-72) tmp = Float64(Float64(1.0 + alpha) / Float64(Float64(3.0 + alpha) * Float64(Float64(2.0 + alpha) * Float64(2.0 + alpha)))); elseif (beta <= 1.1e+18) tmp = Float64(Float64(1.0 + beta) / Float64(Float64(3.0 + beta) * Float64(Float64(2.0 + beta) * Float64(2.0 + beta)))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4e-72)
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
elseif (beta <= 1.1e+18)
tmp = (1.0 + beta) / ((3.0 + beta) * ((2.0 + beta) * (2.0 + beta)));
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4e-72], N[(N[(1.0 + alpha), $MachinePrecision] / N[(N[(3.0 + alpha), $MachinePrecision] * N[(N[(2.0 + alpha), $MachinePrecision] * N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.1e+18], N[(N[(1.0 + beta), $MachinePrecision] / N[(N[(3.0 + beta), $MachinePrecision] * N[(N[(2.0 + beta), $MachinePrecision] * N[(2.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4 \cdot 10^{-72}:\\
\;\;\;\;\frac{1 + \alpha}{\left(3 + \alpha\right) \cdot \left(\left(2 + \alpha\right) \cdot \left(2 + \alpha\right)\right)}\\
\mathbf{elif}\;\beta \leq 1.1 \cdot 10^{+18}:\\
\;\;\;\;\frac{1 + \beta}{\left(3 + \beta\right) \cdot \left(\left(2 + \beta\right) \cdot \left(2 + \beta\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 3.3999999999999998e-72Initial program 94.6%
Taylor expanded in beta around 0
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6447.3
Applied rewrites47.3%
if 3.3999999999999998e-72 < beta < 1.1e18Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6485.7
Applied rewrites85.7%
if 1.1e18 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(let* ((t_0 (+ (+ alpha beta) (* 2.0 1.0))) (t_1 (+ t_0 1.0)))
(if (<= beta 1.3e+16)
(/ (/ (+ 1.0 beta) (+ 4.0 (* beta (+ 4.0 beta)))) t_1)
(/ (/ (- (- (- alpha) 1.0)) t_0) t_1))))assert(alpha < beta);
double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
double t_1 = t_0 + 1.0;
double tmp;
if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / t_1;
} else {
tmp = (-(-alpha - 1.0) / t_0) / t_1;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (alpha + beta) + (2.0d0 * 1.0d0)
t_1 = t_0 + 1.0d0
if (beta <= 1.3d+16) then
tmp = ((1.0d0 + beta) / (4.0d0 + (beta * (4.0d0 + beta)))) / t_1
else
tmp = (-(-alpha - 1.0d0) / t_0) / t_1
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double t_0 = (alpha + beta) + (2.0 * 1.0);
double t_1 = t_0 + 1.0;
double tmp;
if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / t_1;
} else {
tmp = (-(-alpha - 1.0) / t_0) / t_1;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): t_0 = (alpha + beta) + (2.0 * 1.0) t_1 = t_0 + 1.0 tmp = 0 if beta <= 1.3e+16: tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / t_1 else: tmp = (-(-alpha - 1.0) / t_0) / t_1 return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) t_0 = Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) t_1 = Float64(t_0 + 1.0) tmp = 0.0 if (beta <= 1.3e+16) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(4.0 + Float64(beta * Float64(4.0 + beta)))) / t_1); else tmp = Float64(Float64(Float64(-Float64(Float64(-alpha) - 1.0)) / t_0) / t_1); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
t_0 = (alpha + beta) + (2.0 * 1.0);
t_1 = t_0 + 1.0;
tmp = 0.0;
if (beta <= 1.3e+16)
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / t_1;
else
tmp = (-(-alpha - 1.0) / t_0) / t_1;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function.
code[alpha_, beta_] := Block[{t$95$0 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, If[LessEqual[beta, 1.3e+16], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(4.0 + N[(beta * N[(4.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[((-N[((-alpha) - 1.0), $MachinePrecision]) / t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
t_0 := \left(\alpha + \beta\right) + 2 \cdot 1\\
t_1 := t\_0 + 1\\
\mathbf{if}\;\beta \leq 1.3 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{1 + \beta}{4 + \beta \cdot \left(4 + \beta\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-\left(\left(-\alpha\right) - 1\right)}{t\_0}}{t\_1}\\
\end{array}
\end{array}
if beta < 1.3e16Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
if 1.3e16 < beta Initial program 94.6%
Taylor expanded in beta around -inf
mul-1-negN/A
sub-negate-revN/A
mul-1-negN/A
add-flipN/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
add-flipN/A
mul-1-negN/A
sub-negate-revN/A
mul-1-negN/A
lower--.f64N/A
lower-neg.f6462.9
Applied rewrites62.9%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 1.3e+16)
(/
(/ (+ 1.0 beta) (+ 4.0 (* beta (+ 4.0 beta))))
(+ (+ (+ alpha beta) (* 2.0 1.0)) 1.0))
(/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta)))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 1.3d+16) then
tmp = ((1.0d0 + beta) / (4.0d0 + (beta * (4.0d0 + beta)))) / (((alpha + beta) + (2.0d0 * 1.0d0)) + 1.0d0)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 1.3e+16) {
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 1.3e+16: tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((alpha + beta) + (2.0 * 1.0)) + 1.0) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.3e+16) tmp = Float64(Float64(Float64(1.0 + beta) / Float64(4.0 + Float64(beta * Float64(4.0 + beta)))) / Float64(Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) + 1.0)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 1.3e+16)
tmp = ((1.0 + beta) / (4.0 + (beta * (4.0 + beta)))) / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 1.3e+16], N[(N[(N[(1.0 + beta), $MachinePrecision] / N[(4.0 + N[(beta * N[(4.0 + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.3 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{1 + \beta}{4 + \beta \cdot \left(4 + \beta\right)}}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 1.3e16Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
if 1.3e16 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 3.4) (/ (+ 1.0 alpha) (* (+ 3.0 alpha) (* (+ 2.0 alpha) (+ 2.0 alpha)))) (/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta)))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d0) then
tmp = (1.0d0 + alpha) / ((3.0d0 + alpha) * ((2.0d0 + alpha) * (2.0d0 + alpha)))
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4: tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha))) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4) tmp = Float64(Float64(1.0 + alpha) / Float64(Float64(3.0 + alpha) * Float64(Float64(2.0 + alpha) * Float64(2.0 + alpha)))); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4)
tmp = (1.0 + alpha) / ((3.0 + alpha) * ((2.0 + alpha) * (2.0 + alpha)));
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4], N[(N[(1.0 + alpha), $MachinePrecision] / N[(N[(3.0 + alpha), $MachinePrecision] * N[(N[(2.0 + alpha), $MachinePrecision] * N[(2.0 + alpha), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4:\\
\;\;\;\;\frac{1 + \alpha}{\left(3 + \alpha\right) \cdot \left(\left(2 + \alpha\right) \cdot \left(2 + \alpha\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 3.39999999999999991Initial program 94.6%
Taylor expanded in beta around 0
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6447.3
Applied rewrites47.3%
if 3.39999999999999991 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 4.0) (/ 0.25 (+ (+ (+ alpha beta) (* 2.0 1.0)) 1.0)) (/ (/ (+ 1.0 alpha) beta) (+ 3.0 (+ alpha beta)))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 4.0) {
tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 4.0d0) then
tmp = 0.25d0 / (((alpha + beta) + (2.0d0 * 1.0d0)) + 1.0d0)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + (alpha + beta))
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 4.0) {
tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 4.0: tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0) else: tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta)) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 4.0) tmp = Float64(0.25 / Float64(Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) + 1.0)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + Float64(alpha + beta))); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 4.0)
tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + (alpha + beta));
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 4.0], N[(0.25 / N[(N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 4:\\
\;\;\;\;\frac{0.25}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \left(\alpha + \beta\right)}\\
\end{array}
\end{array}
if beta < 4Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
if 4 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f64N/A
lift-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 4.5) (/ 0.25 (+ (+ (+ alpha beta) (* 2.0 1.0)) 1.0)) (/ (/ (+ 1.0 alpha) beta) (+ 3.0 beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 4.5) {
tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 4.5d0) then
tmp = 0.25d0 / (((alpha + beta) + (2.0d0 * 1.0d0)) + 1.0d0)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 4.5) {
tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 4.5: tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0) else: tmp = ((1.0 + alpha) / beta) / (3.0 + beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 4.5) tmp = Float64(0.25 / Float64(Float64(Float64(alpha + beta) + Float64(2.0 * 1.0)) + 1.0)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 4.5)
tmp = 0.25 / (((alpha + beta) + (2.0 * 1.0)) + 1.0);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 4.5], N[(0.25 / N[(N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 4.5:\\
\;\;\;\;\frac{0.25}{\left(\left(\alpha + \beta\right) + 2 \cdot 1\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \beta}\\
\end{array}
\end{array}
if beta < 4.5Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
if 4.5 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 2.7) (/ 0.25 (+ 3.0 alpha)) (/ (/ (+ 1.0 alpha) beta) (+ 3.0 beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 2.7) {
tmp = 0.25 / (3.0 + alpha);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 2.7d0) then
tmp = 0.25d0 / (3.0d0 + alpha)
else
tmp = ((1.0d0 + alpha) / beta) / (3.0d0 + beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 2.7) {
tmp = 0.25 / (3.0 + alpha);
} else {
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 2.7: tmp = 0.25 / (3.0 + alpha) else: tmp = ((1.0 + alpha) / beta) / (3.0 + beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 2.7) tmp = Float64(0.25 / Float64(3.0 + alpha)); else tmp = Float64(Float64(Float64(1.0 + alpha) / beta) / Float64(3.0 + beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 2.7)
tmp = 0.25 / (3.0 + alpha);
else
tmp = ((1.0 + alpha) / beta) / (3.0 + beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 2.7], N[(0.25 / N[(3.0 + alpha), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + alpha), $MachinePrecision] / beta), $MachinePrecision] / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.7:\\
\;\;\;\;\frac{0.25}{3 + \alpha}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \alpha}{\beta}}{3 + \beta}\\
\end{array}
\end{array}
if beta < 2.7000000000000002Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
if 2.7000000000000002 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f6456.6
Applied rewrites56.6%
Taylor expanded in alpha around 0
lower-+.f6456.6
Applied rewrites56.6%
NOTE: alpha and beta should be sorted in increasing order before calling this function.
(FPCore (alpha beta)
:precision binary64
(if (<= beta 3.4)
(/ 0.25 (+ 3.0 alpha))
(if (<= beta 1.35e+154)
(/ (+ 1.0 alpha) (* beta beta))
(/ (/ alpha beta) beta))))assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = 0.25 / (3.0 + alpha);
} else if (beta <= 1.35e+154) {
tmp = (1.0 + alpha) / (beta * beta);
} else {
tmp = (alpha / beta) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d0) then
tmp = 0.25d0 / (3.0d0 + alpha)
else if (beta <= 1.35d+154) then
tmp = (1.0d0 + alpha) / (beta * beta)
else
tmp = (alpha / beta) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = 0.25 / (3.0 + alpha);
} else if (beta <= 1.35e+154) {
tmp = (1.0 + alpha) / (beta * beta);
} else {
tmp = (alpha / beta) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4: tmp = 0.25 / (3.0 + alpha) elif beta <= 1.35e+154: tmp = (1.0 + alpha) / (beta * beta) else: tmp = (alpha / beta) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4) tmp = Float64(0.25 / Float64(3.0 + alpha)); elseif (beta <= 1.35e+154) tmp = Float64(Float64(1.0 + alpha) / Float64(beta * beta)); else tmp = Float64(Float64(alpha / beta) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4)
tmp = 0.25 / (3.0 + alpha);
elseif (beta <= 1.35e+154)
tmp = (1.0 + alpha) / (beta * beta);
else
tmp = (alpha / beta) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4], N[(0.25 / N[(3.0 + alpha), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.35e+154], N[(N[(1.0 + alpha), $MachinePrecision] / N[(beta * beta), $MachinePrecision]), $MachinePrecision], N[(N[(alpha / beta), $MachinePrecision] / beta), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4:\\
\;\;\;\;\frac{0.25}{3 + \alpha}\\
\mathbf{elif}\;\beta \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 + \alpha}{\beta \cdot \beta}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 3.39999999999999991Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
if 3.39999999999999991 < beta < 1.35000000000000003e154Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
if 1.35000000000000003e154 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
Taylor expanded in alpha around inf
lower-/.f64N/A
pow2N/A
lift-*.f6432.1
Applied rewrites32.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.8
Applied rewrites34.8%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 3.4) (/ 0.25 (+ 3.0 alpha)) (if (<= beta 1.35e+154) (/ 1.0 (* beta beta)) (/ (/ alpha beta) beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = 0.25 / (3.0 + alpha);
} else if (beta <= 1.35e+154) {
tmp = 1.0 / (beta * beta);
} else {
tmp = (alpha / beta) / beta;
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d0) then
tmp = 0.25d0 / (3.0d0 + alpha)
else if (beta <= 1.35d+154) then
tmp = 1.0d0 / (beta * beta)
else
tmp = (alpha / beta) / beta
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = 0.25 / (3.0 + alpha);
} else if (beta <= 1.35e+154) {
tmp = 1.0 / (beta * beta);
} else {
tmp = (alpha / beta) / beta;
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4: tmp = 0.25 / (3.0 + alpha) elif beta <= 1.35e+154: tmp = 1.0 / (beta * beta) else: tmp = (alpha / beta) / beta return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4) tmp = Float64(0.25 / Float64(3.0 + alpha)); elseif (beta <= 1.35e+154) tmp = Float64(1.0 / Float64(beta * beta)); else tmp = Float64(Float64(alpha / beta) / beta); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4)
tmp = 0.25 / (3.0 + alpha);
elseif (beta <= 1.35e+154)
tmp = 1.0 / (beta * beta);
else
tmp = (alpha / beta) / beta;
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4], N[(0.25 / N[(3.0 + alpha), $MachinePrecision]), $MachinePrecision], If[LessEqual[beta, 1.35e+154], N[(1.0 / N[(beta * beta), $MachinePrecision]), $MachinePrecision], N[(N[(alpha / beta), $MachinePrecision] / beta), $MachinePrecision]]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4:\\
\;\;\;\;\frac{0.25}{3 + \alpha}\\
\mathbf{elif}\;\beta \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1}{\beta \cdot \beta}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\alpha}{\beta}}{\beta}\\
\end{array}
\end{array}
if beta < 3.39999999999999991Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
if 3.39999999999999991 < beta < 1.35000000000000003e154Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
Taylor expanded in alpha around 0
Applied rewrites50.4%
if 1.35000000000000003e154 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
Taylor expanded in alpha around inf
lower-/.f64N/A
pow2N/A
lift-*.f6432.1
Applied rewrites32.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6434.8
Applied rewrites34.8%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 3.4) (/ 0.25 (+ 3.0 alpha)) (/ 1.0 (* beta beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = 0.25 / (3.0 + alpha);
} else {
tmp = 1.0 / (beta * beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 3.4d0) then
tmp = 0.25d0 / (3.0d0 + alpha)
else
tmp = 1.0d0 / (beta * beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 3.4) {
tmp = 0.25 / (3.0 + alpha);
} else {
tmp = 1.0 / (beta * beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 3.4: tmp = 0.25 / (3.0 + alpha) else: tmp = 1.0 / (beta * beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 3.4) tmp = Float64(0.25 / Float64(3.0 + alpha)); else tmp = Float64(1.0 / Float64(beta * beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 3.4)
tmp = 0.25 / (3.0 + alpha);
else
tmp = 1.0 / (beta * beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 3.4], N[(0.25 / N[(3.0 + alpha), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(beta * beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 3.4:\\
\;\;\;\;\frac{0.25}{3 + \alpha}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 3.39999999999999991Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
if 3.39999999999999991 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
Taylor expanded in alpha around 0
Applied rewrites50.4%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (if (<= beta 1.55e+38) (/ 0.25 (+ 3.0 alpha)) (/ alpha (* beta beta))))
assert(alpha < beta);
double code(double alpha, double beta) {
double tmp;
if (beta <= 1.55e+38) {
tmp = 0.25 / (3.0 + alpha);
} else {
tmp = alpha / (beta * beta);
}
return tmp;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8) :: tmp
if (beta <= 1.55d+38) then
tmp = 0.25d0 / (3.0d0 + alpha)
else
tmp = alpha / (beta * beta)
end if
code = tmp
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
double tmp;
if (beta <= 1.55e+38) {
tmp = 0.25 / (3.0 + alpha);
} else {
tmp = alpha / (beta * beta);
}
return tmp;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): tmp = 0 if beta <= 1.55e+38: tmp = 0.25 / (3.0 + alpha) else: tmp = alpha / (beta * beta) return tmp
alpha, beta = sort([alpha, beta]) function code(alpha, beta) tmp = 0.0 if (beta <= 1.55e+38) tmp = Float64(0.25 / Float64(3.0 + alpha)); else tmp = Float64(alpha / Float64(beta * beta)); end return tmp end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp_2 = code(alpha, beta)
tmp = 0.0;
if (beta <= 1.55e+38)
tmp = 0.25 / (3.0 + alpha);
else
tmp = alpha / (beta * beta);
end
tmp_2 = tmp;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := If[LessEqual[beta, 1.55e+38], N[(0.25 / N[(3.0 + alpha), $MachinePrecision]), $MachinePrecision], N[(alpha / N[(beta * beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.55 \cdot 10^{+38}:\\
\;\;\;\;\frac{0.25}{3 + \alpha}\\
\mathbf{else}:\\
\;\;\;\;\frac{\alpha}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 1.55000000000000009e38Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
if 1.55000000000000009e38 < beta Initial program 94.6%
Taylor expanded in beta around inf
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
Taylor expanded in alpha around inf
lower-/.f64N/A
pow2N/A
lift-*.f6432.1
Applied rewrites32.1%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (/ 0.25 (+ 3.0 beta)))
assert(alpha < beta);
double code(double alpha, double beta) {
return 0.25 / (3.0 + beta);
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = 0.25d0 / (3.0d0 + beta)
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
return 0.25 / (3.0 + beta);
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): return 0.25 / (3.0 + beta)
alpha, beta = sort([alpha, beta]) function code(alpha, beta) return Float64(0.25 / Float64(3.0 + beta)) end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
tmp = 0.25 / (3.0 + beta);
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := N[(0.25 / N[(3.0 + beta), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\frac{0.25}{3 + \beta}
\end{array}
Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in alpha around 0
lift-+.f6446.5
Applied rewrites46.5%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (/ 0.25 (+ 3.0 alpha)))
assert(alpha < beta);
double code(double alpha, double beta) {
return 0.25 / (3.0 + alpha);
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = 0.25d0 / (3.0d0 + alpha)
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
return 0.25 / (3.0 + alpha);
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): return 0.25 / (3.0 + alpha)
alpha, beta = sort([alpha, beta]) function code(alpha, beta) return Float64(0.25 / Float64(3.0 + alpha)) end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
tmp = 0.25 / (3.0 + alpha);
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := N[(0.25 / N[(3.0 + alpha), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\frac{0.25}{3 + \alpha}
\end{array}
Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
NOTE: alpha and beta should be sorted in increasing order before calling this function. (FPCore (alpha beta) :precision binary64 (/ 0.25 3.0))
assert(alpha < beta);
double code(double alpha, double beta) {
return 0.25 / 3.0;
}
NOTE: alpha and beta should be sorted in increasing order before calling this function.
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(alpha, beta)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
code = 0.25d0 / 3.0d0
end function
assert alpha < beta;
public static double code(double alpha, double beta) {
return 0.25 / 3.0;
}
[alpha, beta] = sort([alpha, beta]) def code(alpha, beta): return 0.25 / 3.0
alpha, beta = sort([alpha, beta]) function code(alpha, beta) return Float64(0.25 / 3.0) end
alpha, beta = num2cell(sort([alpha, beta])){:}
function tmp = code(alpha, beta)
tmp = 0.25 / 3.0;
end
NOTE: alpha and beta should be sorted in increasing order before calling this function. code[alpha_, beta_] := N[(0.25 / 3.0), $MachinePrecision]
\begin{array}{l}
[alpha, beta] = \mathsf{sort}([alpha, beta])\\
\\
\frac{0.25}{3}
\end{array}
Initial program 94.6%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-+.f64N/A
unpow2N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f6492.8
Applied rewrites92.8%
Taylor expanded in beta around 0
Applied rewrites47.0%
Taylor expanded in beta around 0
lower-+.f6444.9
Applied rewrites44.9%
Taylor expanded in alpha around 0
Applied rewrites44.3%
herbie shell --seed 2025134
(FPCore (alpha beta)
:name "Octave 3.8, jcobi/3"
:precision binary64
:pre (and (> alpha -1.0) (> beta -1.0))
(/ (/ (/ (+ (+ (+ alpha beta) (* beta alpha)) 1.0) (+ (+ alpha beta) (* 2.0 1.0))) (+ (+ alpha beta) (* 2.0 1.0))) (+ (+ (+ alpha beta) (* 2.0 1.0)) 1.0)))