
(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}
Sampling outcomes in binary64 precision:
Herbie found 14 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 4.4e-17) (/ (* 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 <= 4.4e-17) {
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 <= 4.4d-17) 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 <= 4.4e-17) {
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 <= 4.4e-17: 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 <= 4.4e-17) 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 <= 4.4e-17) 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, 4.4e-17], 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 4.4 \cdot 10^{-17}:\\
\;\;\;\;\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 < 4.4e-17Initial program 96.8%
if 4.4e-17 < m Initial program 74.4%
Taylor expanded in k around 0
Applied rewrites100.0%
Taylor expanded in k around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r*N/A
exp-prodN/A
lower-pow.f64N/A
mul-1-negN/A
lower-exp.f64N/A
lower-neg.f64N/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-/.f6441.1
Applied rewrites41.1%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64100.0
Applied rewrites100.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.4e-18) (not (<= m 4.4e-17))) (* (pow k m) a) (/ a (fma (- k -10.0) k 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.4e-18) || !(m <= 4.4e-17)) {
tmp = pow(k, m) * a;
} else {
tmp = a / fma((k - -10.0), k, 1.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((m <= -5.4e-18) || !(m <= 4.4e-17)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[m, -5.4e-18], N[Not[LessEqual[m, 4.4e-17]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.4 \cdot 10^{-18} \lor \neg \left(m \leq 4.4 \cdot 10^{-17}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\end{array}
\end{array}
if m < -5.39999999999999977e-18 or 4.4e-17 < m Initial program 87.2%
Taylor expanded in k around 0
Applied rewrites100.0%
Taylor expanded in k around inf
*-commutativeN/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
associate-*r*N/A
exp-prodN/A
lower-pow.f64N/A
mul-1-negN/A
lower-exp.f64N/A
lower-neg.f64N/A
log-recN/A
lower-neg.f64N/A
lower-log.f64N/A
lower-/.f6449.5
Applied rewrites49.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64100.0
Applied rewrites100.0%
if -5.39999999999999977e-18 < m < 4.4e-17Initial program 93.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6493.0
Applied rewrites93.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.44) (/ (* (/ 99.0 (* k k)) a) (* k k)) (if (<= m 0.48) (/ a (fma (- k -10.0) k 1.0)) (* (* (* k a) k) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.44) {
tmp = ((99.0 / (k * k)) * a) / (k * k);
} else if (m <= 0.48) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.44) tmp = Float64(Float64(Float64(99.0 / Float64(k * k)) * a) / Float64(k * k)); elseif (m <= 0.48) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.44], N[(N[(N[(99.0 / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.48], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.44:\\
\;\;\;\;\frac{\frac{99}{k \cdot k} \cdot a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.48:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -0.440000000000000002Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6435.9
Applied rewrites35.9%
Taylor expanded in k around -inf
Applied rewrites63.4%
Taylor expanded in a around 0
Applied rewrites63.4%
Taylor expanded in k around 0
Applied rewrites74.6%
if -0.440000000000000002 < m < 0.47999999999999998Initial program 93.3%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6492.2
Applied rewrites92.2%
if 0.47999999999999998 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m) :precision binary64 (if (<= m -0.44) (/ (* (/ a k) -10.0) (* (- k) k)) (if (<= m 0.48) (/ a (fma (- k -10.0) k 1.0)) (* (* (* k a) k) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.44) {
tmp = ((a / k) * -10.0) / (-k * k);
} else if (m <= 0.48) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.44) tmp = Float64(Float64(Float64(a / k) * -10.0) / Float64(Float64(-k) * k)); elseif (m <= 0.48) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.44], N[(N[(N[(a / k), $MachinePrecision] * -10.0), $MachinePrecision] / N[((-k) * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.48], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.44:\\
\;\;\;\;\frac{\frac{a}{k} \cdot -10}{\left(-k\right) \cdot k}\\
\mathbf{elif}\;m \leq 0.48:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -0.440000000000000002Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6435.9
Applied rewrites35.9%
Taylor expanded in k around inf
Applied rewrites45.0%
Applied rewrites52.1%
Taylor expanded in k around 0
Applied rewrites59.4%
if -0.440000000000000002 < m < 0.47999999999999998Initial program 93.3%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6492.2
Applied rewrites92.2%
if 0.47999999999999998 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= m -1.7e-178)
t_0
(if (<= m 4.4e-78)
(* (fma -10.0 k 1.0) a)
(if (<= m 4.4e-17) t_0 (* (* (* k a) k) 99.0))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -1.7e-178) {
tmp = t_0;
} else if (m <= 4.4e-78) {
tmp = fma(-10.0, k, 1.0) * a;
} else if (m <= 4.4e-17) {
tmp = t_0;
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (m <= -1.7e-178) tmp = t_0; elseif (m <= 4.4e-78) tmp = Float64(fma(-10.0, k, 1.0) * a); elseif (m <= 4.4e-17) tmp = t_0; else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -1.7e-178], t$95$0, If[LessEqual[m, 4.4e-78], N[(N[(-10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 4.4e-17], t$95$0, N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;m \leq -1.7 \cdot 10^{-178}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 4.4 \cdot 10^{-78}:\\
\;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\
\mathbf{elif}\;m \leq 4.4 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -1.69999999999999986e-178 or 4.3999999999999998e-78 < m < 4.4e-17Initial program 99.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6451.5
Applied rewrites51.5%
Taylor expanded in k around inf
Applied rewrites58.7%
if -1.69999999999999986e-178 < m < 4.3999999999999998e-78Initial program 90.6%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6490.6
Applied rewrites90.6%
Taylor expanded in k around 0
Applied rewrites63.7%
Taylor expanded in k around 0
Applied rewrites63.7%
if 4.4e-17 < m Initial program 74.4%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f644.3
Applied rewrites4.3%
Taylor expanded in k around 0
Applied rewrites8.5%
Taylor expanded in k around 0
Applied rewrites30.9%
Taylor expanded in k around inf
Applied rewrites53.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.44) (/ a (* k k)) (if (<= m 0.48) (/ a (fma (- k -10.0) k 1.0)) (* (* (* k a) k) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.44) {
tmp = a / (k * k);
} else if (m <= 0.48) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.44) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.48) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.44], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.48], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.44:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.48:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -0.440000000000000002Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6435.9
Applied rewrites35.9%
Taylor expanded in k around inf
Applied rewrites59.0%
if -0.440000000000000002 < m < 0.47999999999999998Initial program 93.3%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6492.2
Applied rewrites92.2%
if 0.47999999999999998 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m) :precision binary64 (if (<= m -0.00027) (/ a (* k k)) (if (<= m 0.48) (/ a (fma 10.0 k 1.0)) (* (* (* k a) k) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.00027) {
tmp = a / (k * k);
} else if (m <= 0.48) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.00027) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.48) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.00027], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.48], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00027:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.48:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -2.70000000000000003e-4Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6435.9
Applied rewrites35.9%
Taylor expanded in k around inf
Applied rewrites59.0%
if -2.70000000000000003e-4 < m < 0.47999999999999998Initial program 93.3%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6492.2
Applied rewrites92.2%
Taylor expanded in k around 0
Applied rewrites67.9%
if 0.47999999999999998 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m) :precision binary64 (if (<= m -1.7e-178) (/ a (* k k)) (if (<= m 0.26) (fma (* a (fma 99.0 k -10.0)) k a) (* (* (* k a) k) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e-178) {
tmp = a / (k * k);
} else if (m <= 0.26) {
tmp = fma((a * fma(99.0, k, -10.0)), k, a);
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.7e-178) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.26) tmp = fma(Float64(a * fma(99.0, k, -10.0)), k, a); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.7e-178], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.26], N[(N[(a * N[(99.0 * k + -10.0), $MachinePrecision]), $MachinePrecision] * k + a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{-178}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.26:\\
\;\;\;\;\mathsf{fma}\left(a \cdot \mathsf{fma}\left(99, k, -10\right), k, a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -1.69999999999999986e-178Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in k around inf
Applied rewrites57.7%
if -1.69999999999999986e-178 < m < 0.26000000000000001Initial program 90.7%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
Applied rewrites56.7%
Taylor expanded in k around 0
Applied rewrites57.1%
Applied rewrites57.1%
if 0.26000000000000001 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m)
:precision binary64
(if (<= m -1.7e-178)
(/ a (* k k))
(if (<= m 0.26)
(* (fma (fma 99.0 k -10.0) k 1.0) a)
(* (* (* k a) k) 99.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e-178) {
tmp = a / (k * k);
} else if (m <= 0.26) {
tmp = fma(fma(99.0, k, -10.0), k, 1.0) * a;
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.7e-178) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.26) tmp = Float64(fma(fma(99.0, k, -10.0), k, 1.0) * a); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.7e-178], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.26], N[(N[(N[(99.0 * k + -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{-178}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.26:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(99, k, -10\right), k, 1\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < -1.69999999999999986e-178Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6448.0
Applied rewrites48.0%
Taylor expanded in k around inf
Applied rewrites57.7%
if -1.69999999999999986e-178 < m < 0.26000000000000001Initial program 90.7%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6490.5
Applied rewrites90.5%
Taylor expanded in k around 0
Applied rewrites56.7%
Taylor expanded in k around 0
Applied rewrites57.1%
Taylor expanded in a around 0
Applied rewrites57.1%
if 0.26000000000000001 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m) :precision binary64 (if (<= m 0.26) (/ a 1.0) (* (* (* k a) k) 99.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.26) {
tmp = a / 1.0;
} else {
tmp = ((k * a) * k) * 99.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 (m <= 0.26d0) then
tmp = a / 1.0d0
else
tmp = ((k * a) * k) * 99.0d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.26) {
tmp = a / 1.0;
} else {
tmp = ((k * a) * k) * 99.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.26: tmp = a / 1.0 else: tmp = ((k * a) * k) * 99.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.26) tmp = Float64(a / 1.0); else tmp = Float64(Float64(Float64(k * a) * k) * 99.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.26) tmp = a / 1.0; else tmp = ((k * a) * k) * 99.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.26], N[(a / 1.0), $MachinePrecision], N[(N[(N[(k * a), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.26:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(k \cdot a\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < 0.26000000000000001Initial program 96.8%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in k around 0
Applied rewrites42.0%
Taylor expanded in k around 0
Applied rewrites27.6%
if 0.26000000000000001 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around 0
Applied rewrites30.3%
Taylor expanded in k around inf
Applied rewrites54.5%
(FPCore (a k m) :precision binary64 (if (<= m 5.5e+15) (/ a 1.0) (* (* -10.0 a) k)))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.5e+15) {
tmp = a / 1.0;
} else {
tmp = (-10.0 * a) * 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 <= 5.5d+15) then
tmp = a / 1.0d0
else
tmp = ((-10.0d0) * a) * k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 5.5e+15) {
tmp = a / 1.0;
} else {
tmp = (-10.0 * a) * k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.5e+15: tmp = a / 1.0 else: tmp = (-10.0 * a) * k return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.5e+15) tmp = Float64(a / 1.0); else tmp = Float64(Float64(-10.0 * a) * k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.5e+15) tmp = a / 1.0; else tmp = (-10.0 * a) * k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.5e+15], N[(a / 1.0), $MachinePrecision], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\end{array}
\end{array}
if m < 5.5e15Initial program 95.7%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6461.8
Applied rewrites61.8%
Taylor expanded in k around 0
Applied rewrites41.5%
Taylor expanded in k around 0
Applied rewrites27.3%
if 5.5e15 < m Initial program 75.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.4
Applied rewrites3.4%
Taylor expanded in k around 0
Applied rewrites7.7%
Taylor expanded in k around inf
Applied rewrites21.3%
Applied rewrites21.3%
(FPCore (a k m) :precision binary64 (if (<= m 0.26) (fma (* k a) -10.0 a) (* (* -10.0 a) k)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.26) {
tmp = fma((k * a), -10.0, a);
} else {
tmp = (-10.0 * a) * k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 0.26) tmp = fma(Float64(k * a), -10.0, a); else tmp = Float64(Float64(-10.0 * a) * k); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 0.26], N[(N[(k * a), $MachinePrecision] * -10.0 + a), $MachinePrecision], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.26:\\
\;\;\;\;\mathsf{fma}\left(k \cdot a, -10, a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\end{array}
\end{array}
if m < 0.26000000000000001Initial program 96.8%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in k around 0
Applied rewrites27.1%
if 0.26000000000000001 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around inf
Applied rewrites20.8%
Applied rewrites20.8%
(FPCore (a k m) :precision binary64 (if (<= m 0.26) (* (fma -10.0 k 1.0) a) (* (* -10.0 a) k)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.26) {
tmp = fma(-10.0, k, 1.0) * a;
} else {
tmp = (-10.0 * a) * k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 0.26) tmp = Float64(fma(-10.0, k, 1.0) * a); else tmp = Float64(Float64(-10.0 * a) * k); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 0.26], N[(N[(-10.0 * k + 1.0), $MachinePrecision] * a), $MachinePrecision], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.26:\\
\;\;\;\;\mathsf{fma}\left(-10, k, 1\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\end{array}
\end{array}
if m < 0.26000000000000001Initial program 96.8%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in k around 0
Applied rewrites27.1%
Taylor expanded in k around 0
Applied rewrites27.1%
if 0.26000000000000001 < m Initial program 74.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f643.3
Applied rewrites3.3%
Taylor expanded in k around 0
Applied rewrites7.6%
Taylor expanded in k around inf
Applied rewrites20.8%
Applied rewrites20.8%
(FPCore (a k m) :precision binary64 (* (* -10.0 a) k))
double code(double a, double k, double m) {
return (-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 = ((-10.0d0) * a) * k
end function
public static double code(double a, double k, double m) {
return (-10.0 * a) * k;
}
def code(a, k, m): return (-10.0 * a) * k
function code(a, k, m) return Float64(Float64(-10.0 * a) * k) end
function tmp = code(a, k, m) tmp = (-10.0 * a) * k; end
code[a_, k_, m_] := N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]
\begin{array}{l}
\\
\left(-10 \cdot a\right) \cdot k
\end{array}
Initial program 88.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6441.9
Applied rewrites41.9%
Taylor expanded in k around 0
Applied rewrites20.3%
Taylor expanded in k around inf
Applied rewrites8.8%
Applied rewrites8.8%
herbie shell --seed 2025017
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))