
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (if (<= k 4e-62) (* (/ 1.0 (/ 1.0 (pow k m))) a) (/ (* a (pow k (+ m -1.0))) (- (- k -10.0) (/ -1.0 k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 4e-62) {
tmp = (1.0 / (1.0 / pow(k, m))) * a;
} else {
tmp = (a * pow(k, (m + -1.0))) / ((k - -10.0) - (-1.0 / k));
}
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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 4d-62) then
tmp = (1.0d0 / (1.0d0 / (k ** m))) * a
else
tmp = (a * (k ** (m + (-1.0d0)))) / ((k - (-10.0d0)) - ((-1.0d0) / k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 4e-62) {
tmp = (1.0 / (1.0 / Math.pow(k, m))) * a;
} else {
tmp = (a * Math.pow(k, (m + -1.0))) / ((k - -10.0) - (-1.0 / k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 4e-62: tmp = (1.0 / (1.0 / math.pow(k, m))) * a else: tmp = (a * math.pow(k, (m + -1.0))) / ((k - -10.0) - (-1.0 / k)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 4e-62) tmp = Float64(Float64(1.0 / Float64(1.0 / (k ^ m))) * a); else tmp = Float64(Float64(a * (k ^ Float64(m + -1.0))) / Float64(Float64(k - -10.0) - Float64(-1.0 / k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 4e-62) tmp = (1.0 / (1.0 / (k ^ m))) * a; else tmp = (a * (k ^ (m + -1.0))) / ((k - -10.0) - (-1.0 / k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 4e-62], N[(N[(1.0 / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(a * N[Power[k, N[(m + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-62}:\\
\;\;\;\;\frac{1}{\frac{1}{{k}^{m}}} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot {k}^{\left(m + -1\right)}}{\left(k - -10\right) - \frac{-1}{k}}\\
\end{array}
\end{array}
if k < 4.0000000000000002e-62Initial program 90.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
Applied rewrites82.8%
if 4.0000000000000002e-62 < k Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Applied rewrites89.8%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-neg-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-pow.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites83.5%
(FPCore (a k m) :precision binary64 (if (<= k 0.00186) (* (/ 1.0 (/ 1.0 (pow k m))) a) (/ (* (pow k m) (/ a k)) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.00186) {
tmp = (1.0 / (1.0 / pow(k, m))) * a;
} else {
tmp = (pow(k, m) * (a / k)) / k;
}
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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.00186d0) then
tmp = (1.0d0 / (1.0d0 / (k ** m))) * a
else
tmp = ((k ** m) * (a / k)) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.00186) {
tmp = (1.0 / (1.0 / Math.pow(k, m))) * a;
} else {
tmp = (Math.pow(k, m) * (a / k)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.00186: tmp = (1.0 / (1.0 / math.pow(k, m))) * a else: tmp = (math.pow(k, m) * (a / k)) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.00186) tmp = Float64(Float64(1.0 / Float64(1.0 / (k ^ m))) * a); else tmp = Float64(Float64((k ^ m) * Float64(a / k)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.00186) tmp = (1.0 / (1.0 / (k ^ m))) * a; else tmp = ((k ^ m) * (a / k)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.00186], N[(N[(1.0 / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00186:\\
\;\;\;\;\frac{1}{\frac{1}{{k}^{m}}} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m} \cdot \frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 0.0018600000000000001Initial program 90.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
Applied rewrites82.8%
if 0.0018600000000000001 < k Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Applied rewrites89.8%
Taylor expanded in k around inf
lower-/.f6475.1
Applied rewrites75.1%
(FPCore (a k m) :precision binary64 (if (<= k 0.00186) (* (/ 1.0 (/ 1.0 (pow k m))) a) (* (/ a k) (pow k (+ m -1.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.00186) {
tmp = (1.0 / (1.0 / pow(k, m))) * a;
} else {
tmp = (a / k) * pow(k, (m + -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.00186d0) then
tmp = (1.0d0 / (1.0d0 / (k ** m))) * a
else
tmp = (a / k) * (k ** (m + (-1.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.00186) {
tmp = (1.0 / (1.0 / Math.pow(k, m))) * a;
} else {
tmp = (a / k) * Math.pow(k, (m + -1.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.00186: tmp = (1.0 / (1.0 / math.pow(k, m))) * a else: tmp = (a / k) * math.pow(k, (m + -1.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.00186) tmp = Float64(Float64(1.0 / Float64(1.0 / (k ^ m))) * a); else tmp = Float64(Float64(a / k) * (k ^ Float64(m + -1.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.00186) tmp = (1.0 / (1.0 / (k ^ m))) * a; else tmp = (a / k) * (k ^ (m + -1.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.00186], N[(N[(1.0 / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[Power[k, N[(m + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00186:\\
\;\;\;\;\frac{1}{\frac{1}{{k}^{m}}} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot {k}^{\left(m + -1\right)}\\
\end{array}
\end{array}
if k < 0.0018600000000000001Initial program 90.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
Applied rewrites82.8%
if 0.0018600000000000001 < k Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Applied rewrites89.8%
Taylor expanded in k around inf
lower-/.f6475.1
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-pow.f64N/A
inv-powN/A
pow-prod-upN/A
lower-pow.f64N/A
lower-+.f6464.4
Applied rewrites64.4%
(FPCore (a k m) :precision binary64 (if (<= k 0.00186) (* (pow k m) a) (* (/ a k) (pow k (+ m -1.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.00186) {
tmp = pow(k, m) * a;
} else {
tmp = (a / k) * pow(k, (m + -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.00186d0) then
tmp = (k ** m) * a
else
tmp = (a / k) * (k ** (m + (-1.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.00186) {
tmp = Math.pow(k, m) * a;
} else {
tmp = (a / k) * Math.pow(k, (m + -1.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.00186: tmp = math.pow(k, m) * a else: tmp = (a / k) * math.pow(k, (m + -1.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.00186) tmp = Float64((k ^ m) * a); else tmp = Float64(Float64(a / k) * (k ^ Float64(m + -1.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.00186) tmp = (k ^ m) * a; else tmp = (a / k) * (k ^ (m + -1.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.00186], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[Power[k, N[(m + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00186:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot {k}^{\left(m + -1\right)}\\
\end{array}
\end{array}
if k < 0.0018600000000000001Initial program 90.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
lower-pow.f6482.8
Applied rewrites82.8%
if 0.0018600000000000001 < k Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Applied rewrites89.8%
Taylor expanded in k around inf
lower-/.f6475.1
Applied rewrites75.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
mult-flip-revN/A
lift-pow.f64N/A
inv-powN/A
pow-prod-upN/A
lower-pow.f64N/A
lower-+.f6464.4
Applied rewrites64.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -2.55e-5)
t_0
(if (<= m 9.6e-7) (* (/ 1.0 (fma (- k -10.0) k 1.0)) a) t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -2.55e-5) {
tmp = t_0;
} else if (m <= 9.6e-7) {
tmp = (1.0 / fma((k - -10.0), k, 1.0)) * a;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -2.55e-5) tmp = t_0; elseif (m <= 9.6e-7) tmp = Float64(Float64(1.0 / fma(Float64(k - -10.0), k, 1.0)) * a); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -2.55e-5], t$95$0, If[LessEqual[m, 9.6e-7], N[(N[(1.0 / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -2.55 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 9.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -2.54999999999999998e-5 or 9.59999999999999914e-7 < m Initial program 90.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.5%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
lower-pow.f6482.8
Applied rewrites82.8%
if -2.54999999999999998e-5 < m < 9.59999999999999914e-7Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.8
Applied rewrites44.8%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 1e+207) (* (/ 1.0 (fma (- k -10.0) k 1.0)) a) (* (+ 1.0 (* k (- (* 99.0 k) 10.0))) a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 1e+207) {
tmp = (1.0 / fma((k - -10.0), k, 1.0)) * a;
} else {
tmp = (1.0 + (k * ((99.0 * k) - 10.0))) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 1e+207) tmp = Float64(Float64(1.0 / fma(Float64(k - -10.0), k, 1.0)) * a); else tmp = Float64(Float64(1.0 + Float64(k * Float64(Float64(99.0 * k) - 10.0))) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+207], N[(N[(1.0 / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(1.0 + N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 10^{+207}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1e207Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.8
Applied rewrites44.8%
if 1e207 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.8
Applied rewrites44.8%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6428.8
Applied rewrites28.8%
(FPCore (a k m) :precision binary64 (* (/ 1.0 (fma (- k -10.0) k 1.0)) a))
double code(double a, double k, double m) {
return (1.0 / fma((k - -10.0), k, 1.0)) * a;
}
function code(a, k, m) return Float64(Float64(1.0 / fma(Float64(k - -10.0), k, 1.0)) * a) end
code[a_, k_, m_] := N[(N[(1.0 / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a
\end{array}
Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.8
Applied rewrites44.8%
(FPCore (a k m) :precision binary64 (/ a (fma (- k -10.0) k 1.0)))
double code(double a, double k, double m) {
return a / fma((k - -10.0), k, 1.0);
}
function code(a, k, m) return Float64(a / fma(Float64(k - -10.0), k, 1.0)) end
code[a_, k_, m_] := N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}
\end{array}
Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lift-fma.f6444.9
Applied rewrites44.9%
(FPCore (a k m) :precision binary64 (if (<= m 1.9e+34) (/ a (+ 1.0 (* k 10.0))) (* (+ 1.0 (* -10.0 k)) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.9e+34) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (1.0 + (-10.0 * k)) * a;
}
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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.9d+34) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (1.0d0 + ((-10.0d0) * k)) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.9e+34) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (1.0 + (-10.0 * k)) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.9e+34: tmp = a / (1.0 + (k * 10.0)) else: tmp = (1.0 + (-10.0 * k)) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.9e+34) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(1.0 + Float64(-10.0 * k)) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.9e+34) tmp = a / (1.0 + (k * 10.0)); else tmp = (1.0 + (-10.0 * k)) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.9e+34], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(-10.0 * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.9 \cdot 10^{+34}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -10 \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 1.9000000000000001e34Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
Taylor expanded in k around 0
Applied rewrites28.1%
if 1.9000000000000001e34 < m Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
mult-flipN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
*-commutativeN/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6444.8
Applied rewrites44.8%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f6420.7
Applied rewrites20.7%
(FPCore (a k m) :precision binary64 (+ a (* -10.0 (* a k))))
double code(double a, double k, double m) {
return a + (-10.0 * (a * k));
}
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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a + ((-10.0d0) * (a * k))
end function
public static double code(double a, double k, double m) {
return a + (-10.0 * (a * k));
}
def code(a, k, m): return a + (-10.0 * (a * k))
function code(a, k, m) return Float64(a + Float64(-10.0 * Float64(a * k))) end
function tmp = code(a, k, m) tmp = a + (-10.0 * (a * k)); end
code[a_, k_, m_] := N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a + -10 \cdot \left(a \cdot k\right)
\end{array}
Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6420.7
Applied rewrites20.7%
(FPCore (a k m) :precision binary64 (/ a 1.0))
double code(double a, double k, double m) {
return a / 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(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a / 1.0d0
end function
public static double code(double a, double k, double m) {
return a / 1.0;
}
def code(a, k, m): return a / 1.0
function code(a, k, m) return Float64(a / 1.0) end
function tmp = code(a, k, m) tmp = a / 1.0; end
code[a_, k_, m_] := N[(a / 1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1}
\end{array}
Initial program 90.5%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
mult-flipN/A
metadata-evalN/A
associate-*l/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6444.9
Applied rewrites44.9%
Taylor expanded in k around 0
Applied rewrites19.9%
herbie shell --seed 2025154
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))