
(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 12 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
(let* ((t_0 (* (pow k m) a)))
(if (<= m -3.2e+17)
t_0
(if (<= m 1.95e-14) (/ a (fma (+ 10.0 k) k 1.0)) t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -3.2e+17) {
tmp = t_0;
} else if (m <= 1.95e-14) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -3.2e+17) tmp = t_0; elseif (m <= 1.95e-14) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); 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, -3.2e+17], t$95$0, If[LessEqual[m, 1.95e-14], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -3.2 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -3.2e17 or 1.9499999999999999e-14 < m Initial program 90.2%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-+l+N/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
lift-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
if -3.2e17 < m < 1.9499999999999999e-14Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.95e-14) (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95e-14) {
tmp = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
} else {
tmp = pow(k, m) * 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.95d-14) then
tmp = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.95e-14) {
tmp = (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.95e-14: tmp = (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k)) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.95e-14) tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.95e-14) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.95e-14], 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], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 1.9499999999999999e-14Initial program 90.2%
if 1.9499999999999999e-14 < m Initial program 90.2%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-+l+N/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
lift-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
(FPCore (a k m) :precision binary64 (if (<= m 1.95e-14) (* a (/ (pow k m) (fma (+ 10.0 k) k 1.0))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95e-14) {
tmp = a * (pow(k, m) / fma((10.0 + k), k, 1.0));
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 1.95e-14) tmp = Float64(a * Float64((k ^ m) / fma(Float64(10.0 + k), k, 1.0))); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 1.95e-14], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 1.9499999999999999e-14Initial program 90.2%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-+l+N/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.3
Applied rewrites90.3%
if 1.9499999999999999e-14 < m Initial program 90.2%
lift-*.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
pow2N/A
associate-+l+N/A
lower-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-pow.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
lift-pow.f6482.4
Applied rewrites82.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
(FPCore (a k m) :precision binary64 (if (<= m -1.26e+20) (* a (/ 1.0 (* k k))) (if (<= m 0.95) (/ a (fma (+ 10.0 k) k 1.0)) (* (* (* k k) a) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.26e+20) {
tmp = a * (1.0 / (k * k));
} else if (m <= 0.95) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = ((k * k) * a) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.26e+20) tmp = Float64(a * Float64(1.0 / Float64(k * k))); elseif (m <= 0.95) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64(Float64(Float64(k * k) * a) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.26e+20], N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.95], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * k), $MachinePrecision] * a), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.26 \cdot 10^{+20}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.95:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot k\right) \cdot a\right) \cdot 99\\
\end{array}
\end{array}
if m < -1.26e20Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6435.9
Applied rewrites35.9%
if -1.26e20 < m < 0.94999999999999996Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
if 0.94999999999999996 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6421.7
Applied rewrites21.7%
(FPCore (a k m) :precision binary64 (if (<= m -5.5e-50) (* a (/ 1.0 (* k k))) (if (<= m 0.25) (/ a (fma 10.0 k 1.0)) (* (* (* k k) a) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.5e-50) {
tmp = a * (1.0 / (k * k));
} else if (m <= 0.25) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = ((k * k) * a) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -5.5e-50) tmp = Float64(a * Float64(1.0 / Float64(k * k))); elseif (m <= 0.25) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(Float64(Float64(k * k) * a) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -5.5e-50], N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.25], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * k), $MachinePrecision] * a), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.5 \cdot 10^{-50}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.25:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot k\right) \cdot a\right) \cdot 99\\
\end{array}
\end{array}
if m < -5.49999999999999975e-50Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6435.9
Applied rewrites35.9%
if -5.49999999999999975e-50 < m < 0.25Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites28.9%
if 0.25 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6421.7
Applied rewrites21.7%
(FPCore (a k m) :precision binary64 (if (<= m -5.5e-50) (/ a (* k k)) (if (<= m 0.25) (/ a (fma 10.0 k 1.0)) (* (* (* k k) a) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.5e-50) {
tmp = a / (k * k);
} else if (m <= 0.25) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = ((k * k) * a) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -5.5e-50) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.25) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(Float64(Float64(k * k) * a) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -5.5e-50], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.25], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * k), $MachinePrecision] * a), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.5 \cdot 10^{-50}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.25:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot k\right) \cdot a\right) \cdot 99\\
\end{array}
\end{array}
if m < -5.49999999999999975e-50Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if -5.49999999999999975e-50 < m < 0.25Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites28.9%
if 0.25 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6421.7
Applied rewrites21.7%
(FPCore (a k m) :precision binary64 (if (<= m -5.5e-50) (/ a (* k k)) (if (<= m 0.25) (/ a (fma 10.0 k 1.0)) (* (* k k) (* 99.0 a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.5e-50) {
tmp = a / (k * k);
} else if (m <= 0.25) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = (k * k) * (99.0 * a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -5.5e-50) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.25) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(Float64(k * k) * Float64(99.0 * a)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -5.5e-50], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.25], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(k * k), $MachinePrecision] * N[(99.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.5 \cdot 10^{-50}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.25:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot k\right) \cdot \left(99 \cdot a\right)\\
\end{array}
\end{array}
if m < -5.49999999999999975e-50Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if -5.49999999999999975e-50 < m < 0.25Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites28.9%
if 0.25 < m Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6421.7
Applied rewrites21.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f6421.7
Applied rewrites21.7%
(FPCore (a k m) :precision binary64 (if (<= k 1.65e-308) (/ a (* k k)) (if (<= k 19.0) (/ a (fma 10.0 k 1.0)) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.65e-308) {
tmp = a / (k * k);
} else if (k <= 19.0) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = (a / k) / k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 1.65e-308) tmp = Float64(a / Float64(k * k)); elseif (k <= 19.0) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(Float64(a / k) / k); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 1.65e-308], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 19.0], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.65 \cdot 10^{-308}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 19:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.6499999999999999e-308Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if 1.6499999999999999e-308 < k < 19Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites28.9%
if 19 < k Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f6434.5
Applied rewrites34.5%
(FPCore (a k m) :precision binary64 (if (<= k 1.65e-308) (/ a (* k k)) (if (<= k 0.1) (fma (* -10.0 a) k a) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.65e-308) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = fma((-10.0 * a), k, a);
} else {
tmp = (a / k) / k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 1.65e-308) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.1) tmp = fma(Float64(-10.0 * a), k, a); else tmp = Float64(Float64(a / k) / k); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 1.65e-308], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], N[(N[(-10.0 * a), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.65 \cdot 10^{-308}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;\mathsf{fma}\left(-10 \cdot a, k, a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.6499999999999999e-308Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if 1.6499999999999999e-308 < k < 0.10000000000000001Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6427.4
Applied rewrites27.4%
Taylor expanded in k around 0
lower-*.f6421.3
Applied rewrites21.3%
if 0.10000000000000001 < k Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f6434.5
Applied rewrites34.5%
(FPCore (a k m) :precision binary64 (if (<= k 1.65e-308) (/ a (* k k)) (if (<= k 19.0) (/ a 1.0) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.65e-308) {
tmp = a / (k * k);
} else if (k <= 19.0) {
tmp = a / 1.0;
} else {
tmp = (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 <= 1.65d-308) then
tmp = a / (k * k)
else if (k <= 19.0d0) then
tmp = a / 1.0d0
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.65e-308) {
tmp = a / (k * k);
} else if (k <= 19.0) {
tmp = a / 1.0;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.65e-308: tmp = a / (k * k) elif k <= 19.0: tmp = a / 1.0 else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.65e-308) tmp = Float64(a / Float64(k * k)); elseif (k <= 19.0) tmp = Float64(a / 1.0); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.65e-308) tmp = a / (k * k); elseif (k <= 19.0) tmp = a / 1.0; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.65e-308], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 19.0], N[(a / 1.0), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.65 \cdot 10^{-308}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 19:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.6499999999999999e-308Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if 1.6499999999999999e-308 < k < 19Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites20.5%
if 19 < k Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f6434.5
Applied rewrites34.5%
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ a (* k k)))) (if (<= k 1.65e-308) t_0 (if (<= k 19.0) (/ a 1.0) t_0))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 1.65e-308) {
tmp = t_0;
} else if (k <= 19.0) {
tmp = a / 1.0;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a / (k * k)
if (k <= 1.65d-308) then
tmp = t_0
else if (k <= 19.0d0) then
tmp = a / 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 1.65e-308) {
tmp = t_0;
} else if (k <= 19.0) {
tmp = a / 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= 1.65e-308: tmp = t_0 elif k <= 19.0: tmp = a / 1.0 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= 1.65e-308) tmp = t_0; elseif (k <= 19.0) tmp = Float64(a / 1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (k <= 1.65e-308) tmp = t_0; elseif (k <= 19.0) tmp = a / 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.65e-308], t$95$0, If[LessEqual[k, 19.0], N[(a / 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq 1.65 \cdot 10^{-308}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;k \leq 19:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if k < 1.6499999999999999e-308 or 19 < k Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.8
Applied rewrites35.8%
if 1.6499999999999999e-308 < k < 19Initial program 90.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites20.5%
(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.2%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6445.5
Applied rewrites45.5%
lift-+.f64N/A
lift-fma.f64N/A
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
+-commutativeN/A
lift-fma.f64N/A
lower-+.f64N/A
pow2N/A
lift-*.f6445.5
Applied rewrites45.5%
Taylor expanded in k around 0
Applied rewrites20.5%
herbie shell --seed 2025142
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))