
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (* i (+ (+ alpha beta) i)))
(t_1 (+ (+ alpha beta) (* 2.0 i)))
(t_2 (* t_1 t_1)))
(/ (/ (* t_0 (+ (* beta alpha) t_0)) t_2) (- t_2 1.0))))
double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 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, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
t_0 = i * ((alpha + beta) + i)
t_1 = (alpha + beta) + (2.0d0 * i)
t_2 = t_1 * t_1
code = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0d0)
end function
public static double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0);
}
def code(alpha, beta, i): t_0 = i * ((alpha + beta) + i) t_1 = (alpha + beta) + (2.0 * i) t_2 = t_1 * t_1 return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0)
function code(alpha, beta, i) t_0 = Float64(i * Float64(Float64(alpha + beta) + i)) t_1 = Float64(Float64(alpha + beta) + Float64(2.0 * i)) t_2 = Float64(t_1 * t_1) return Float64(Float64(Float64(t_0 * Float64(Float64(beta * alpha) + t_0)) / t_2) / Float64(t_2 - 1.0)) end
function tmp = code(alpha, beta, i) t_0 = i * ((alpha + beta) + i); t_1 = (alpha + beta) + (2.0 * i); t_2 = t_1 * t_1; tmp = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0); end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(i * N[(N[(alpha + beta), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, N[(N[(N[(t$95$0 * N[(N[(beta * alpha), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$2 - 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := i \cdot \left(\left(\alpha + \beta\right) + i\right)\\
t_1 := \left(\alpha + \beta\right) + 2 \cdot i\\
t_2 := t\_1 \cdot t\_1\\
\frac{\frac{t\_0 \cdot \left(\beta \cdot \alpha + t\_0\right)}{t\_2}}{t\_2 - 1}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (* i (+ (+ alpha beta) i)))
(t_1 (+ (+ alpha beta) (* 2.0 i)))
(t_2 (* t_1 t_1)))
(/ (/ (* t_0 (+ (* beta alpha) t_0)) t_2) (- t_2 1.0))))
double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 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, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
t_0 = i * ((alpha + beta) + i)
t_1 = (alpha + beta) + (2.0d0 * i)
t_2 = t_1 * t_1
code = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0d0)
end function
public static double code(double alpha, double beta, double i) {
double t_0 = i * ((alpha + beta) + i);
double t_1 = (alpha + beta) + (2.0 * i);
double t_2 = t_1 * t_1;
return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0);
}
def code(alpha, beta, i): t_0 = i * ((alpha + beta) + i) t_1 = (alpha + beta) + (2.0 * i) t_2 = t_1 * t_1 return ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0)
function code(alpha, beta, i) t_0 = Float64(i * Float64(Float64(alpha + beta) + i)) t_1 = Float64(Float64(alpha + beta) + Float64(2.0 * i)) t_2 = Float64(t_1 * t_1) return Float64(Float64(Float64(t_0 * Float64(Float64(beta * alpha) + t_0)) / t_2) / Float64(t_2 - 1.0)) end
function tmp = code(alpha, beta, i) t_0 = i * ((alpha + beta) + i); t_1 = (alpha + beta) + (2.0 * i); t_2 = t_1 * t_1; tmp = ((t_0 * ((beta * alpha) + t_0)) / t_2) / (t_2 - 1.0); end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(i * N[(N[(alpha + beta), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(alpha + beta), $MachinePrecision] + N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$1), $MachinePrecision]}, N[(N[(N[(t$95$0 * N[(N[(beta * alpha), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision] / N[(t$95$2 - 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := i \cdot \left(\left(\alpha + \beta\right) + i\right)\\
t_1 := \left(\alpha + \beta\right) + 2 \cdot i\\
t_2 := t\_1 \cdot t\_1\\
\frac{\frac{t\_0 \cdot \left(\beta \cdot \alpha + t\_0\right)}{t\_2}}{t\_2 - 1}
\end{array}
\end{array}
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (fma 2.0 i (+ beta alpha))) (t_1 (fma 2.0 i (+ alpha beta))))
(*
(/
(fma i (+ (/ (+ alpha beta) t_1) (/ i t_1)) (* beta (/ alpha t_0)))
(- t_0 1.0))
(/ (* (+ (+ beta alpha) i) (/ i t_0)) (+ 1.0 t_0)))))
double code(double alpha, double beta, double i) {
double t_0 = fma(2.0, i, (beta + alpha));
double t_1 = fma(2.0, i, (alpha + beta));
return (fma(i, (((alpha + beta) / t_1) + (i / t_1)), (beta * (alpha / t_0))) / (t_0 - 1.0)) * ((((beta + alpha) + i) * (i / t_0)) / (1.0 + t_0));
}
function code(alpha, beta, i) t_0 = fma(2.0, i, Float64(beta + alpha)) t_1 = fma(2.0, i, Float64(alpha + beta)) return Float64(Float64(fma(i, Float64(Float64(Float64(alpha + beta) / t_1) + Float64(i / t_1)), Float64(beta * Float64(alpha / t_0))) / Float64(t_0 - 1.0)) * Float64(Float64(Float64(Float64(beta + alpha) + i) * Float64(i / t_0)) / Float64(1.0 + t_0))) end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(2.0 * i + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * i + N[(alpha + beta), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(i * N[(N[(N[(alpha + beta), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(i / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(beta * N[(alpha / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(beta + alpha), $MachinePrecision] + i), $MachinePrecision] * N[(i / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, i, \beta + \alpha\right)\\
t_1 := \mathsf{fma}\left(2, i, \alpha + \beta\right)\\
\frac{\mathsf{fma}\left(i, \frac{\alpha + \beta}{t\_1} + \frac{i}{t\_1}, \beta \cdot \frac{\alpha}{t\_0}\right)}{t\_0 - 1} \cdot \frac{\left(\left(\beta + \alpha\right) + i\right) \cdot \frac{i}{t\_0}}{1 + t\_0}
\end{array}
\end{array}
Initial program 14.2%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites44.8%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-/.f64N/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.3
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.3
Applied rewrites99.3%
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (+ (+ beta alpha) i)) (t_1 (fma 2.0 i (+ beta alpha))))
(*
(/ (fma i (/ t_0 t_1) (* beta (/ alpha t_1))) (- t_1 1.0))
(/ (* t_0 (/ i t_1)) (+ 1.0 t_1)))))
double code(double alpha, double beta, double i) {
double t_0 = (beta + alpha) + i;
double t_1 = fma(2.0, i, (beta + alpha));
return (fma(i, (t_0 / t_1), (beta * (alpha / t_1))) / (t_1 - 1.0)) * ((t_0 * (i / t_1)) / (1.0 + t_1));
}
function code(alpha, beta, i) t_0 = Float64(Float64(beta + alpha) + i) t_1 = fma(2.0, i, Float64(beta + alpha)) return Float64(Float64(fma(i, Float64(t_0 / t_1), Float64(beta * Float64(alpha / t_1))) / Float64(t_1 - 1.0)) * Float64(Float64(t_0 * Float64(i / t_1)) / Float64(1.0 + t_1))) end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(N[(beta + alpha), $MachinePrecision] + i), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * i + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(i * N[(t$95$0 / t$95$1), $MachinePrecision] + N[(beta * N[(alpha / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * N[(i / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\beta + \alpha\right) + i\\
t_1 := \mathsf{fma}\left(2, i, \beta + \alpha\right)\\
\frac{\mathsf{fma}\left(i, \frac{t\_0}{t\_1}, \beta \cdot \frac{\alpha}{t\_1}\right)}{t\_1 - 1} \cdot \frac{t\_0 \cdot \frac{i}{t\_1}}{1 + t\_1}
\end{array}
\end{array}
Initial program 14.2%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites44.8%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (fma 2.0 i (+ beta alpha)))
(t_1 (/ (* (+ (+ beta alpha) i) (/ i t_0)) (+ 1.0 t_0)))
(t_2 (+ beta (* 2.0 i))))
(if (<= alpha 1.5e+81)
(* (/ (* i (/ (+ beta i) t_2)) (- t_2 1.0)) t_1)
(* (/ (+ alpha i) (- t_0 1.0)) t_1))))
double code(double alpha, double beta, double i) {
double t_0 = fma(2.0, i, (beta + alpha));
double t_1 = (((beta + alpha) + i) * (i / t_0)) / (1.0 + t_0);
double t_2 = beta + (2.0 * i);
double tmp;
if (alpha <= 1.5e+81) {
tmp = ((i * ((beta + i) / t_2)) / (t_2 - 1.0)) * t_1;
} else {
tmp = ((alpha + i) / (t_0 - 1.0)) * t_1;
}
return tmp;
}
function code(alpha, beta, i) t_0 = fma(2.0, i, Float64(beta + alpha)) t_1 = Float64(Float64(Float64(Float64(beta + alpha) + i) * Float64(i / t_0)) / Float64(1.0 + t_0)) t_2 = Float64(beta + Float64(2.0 * i)) tmp = 0.0 if (alpha <= 1.5e+81) tmp = Float64(Float64(Float64(i * Float64(Float64(beta + i) / t_2)) / Float64(t_2 - 1.0)) * t_1); else tmp = Float64(Float64(Float64(alpha + i) / Float64(t_0 - 1.0)) * t_1); end return tmp end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(2.0 * i + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(beta + alpha), $MachinePrecision] + i), $MachinePrecision] * N[(i / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(beta + N[(2.0 * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[alpha, 1.5e+81], N[(N[(N[(i * N[(N[(beta + i), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(alpha + i), $MachinePrecision] / N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, i, \beta + \alpha\right)\\
t_1 := \frac{\left(\left(\beta + \alpha\right) + i\right) \cdot \frac{i}{t\_0}}{1 + t\_0}\\
t_2 := \beta + 2 \cdot i\\
\mathbf{if}\;\alpha \leq 1.5 \cdot 10^{+81}:\\
\;\;\;\;\frac{i \cdot \frac{\beta + i}{t\_2}}{t\_2 - 1} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\alpha + i}{t\_0 - 1} \cdot t\_1\\
\end{array}
\end{array}
if alpha < 1.49999999999999999e81Initial program 18.5%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites48.4%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-/.f64N/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
lower-/.f6499.3
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.3
lift-+.f64N/A
+-commutativeN/A
lift-+.f6499.3
Applied rewrites99.3%
Taylor expanded in alpha around 0
lower-/.f64N/A
lower-*.f64N/A
div-add-revN/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f6496.9
Applied rewrites96.9%
if 1.49999999999999999e81 < alpha Initial program 3.1%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites35.3%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.4
Applied rewrites99.4%
Taylor expanded in beta around inf
lower-+.f6416.4
Applied rewrites16.4%
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (fma 2.0 i (+ beta alpha))))
(if (<= beta 1.8e+133)
0.0625
(*
(/ (+ alpha i) (- t_0 1.0))
(/ (* (+ (+ beta alpha) i) (/ i t_0)) (+ 1.0 t_0))))))
double code(double alpha, double beta, double i) {
double t_0 = fma(2.0, i, (beta + alpha));
double tmp;
if (beta <= 1.8e+133) {
tmp = 0.0625;
} else {
tmp = ((alpha + i) / (t_0 - 1.0)) * ((((beta + alpha) + i) * (i / t_0)) / (1.0 + t_0));
}
return tmp;
}
function code(alpha, beta, i) t_0 = fma(2.0, i, Float64(beta + alpha)) tmp = 0.0 if (beta <= 1.8e+133) tmp = 0.0625; else tmp = Float64(Float64(Float64(alpha + i) / Float64(t_0 - 1.0)) * Float64(Float64(Float64(Float64(beta + alpha) + i) * Float64(i / t_0)) / Float64(1.0 + t_0))); end return tmp end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(2.0 * i + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[beta, 1.8e+133], 0.0625, N[(N[(N[(alpha + i), $MachinePrecision] / N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(beta + alpha), $MachinePrecision] + i), $MachinePrecision] * N[(i / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, i, \beta + \alpha\right)\\
\mathbf{if}\;\beta \leq 1.8 \cdot 10^{+133}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{\alpha + i}{t\_0 - 1} \cdot \frac{\left(\left(\beta + \alpha\right) + i\right) \cdot \frac{i}{t\_0}}{1 + t\_0}\\
\end{array}
\end{array}
if beta < 1.79999999999999989e133Initial program 16.2%
Taylor expanded in i around inf
Applied rewrites76.5%
if 1.79999999999999989e133 < beta Initial program 0.2%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites35.9%
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
Taylor expanded in beta around inf
lower-+.f6467.2
Applied rewrites67.2%
(FPCore (alpha beta i)
:precision binary64
(let* ((t_0 (fma 2.0 i (+ beta alpha))))
(if (<= beta 2.2e+133)
0.0625
(*
(/ (+ alpha i) beta)
(/ (* (+ (+ beta alpha) i) (/ i t_0)) (+ 1.0 t_0))))))
double code(double alpha, double beta, double i) {
double t_0 = fma(2.0, i, (beta + alpha));
double tmp;
if (beta <= 2.2e+133) {
tmp = 0.0625;
} else {
tmp = ((alpha + i) / beta) * ((((beta + alpha) + i) * (i / t_0)) / (1.0 + t_0));
}
return tmp;
}
function code(alpha, beta, i) t_0 = fma(2.0, i, Float64(beta + alpha)) tmp = 0.0 if (beta <= 2.2e+133) tmp = 0.0625; else tmp = Float64(Float64(Float64(alpha + i) / beta) * Float64(Float64(Float64(Float64(beta + alpha) + i) * Float64(i / t_0)) / Float64(1.0 + t_0))); end return tmp end
code[alpha_, beta_, i_] := Block[{t$95$0 = N[(2.0 * i + N[(beta + alpha), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[beta, 2.2e+133], 0.0625, N[(N[(N[(alpha + i), $MachinePrecision] / beta), $MachinePrecision] * N[(N[(N[(N[(beta + alpha), $MachinePrecision] + i), $MachinePrecision] * N[(i / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(2, i, \beta + \alpha\right)\\
\mathbf{if}\;\beta \leq 2.2 \cdot 10^{+133}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{\alpha + i}{\beta} \cdot \frac{\left(\left(\beta + \alpha\right) + i\right) \cdot \frac{i}{t\_0}}{1 + t\_0}\\
\end{array}
\end{array}
if beta < 2.2e133Initial program 16.2%
Taylor expanded in i around inf
Applied rewrites76.5%
if 2.2e133 < beta Initial program 0.2%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites35.9%
Taylor expanded in beta around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f6465.2
Applied rewrites65.2%
Final simplification75.0%
(FPCore (alpha beta i) :precision binary64 (if (<= beta 2.2e+133) 0.0625 (* (* i (- (/ (/ alpha i) beta) (/ -1.0 beta))) (/ i beta))))
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 2.2e+133) {
tmp = 0.0625;
} else {
tmp = (i * (((alpha / i) / beta) - (-1.0 / beta))) * (i / beta);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 2.2d+133) then
tmp = 0.0625d0
else
tmp = (i * (((alpha / i) / beta) - ((-1.0d0) / beta))) * (i / beta)
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 2.2e+133) {
tmp = 0.0625;
} else {
tmp = (i * (((alpha / i) / beta) - (-1.0 / beta))) * (i / beta);
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if beta <= 2.2e+133: tmp = 0.0625 else: tmp = (i * (((alpha / i) / beta) - (-1.0 / beta))) * (i / beta) return tmp
function code(alpha, beta, i) tmp = 0.0 if (beta <= 2.2e+133) tmp = 0.0625; else tmp = Float64(Float64(i * Float64(Float64(Float64(alpha / i) / beta) - Float64(-1.0 / beta))) * Float64(i / beta)); end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (beta <= 2.2e+133) tmp = 0.0625; else tmp = (i * (((alpha / i) / beta) - (-1.0 / beta))) * (i / beta); end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[beta, 2.2e+133], 0.0625, N[(N[(i * N[(N[(N[(alpha / i), $MachinePrecision] / beta), $MachinePrecision] - N[(-1.0 / beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.2 \cdot 10^{+133}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot \left(\frac{\frac{\alpha}{i}}{\beta} - \frac{-1}{\beta}\right)\right) \cdot \frac{i}{\beta}\\
\end{array}
\end{array}
if beta < 2.2e133Initial program 16.2%
Taylor expanded in i around inf
Applied rewrites76.5%
if 2.2e133 < beta Initial program 0.2%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
Taylor expanded in i around -inf
Applied rewrites65.1%
Applied rewrites64.8%
Final simplification75.0%
(FPCore (alpha beta i) :precision binary64 (if (<= beta 2.2e+133) 0.0625 (* (/ (+ alpha i) beta) (/ i beta))))
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 2.2e+133) {
tmp = 0.0625;
} else {
tmp = ((alpha + i) / beta) * (i / beta);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 2.2d+133) then
tmp = 0.0625d0
else
tmp = ((alpha + i) / beta) * (i / beta)
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 2.2e+133) {
tmp = 0.0625;
} else {
tmp = ((alpha + i) / beta) * (i / beta);
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if beta <= 2.2e+133: tmp = 0.0625 else: tmp = ((alpha + i) / beta) * (i / beta) return tmp
function code(alpha, beta, i) tmp = 0.0 if (beta <= 2.2e+133) tmp = 0.0625; else tmp = Float64(Float64(Float64(alpha + i) / beta) * Float64(i / beta)); end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (beta <= 2.2e+133) tmp = 0.0625; else tmp = ((alpha + i) / beta) * (i / beta); end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[beta, 2.2e+133], 0.0625, N[(N[(N[(alpha + i), $MachinePrecision] / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 2.2 \cdot 10^{+133}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{\alpha + i}{\beta} \cdot \frac{i}{\beta}\\
\end{array}
\end{array}
if beta < 2.2e133Initial program 16.2%
Taylor expanded in i around inf
Applied rewrites76.5%
if 2.2e133 < beta Initial program 0.2%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6464.7
Applied rewrites64.7%
(FPCore (alpha beta i) :precision binary64 (if (<= beta 1.6e+145) 0.0625 (* (/ i beta) (/ i beta))))
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+145) {
tmp = 0.0625;
} else {
tmp = (i / beta) * (i / beta);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 1.6d+145) then
tmp = 0.0625d0
else
tmp = (i / beta) * (i / beta)
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+145) {
tmp = 0.0625;
} else {
tmp = (i / beta) * (i / beta);
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if beta <= 1.6e+145: tmp = 0.0625 else: tmp = (i / beta) * (i / beta) return tmp
function code(alpha, beta, i) tmp = 0.0 if (beta <= 1.6e+145) tmp = 0.0625; else tmp = Float64(Float64(i / beta) * Float64(i / beta)); end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (beta <= 1.6e+145) tmp = 0.0625; else tmp = (i / beta) * (i / beta); end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[beta, 1.6e+145], 0.0625, N[(N[(i / beta), $MachinePrecision] * N[(i / beta), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.6 \cdot 10^{+145}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\beta} \cdot \frac{i}{\beta}\\
\end{array}
\end{array}
if beta < 1.60000000000000004e145Initial program 16.1%
Taylor expanded in i around inf
Applied rewrites75.8%
if 1.60000000000000004e145 < beta Initial program 0.0%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6464.6
Applied rewrites64.6%
Taylor expanded in alpha around 0
Applied rewrites53.4%
(FPCore (alpha beta i) :precision binary64 (if (<= beta 1.6e+145) 0.0625 (/ (* (/ i beta) i) beta)))
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+145) {
tmp = 0.0625;
} else {
tmp = ((i / beta) * i) / beta;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 1.6d+145) then
tmp = 0.0625d0
else
tmp = ((i / beta) * i) / beta
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+145) {
tmp = 0.0625;
} else {
tmp = ((i / beta) * i) / beta;
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if beta <= 1.6e+145: tmp = 0.0625 else: tmp = ((i / beta) * i) / beta return tmp
function code(alpha, beta, i) tmp = 0.0 if (beta <= 1.6e+145) tmp = 0.0625; else tmp = Float64(Float64(Float64(i / beta) * i) / beta); end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (beta <= 1.6e+145) tmp = 0.0625; else tmp = ((i / beta) * i) / beta; end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[beta, 1.6e+145], 0.0625, N[(N[(N[(i / beta), $MachinePrecision] * i), $MachinePrecision] / beta), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.6 \cdot 10^{+145}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{\beta} \cdot i}{\beta}\\
\end{array}
\end{array}
if beta < 1.60000000000000004e145Initial program 16.1%
Taylor expanded in i around inf
Applied rewrites75.8%
if 1.60000000000000004e145 < beta Initial program 0.0%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6464.6
Applied rewrites64.6%
Taylor expanded in alpha around 0
Applied rewrites17.1%
Applied rewrites53.3%
(FPCore (alpha beta i) :precision binary64 (if (<= beta 1.6e+145) 0.0625 (* (/ (/ i beta) beta) i)))
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+145) {
tmp = 0.0625;
} else {
tmp = ((i / beta) / beta) * i;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 1.6d+145) then
tmp = 0.0625d0
else
tmp = ((i / beta) / beta) * i
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.6e+145) {
tmp = 0.0625;
} else {
tmp = ((i / beta) / beta) * i;
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if beta <= 1.6e+145: tmp = 0.0625 else: tmp = ((i / beta) / beta) * i return tmp
function code(alpha, beta, i) tmp = 0.0 if (beta <= 1.6e+145) tmp = 0.0625; else tmp = Float64(Float64(Float64(i / beta) / beta) * i); end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (beta <= 1.6e+145) tmp = 0.0625; else tmp = ((i / beta) / beta) * i; end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[beta, 1.6e+145], 0.0625, N[(N[(N[(i / beta), $MachinePrecision] / beta), $MachinePrecision] * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.6 \cdot 10^{+145}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{\beta}}{\beta} \cdot i\\
\end{array}
\end{array}
if beta < 1.60000000000000004e145Initial program 16.1%
Taylor expanded in i around inf
Applied rewrites75.8%
if 1.60000000000000004e145 < beta Initial program 0.0%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6464.6
Applied rewrites64.6%
Taylor expanded in alpha around 0
Applied rewrites17.1%
Applied rewrites46.4%
(FPCore (alpha beta i) :precision binary64 (if (<= i 1.7e+46) (* (+ alpha i) (/ i (* beta beta))) 0.0625))
double code(double alpha, double beta, double i) {
double tmp;
if (i <= 1.7e+46) {
tmp = (alpha + i) * (i / (beta * beta));
} else {
tmp = 0.0625;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (i <= 1.7d+46) then
tmp = (alpha + i) * (i / (beta * beta))
else
tmp = 0.0625d0
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (i <= 1.7e+46) {
tmp = (alpha + i) * (i / (beta * beta));
} else {
tmp = 0.0625;
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if i <= 1.7e+46: tmp = (alpha + i) * (i / (beta * beta)) else: tmp = 0.0625 return tmp
function code(alpha, beta, i) tmp = 0.0 if (i <= 1.7e+46) tmp = Float64(Float64(alpha + i) * Float64(i / Float64(beta * beta))); else tmp = 0.0625; end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (i <= 1.7e+46) tmp = (alpha + i) * (i / (beta * beta)); else tmp = 0.0625; end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[i, 1.7e+46], N[(N[(alpha + i), $MachinePrecision] * N[(i / N[(beta * beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0625]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.7 \cdot 10^{+46}:\\
\;\;\;\;\left(\alpha + i\right) \cdot \frac{i}{\beta \cdot \beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if i < 1.6999999999999999e46Initial program 49.6%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6429.6
Applied rewrites29.6%
Applied rewrites21.4%
if 1.6999999999999999e46 < i Initial program 8.0%
Taylor expanded in i around inf
Applied rewrites76.4%
(FPCore (alpha beta i) :precision binary64 (if (<= i 1.7e+46) (* i (/ (+ alpha i) (* beta beta))) 0.0625))
double code(double alpha, double beta, double i) {
double tmp;
if (i <= 1.7e+46) {
tmp = i * ((alpha + i) / (beta * beta));
} else {
tmp = 0.0625;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (i <= 1.7d+46) then
tmp = i * ((alpha + i) / (beta * beta))
else
tmp = 0.0625d0
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (i <= 1.7e+46) {
tmp = i * ((alpha + i) / (beta * beta));
} else {
tmp = 0.0625;
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if i <= 1.7e+46: tmp = i * ((alpha + i) / (beta * beta)) else: tmp = 0.0625 return tmp
function code(alpha, beta, i) tmp = 0.0 if (i <= 1.7e+46) tmp = Float64(i * Float64(Float64(alpha + i) / Float64(beta * beta))); else tmp = 0.0625; end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (i <= 1.7e+46) tmp = i * ((alpha + i) / (beta * beta)); else tmp = 0.0625; end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[i, 1.7e+46], N[(i * N[(N[(alpha + i), $MachinePrecision] / N[(beta * beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0625]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.7 \cdot 10^{+46}:\\
\;\;\;\;i \cdot \frac{\alpha + i}{\beta \cdot \beta}\\
\mathbf{else}:\\
\;\;\;\;0.0625\\
\end{array}
\end{array}
if i < 1.6999999999999999e46Initial program 49.6%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6429.6
Applied rewrites29.6%
Applied rewrites18.2%
Applied rewrites29.6%
Applied rewrites21.4%
if 1.6999999999999999e46 < i Initial program 8.0%
Taylor expanded in i around inf
Applied rewrites76.4%
(FPCore (alpha beta i) :precision binary64 (if (<= beta 1.02e+229) 0.0625 (* alpha (/ i (* beta beta)))))
double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.02e+229) {
tmp = 0.0625;
} else {
tmp = alpha * (i / (beta * beta));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(alpha, beta, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
real(8) :: tmp
if (beta <= 1.02d+229) then
tmp = 0.0625d0
else
tmp = alpha * (i / (beta * beta))
end if
code = tmp
end function
public static double code(double alpha, double beta, double i) {
double tmp;
if (beta <= 1.02e+229) {
tmp = 0.0625;
} else {
tmp = alpha * (i / (beta * beta));
}
return tmp;
}
def code(alpha, beta, i): tmp = 0 if beta <= 1.02e+229: tmp = 0.0625 else: tmp = alpha * (i / (beta * beta)) return tmp
function code(alpha, beta, i) tmp = 0.0 if (beta <= 1.02e+229) tmp = 0.0625; else tmp = Float64(alpha * Float64(i / Float64(beta * beta))); end return tmp end
function tmp_2 = code(alpha, beta, i) tmp = 0.0; if (beta <= 1.02e+229) tmp = 0.0625; else tmp = alpha * (i / (beta * beta)); end tmp_2 = tmp; end
code[alpha_, beta_, i_] := If[LessEqual[beta, 1.02e+229], 0.0625, N[(alpha * N[(i / N[(beta * beta), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\beta \leq 1.02 \cdot 10^{+229}:\\
\;\;\;\;0.0625\\
\mathbf{else}:\\
\;\;\;\;\alpha \cdot \frac{i}{\beta \cdot \beta}\\
\end{array}
\end{array}
if beta < 1.01999999999999994e229Initial program 15.0%
Taylor expanded in i around inf
Applied rewrites72.3%
if 1.01999999999999994e229 < beta Initial program 0.0%
Taylor expanded in beta around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-/.f6470.8
Applied rewrites70.8%
Taylor expanded in alpha around inf
Applied rewrites36.3%
(FPCore (alpha beta i) :precision binary64 0.0625)
double code(double alpha, double beta, double i) {
return 0.0625;
}
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, i)
use fmin_fmax_functions
real(8), intent (in) :: alpha
real(8), intent (in) :: beta
real(8), intent (in) :: i
code = 0.0625d0
end function
public static double code(double alpha, double beta, double i) {
return 0.0625;
}
def code(alpha, beta, i): return 0.0625
function code(alpha, beta, i) return 0.0625 end
function tmp = code(alpha, beta, i) tmp = 0.0625; end
code[alpha_, beta_, i_] := 0.0625
\begin{array}{l}
\\
0.0625
\end{array}
Initial program 14.2%
Taylor expanded in i around inf
Applied rewrites69.2%
herbie shell --seed 2024356
(FPCore (alpha beta i)
:name "Octave 3.8, jcobi/4"
:precision binary64
:pre (and (and (> alpha -1.0) (> beta -1.0)) (> i 1.0))
(/ (/ (* (* i (+ (+ alpha beta) i)) (+ (* beta alpha) (* i (+ (+ alpha beta) i)))) (* (+ (+ alpha beta) (* 2.0 i)) (+ (+ alpha beta) (* 2.0 i)))) (- (* (+ (+ alpha beta) (* 2.0 i)) (+ (+ alpha beta) (* 2.0 i))) 1.0)))