
(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
(if (<= m -1.25e-20)
(/ (* a (pow k m)) (fma 10.0 k 1.0))
(if (<= m 0.0145)
(* (/ (fma (log k) m 1.0) (fma (+ 10.0 k) k 1.0)) a)
(* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.25e-20) {
tmp = (a * pow(k, m)) / fma(10.0, k, 1.0);
} else if (m <= 0.0145) {
tmp = (fma(log(k), m, 1.0) / fma((10.0 + k), k, 1.0)) * a;
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.25e-20) tmp = Float64(Float64(a * (k ^ m)) / fma(10.0, k, 1.0)); elseif (m <= 0.0145) tmp = Float64(Float64(fma(log(k), m, 1.0) / fma(Float64(10.0 + k), k, 1.0)) * a); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.25e-20], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.0145], N[(N[(N[(N[Log[k], $MachinePrecision] * m + 1.0), $MachinePrecision] / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.25 \cdot 10^{-20}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{elif}\;m \leq 0.0145:\\
\;\;\;\;\frac{\mathsf{fma}\left(\log k, m, 1\right)}{\mathsf{fma}\left(10 + k, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -1.25e-20Initial program 90.3%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6480.3
Applied rewrites80.3%
if -1.25e-20 < m < 0.0145000000000000007Initial program 90.3%
lift-/.f64N/A
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
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.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
Taylor expanded in m around 0
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
if 0.0145000000000000007 < m Initial program 90.3%
lift-/.f64N/A
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
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.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -150.0)
t_0
(if (<= m 0.0145)
(* (/ (fma (log k) m 1.0) (fma (+ 10.0 k) 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 <= -150.0) {
tmp = t_0;
} else if (m <= 0.0145) {
tmp = (fma(log(k), m, 1.0) / fma((10.0 + k), 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 <= -150.0) tmp = t_0; elseif (m <= 0.0145) tmp = Float64(Float64(fma(log(k), m, 1.0) / fma(Float64(10.0 + k), 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, -150.0], t$95$0, If[LessEqual[m, 0.0145], N[(N[(N[(N[Log[k], $MachinePrecision] * m + 1.0), $MachinePrecision] / N[(N[(10.0 + k), $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 -150:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 0.0145:\\
\;\;\;\;\frac{\mathsf{fma}\left(\log k, m, 1\right)}{\mathsf{fma}\left(10 + k, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -150 or 0.0145000000000000007 < m Initial program 90.3%
lift-/.f64N/A
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
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.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
if -150 < m < 0.0145000000000000007Initial program 90.3%
lift-/.f64N/A
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
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.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
Taylor expanded in m around 0
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
(FPCore (a k m) :precision binary64 (if (<= m 3.8) (* 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 <= 3.8) {
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 <= 3.8) 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, 3.8], 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 3.8:\\
\;\;\;\;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 < 3.7999999999999998Initial program 90.3%
lift-/.f64N/A
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
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 3.7999999999999998 < m Initial program 90.3%
lift-/.f64N/A
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
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.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -150.0)
t_0
(if (<= m 0.0175) (* a (/ 1.0 (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 <= -150.0) {
tmp = t_0;
} else if (m <= 0.0175) {
tmp = a * (1.0 / 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 <= -150.0) tmp = t_0; elseif (m <= 0.0175) tmp = Float64(a * Float64(1.0 / 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, -150.0], t$95$0, If[LessEqual[m, 0.0175], N[(a * N[(1.0 / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -150:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 0.0175:\\
\;\;\;\;a \cdot \frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -150 or 0.017500000000000002 < m Initial program 90.3%
lift-/.f64N/A
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
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.f6483.0
Applied rewrites83.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
if -150 < m < 0.017500000000000002Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
(FPCore (a k m)
:precision binary64
(if (<= m -150.0)
(/ a (* k k))
(if (<= m 0.78)
(* a (/ 1.0 (fma (+ 10.0 k) k 1.0)))
(* a (* (* k k) 99.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -150.0) {
tmp = a / (k * k);
} else if (m <= 0.78) {
tmp = a * (1.0 / fma((10.0 + k), k, 1.0));
} else {
tmp = a * ((k * k) * 99.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -150.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.78) tmp = Float64(a * Float64(1.0 / fma(Float64(10.0 + k), k, 1.0))); else tmp = Float64(a * Float64(Float64(k * k) * 99.0)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -150.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.78], N[(a * N[(1.0 / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * k), $MachinePrecision] * 99.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -150:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.78:\\
\;\;\;\;a \cdot \frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(k \cdot k\right) \cdot 99\right)\\
\end{array}
\end{array}
if m < -150Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
if -150 < m < 0.78000000000000003Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
if 0.78000000000000003 < m Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6428.9
Applied rewrites28.9%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6422.7
Applied rewrites22.7%
(FPCore (a k m) :precision binary64 (if (<= m -150.0) (/ a (* k k)) (if (<= m 0.78) (/ a (fma (+ 10.0 k) k 1.0)) (* a (* (* k k) 99.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -150.0) {
tmp = a / (k * k);
} else if (m <= 0.78) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = a * ((k * k) * 99.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -150.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.78) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64(a * Float64(Float64(k * k) * 99.0)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -150.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.78], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * k), $MachinePrecision] * 99.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -150:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.78:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(k \cdot k\right) \cdot 99\right)\\
\end{array}
\end{array}
if m < -150Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
if -150 < m < 0.78000000000000003Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
if 0.78000000000000003 < m Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6428.9
Applied rewrites28.9%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6422.7
Applied rewrites22.7%
(FPCore (a k m) :precision binary64 (if (<= m -150.0) (/ a (* k k)) (if (<= m 0.5) (/ a (fma 10.0 k 1.0)) (* a (* (* k k) 99.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -150.0) {
tmp = a / (k * k);
} else if (m <= 0.5) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = a * ((k * k) * 99.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -150.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.5) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(a * Float64(Float64(k * k) * 99.0)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -150.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.5], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * k), $MachinePrecision] * 99.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -150:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.5:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(\left(k \cdot k\right) \cdot 99\right)\\
\end{array}
\end{array}
if m < -150Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
if -150 < m < 0.5Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
Applied rewrites28.5%
if 0.5 < m Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f6428.9
Applied rewrites28.9%
Taylor expanded in k around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6422.7
Applied rewrites22.7%
(FPCore (a k m) :precision binary64 (if (<= m -150.0) (/ a (* k k)) (if (<= m 2e+28) (/ a (fma 10.0 k 1.0)) (* a (* -10.0 k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -150.0) {
tmp = a / (k * k);
} else if (m <= 2e+28) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = a * (-10.0 * k);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -150.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 2e+28) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(a * Float64(-10.0 * k)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -150.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2e+28], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(-10.0 * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -150:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2 \cdot 10^{+28}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-10 \cdot k\right)\\
\end{array}
\end{array}
if m < -150Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
if -150 < m < 1.99999999999999992e28Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
Applied rewrites28.5%
if 1.99999999999999992e28 < m Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6420.9
Applied rewrites20.9%
Taylor expanded in k around inf
lower-*.f648.2
Applied rewrites8.2%
(FPCore (a k m) :precision binary64 (if (<= k -4e-310) (* a (* -10.0 k)) (if (<= k 0.112) (fma (* k a) -10.0 a) (/ a (* k k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -4e-310) {
tmp = a * (-10.0 * k);
} else if (k <= 0.112) {
tmp = fma((k * a), -10.0, a);
} else {
tmp = a / (k * k);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= -4e-310) tmp = Float64(a * Float64(-10.0 * k)); elseif (k <= 0.112) tmp = fma(Float64(k * a), -10.0, a); else tmp = Float64(a / Float64(k * k)); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, -4e-310], N[(a * N[(-10.0 * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.112], N[(N[(k * a), $MachinePrecision] * -10.0 + a), $MachinePrecision], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -4 \cdot 10^{-310}:\\
\;\;\;\;a \cdot \left(-10 \cdot k\right)\\
\mathbf{elif}\;k \leq 0.112:\\
\;\;\;\;\mathsf{fma}\left(k \cdot a, -10, a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\end{array}
\end{array}
if k < -3.999999999999988e-310Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6420.9
Applied rewrites20.9%
Taylor expanded in k around inf
lower-*.f648.2
Applied rewrites8.2%
if -3.999999999999988e-310 < k < 0.112000000000000002Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6420.9
Applied rewrites20.9%
if 0.112000000000000002 < k Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
(FPCore (a k m) :precision binary64 (if (<= k -4e-310) (* a (* -10.0 k)) (if (<= k 820.0) (/ a 1.0) (/ a (* k k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -4e-310) {
tmp = a * (-10.0 * k);
} else if (k <= 820.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 <= (-4d-310)) then
tmp = a * ((-10.0d0) * k)
else if (k <= 820.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 <= -4e-310) {
tmp = a * (-10.0 * k);
} else if (k <= 820.0) {
tmp = a / 1.0;
} else {
tmp = a / (k * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -4e-310: tmp = a * (-10.0 * k) elif k <= 820.0: tmp = a / 1.0 else: tmp = a / (k * k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -4e-310) tmp = Float64(a * Float64(-10.0 * k)); elseif (k <= 820.0) tmp = Float64(a / 1.0); else tmp = Float64(a / Float64(k * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -4e-310) tmp = a * (-10.0 * k); elseif (k <= 820.0) tmp = a / 1.0; else tmp = a / (k * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -4e-310], N[(a * N[(-10.0 * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 820.0], N[(a / 1.0), $MachinePrecision], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -4 \cdot 10^{-310}:\\
\;\;\;\;a \cdot \left(-10 \cdot k\right)\\
\mathbf{elif}\;k \leq 820:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\end{array}
\end{array}
if k < -3.999999999999988e-310Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6420.9
Applied rewrites20.9%
Taylor expanded in k around inf
lower-*.f648.2
Applied rewrites8.2%
if -3.999999999999988e-310 < k < 820Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
Taylor expanded in k around 0
Applied rewrites20.2%
if 820 < k Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
(FPCore (a k m) :precision binary64 (if (<= m 2e+28) (/ a 1.0) (* a (* -10.0 k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2e+28) {
tmp = a / 1.0;
} else {
tmp = a * (-10.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 (m <= 2d+28) then
tmp = a / 1.0d0
else
tmp = a * ((-10.0d0) * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2e+28) {
tmp = a / 1.0;
} else {
tmp = a * (-10.0 * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2e+28: tmp = a / 1.0 else: tmp = a * (-10.0 * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2e+28) tmp = Float64(a / 1.0); else tmp = Float64(a * Float64(-10.0 * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2e+28) tmp = a / 1.0; else tmp = a * (-10.0 * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2e+28], N[(a / 1.0), $MachinePrecision], N[(a * N[(-10.0 * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2 \cdot 10^{+28}:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(-10 \cdot k\right)\\
\end{array}
\end{array}
if m < 1.99999999999999992e28Initial program 90.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
Taylor expanded in k around 0
Applied rewrites20.2%
if 1.99999999999999992e28 < m Initial program 90.3%
lift-/.f64N/A
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
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 m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around 0
+-commutativeN/A
lower-fma.f6420.9
Applied rewrites20.9%
Taylor expanded in k around inf
lower-*.f648.2
Applied rewrites8.2%
(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.3%
Taylor expanded in m around 0
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
Taylor expanded in k around inf
*-commutativeN/A
+-commutativeN/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
pow2N/A
lower-*.f6435.5
Applied rewrites35.5%
Taylor expanded in k around 0
Applied rewrites20.2%
herbie shell --seed 2025127
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))