
(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 13 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 (<= k 5e-25)
t_0
(/ 1.0 (fma (+ (/ 10.0 t_0) (/ k t_0)) k (/ 1.0 t_0))))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (k <= 5e-25) {
tmp = t_0;
} else {
tmp = 1.0 / fma(((10.0 / t_0) + (k / t_0)), k, (1.0 / t_0));
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (k <= 5e-25) tmp = t_0; else tmp = Float64(1.0 / fma(Float64(Float64(10.0 / t_0) + Float64(k / t_0)), k, Float64(1.0 / t_0))); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[k, 5e-25], t$95$0, N[(1.0 / N[(N[(N[(10.0 / t$95$0), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision] * k + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 5 \cdot 10^{-25}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{10}{t\_0} + \frac{k}{t\_0}, k, \frac{1}{t\_0}\right)}\\
\end{array}
\end{array}
if k < 4.99999999999999962e-25Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lift-pow.f6482.9
Applied rewrites82.9%
if 4.99999999999999962e-25 < k Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-pow.f64N/A
Applied rewrites82.6%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= k 1.5e-41)
t_0
(/ 1.0 (fma (/ (- k -10.0) t_0) k (/ (pow k (- m)) a))))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (k <= 1.5e-41) {
tmp = t_0;
} else {
tmp = 1.0 / fma(((k - -10.0) / t_0), k, (pow(k, -m) / a));
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (k <= 1.5e-41) tmp = t_0; else tmp = Float64(1.0 / fma(Float64(Float64(k - -10.0) / t_0), k, Float64((k ^ Float64(-m)) / a))); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[k, 1.5e-41], t$95$0, N[(1.0 / N[(N[(N[(k - -10.0), $MachinePrecision] / t$95$0), $MachinePrecision] * k + N[(N[Power[k, (-m)], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 1.5 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{k - -10}{t\_0}, k, \frac{{k}^{\left(-m\right)}}{a}\right)}\\
\end{array}
\end{array}
if k < 1.49999999999999994e-41Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lift-pow.f6482.9
Applied rewrites82.9%
if 1.49999999999999994e-41 < k Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.6%
Applied rewrites88.4%
(FPCore (a k m)
:precision binary64
(if (<= m -7.4e-9)
(/ 1.0 (/ (pow k (- m)) a))
(if (<= m 0.008)
(/ 1.0 (fma k (/ (- k -10.0) a) (/ 1.0 a)))
(* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -7.4e-9) {
tmp = 1.0 / (pow(k, -m) / a);
} else if (m <= 0.008) {
tmp = 1.0 / fma(k, ((k - -10.0) / a), (1.0 / a));
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -7.4e-9) tmp = Float64(1.0 / Float64((k ^ Float64(-m)) / a)); elseif (m <= 0.008) tmp = Float64(1.0 / fma(k, Float64(Float64(k - -10.0) / a), Float64(1.0 / a))); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -7.4e-9], N[(1.0 / N[(N[Power[k, (-m)], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.008], N[(1.0 / N[(k * N[(N[(k - -10.0), $MachinePrecision] / a), $MachinePrecision] + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\frac{{k}^{\left(-m\right)}}{a}}\\
\mathbf{elif}\;m \leq 0.008:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(k, \frac{k - -10}{a}, \frac{1}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -7.4e-9Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
pow-flipN/A
lower-pow.f64N/A
lower-neg.f6482.8
Applied rewrites82.8%
if -7.4e-9 < m < 0.0080000000000000002Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6444.7
Applied rewrites44.7%
if 0.0080000000000000002 < m Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lift-pow.f6482.9
Applied rewrites82.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -7.4e-9)
t_0
(if (<= m 0.008) (/ 1.0 (fma k (/ (- k -10.0) a) (/ 1.0 a))) t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -7.4e-9) {
tmp = t_0;
} else if (m <= 0.008) {
tmp = 1.0 / fma(k, ((k - -10.0) / a), (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 <= -7.4e-9) tmp = t_0; elseif (m <= 0.008) tmp = Float64(1.0 / fma(k, Float64(Float64(k - -10.0) / a), Float64(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, -7.4e-9], t$95$0, If[LessEqual[m, 0.008], N[(1.0 / N[(k * N[(N[(k - -10.0), $MachinePrecision] / a), $MachinePrecision] + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -7.4 \cdot 10^{-9}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 0.008:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(k, \frac{k - -10}{a}, \frac{1}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -7.4e-9 or 0.0080000000000000002 < m Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lift-pow.f6482.9
Applied rewrites82.9%
if -7.4e-9 < m < 0.0080000000000000002Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6444.7
Applied rewrites44.7%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= m 5.5) (/ t_0 (fma (- k -10.0) k 1.0)) t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= 5.5) {
tmp = t_0 / fma((k - -10.0), 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 <= 5.5) tmp = Float64(t_0 / fma(Float64(k - -10.0), 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, 5.5], N[(t$95$0 / N[(N[(k - -10.0), $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 5.5:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 5.5Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.6%
Taylor expanded in a around 0
lower-special-/N/A
associate-/l/N/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lower-special-/N/A
distribute-rgt-inN/A
pow2N/A
associate-+l+N/A
pow2N/A
division-flipN/A
lower-/.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-*.f64N/A
+-commutativeN/A
Applied rewrites90.5%
if 5.5 < m Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lift-pow.f6482.9
Applied rewrites82.9%
(FPCore (a k m)
:precision binary64
(if (<= m -0.054)
(/ a (* k k))
(if (<= m 1.9)
(/ 1.0 (fma k (/ (- k -10.0) a) (/ 1.0 a)))
(fma (- (- (* (* -99.0 a) k)) (* 10.0 a)) k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.054) {
tmp = a / (k * k);
} else if (m <= 1.9) {
tmp = 1.0 / fma(k, ((k - -10.0) / a), (1.0 / a));
} else {
tmp = fma((-((-99.0 * a) * k) - (10.0 * a)), k, a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.054) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.9) tmp = Float64(1.0 / fma(k, Float64(Float64(k - -10.0) / a), Float64(1.0 / a))); else tmp = fma(Float64(Float64(-Float64(Float64(-99.0 * a) * k)) - Float64(10.0 * a)), k, a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.054], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.9], N[(1.0 / N[(k * N[(N[(k - -10.0), $MachinePrecision] / a), $MachinePrecision] + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-N[(N[(-99.0 * a), $MachinePrecision] * k), $MachinePrecision]) - N[(10.0 * a), $MachinePrecision]), $MachinePrecision] * k + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.054:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.9:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(k, \frac{k - -10}{a}, \frac{1}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-\left(-99 \cdot a\right) \cdot k\right) - 10 \cdot a, k, a\right)\\
\end{array}
\end{array}
if m < -0.0539999999999999994Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
if -0.0539999999999999994 < m < 1.8999999999999999Initial program 90.5%
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
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
Applied rewrites90.3%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
associate-/r*N/A
lower-/.f64N/A
*-commutativeN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
lift-+.f64N/A
lift-pow.f6490.3
Applied rewrites90.3%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
+-commutativeN/A
lower-+.f6444.9
Applied rewrites44.9%
lift-/.f64N/A
lift-+.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
+-commutativeN/A
lower-/.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6444.7
Applied rewrites44.7%
if 1.8999999999999999 < m Initial program 90.5%
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.0
Applied rewrites45.0%
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
lower-*.f64N/A
metadata-evalN/A
lower-*.f6427.4
Applied rewrites27.4%
(FPCore (a k m)
:precision binary64
(if (<= m -0.054)
(/ a (* k k))
(if (<= m 1.9)
(/ a (fma (- k -10.0) k 1.0))
(fma (- (- (* (* -99.0 a) k)) (* 10.0 a)) k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.054) {
tmp = a / (k * k);
} else if (m <= 1.9) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = fma((-((-99.0 * a) * k) - (10.0 * a)), k, a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.054) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.9) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = fma(Float64(Float64(-Float64(Float64(-99.0 * a) * k)) - Float64(10.0 * a)), k, a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.054], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.9], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[((-N[(N[(-99.0 * a), $MachinePrecision] * k), $MachinePrecision]) - N[(10.0 * a), $MachinePrecision]), $MachinePrecision] * k + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.054:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.9:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-\left(-99 \cdot a\right) \cdot k\right) - 10 \cdot a, k, a\right)\\
\end{array}
\end{array}
if m < -0.0539999999999999994Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
if -0.0539999999999999994 < m < 1.8999999999999999Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
Taylor expanded in m around 0
pow2N/A
distribute-rgt-inN/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6445.0
Applied rewrites45.0%
if 1.8999999999999999 < m Initial program 90.5%
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.0
Applied rewrites45.0%
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
lower-*.f64N/A
metadata-evalN/A
lower-*.f6427.4
Applied rewrites27.4%
(FPCore (a k m)
:precision binary64
(if (<= m -0.054)
(/ a (* k k))
(if (<= m 2.9e+133)
(/ a (fma (- k -10.0) k 1.0))
(* (fma (log k) m 1.0) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.054) {
tmp = a / (k * k);
} else if (m <= 2.9e+133) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = fma(log(k), m, 1.0) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.054) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.9e+133) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(fma(log(k), m, 1.0) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.054], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.9e+133], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[k], $MachinePrecision] * m + 1.0), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.054:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.9 \cdot 10^{+133}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log k, m, 1\right) \cdot a\\
\end{array}
\end{array}
if m < -0.0539999999999999994Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
if -0.0539999999999999994 < m < 2.9000000000000001e133Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
Taylor expanded in m around 0
pow2N/A
distribute-rgt-inN/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6445.0
Applied rewrites45.0%
if 2.9000000000000001e133 < m Initial program 90.5%
Taylor expanded in m around 0
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
pow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6440.8
Applied rewrites40.8%
Taylor expanded in k around 0
*-commutativeN/A
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
lower-*.f64N/A
lift-log.f64N/A
lift-fma.f6423.4
Applied rewrites23.4%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 2e+307) (/ a (fma (- k -10.0) k 1.0)) (/ a (* k k))))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 2e+307) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = a / (k * k);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 2e+307) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(a / Float64(k * k)); end return tmp end
code[a_, k_, m_] := If[LessEqual[N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+307], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.99999999999999997e307Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
Taylor expanded in m around 0
pow2N/A
distribute-rgt-inN/A
lower-/.f64N/A
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
lift-fma.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f6445.0
Applied rewrites45.0%
if 1.99999999999999997e307 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ a (* k k)))) (if (<= k 2e-309) t_0 (if (<= k 10.0) (/ a (fma 10.0 k 1.0)) t_0))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 2e-309) {
tmp = t_0;
} else if (k <= 10.0) {
tmp = a / fma(10.0, k, 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 <= 2e-309) tmp = t_0; elseif (k <= 10.0) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2e-309], t$95$0, If[LessEqual[k, 10.0], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq 2 \cdot 10^{-309}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;k \leq 10:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if k < 1.9999999999999988e-309 or 10 < k Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
if 1.9999999999999988e-309 < k < 10Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around 0
Applied rewrites28.2%
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ a (* k k)))) (if (<= k 2e-309) t_0 (if (<= k 0.1) (fma (* a k) -10.0 a) t_0))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 2e-309) {
tmp = t_0;
} else if (k <= 0.1) {
tmp = fma((a * k), -10.0, a);
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= 2e-309) tmp = t_0; elseif (k <= 0.1) tmp = fma(Float64(a * k), -10.0, a); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2e-309], t$95$0, If[LessEqual[k, 0.1], N[(N[(a * k), $MachinePrecision] * -10.0 + a), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq 2 \cdot 10^{-309}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;\mathsf{fma}\left(a \cdot k, -10, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if k < 1.9999999999999988e-309 or 0.10000000000000001 < k Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
if 1.9999999999999988e-309 < k < 0.10000000000000001Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6420.9
Applied rewrites20.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ a (* k k)))) (if (<= k 2e-309) t_0 (if (<= k 1.6) (/ a 1.0) t_0))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 2e-309) {
tmp = t_0;
} else if (k <= 1.6) {
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 <= 2d-309) then
tmp = t_0
else if (k <= 1.6d0) 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 <= 2e-309) {
tmp = t_0;
} else if (k <= 1.6) {
tmp = a / 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= 2e-309: tmp = t_0 elif k <= 1.6: 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 <= 2e-309) tmp = t_0; elseif (k <= 1.6) 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 <= 2e-309) tmp = t_0; elseif (k <= 1.6) 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, 2e-309], t$95$0, If[LessEqual[k, 1.6], 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 2 \cdot 10^{-309}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;k \leq 1.6:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if k < 1.9999999999999988e-309 or 1.6000000000000001 < k Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around inf
lower-/.f64N/A
pow2N/A
lift-*.f6435.5
Applied rewrites35.5%
if 1.9999999999999988e-309 < k < 1.6000000000000001Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around 0
Applied rewrites20.0%
(FPCore (a k m) :precision binary64 (/ a 1.0))
double code(double a, double k, double m) {
return a / 1.0;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, k, m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a / 1.0d0
end function
public static double code(double a, double k, double m) {
return a / 1.0;
}
def code(a, k, m): return a / 1.0
function code(a, k, m) return Float64(a / 1.0) end
function tmp = code(a, k, m) tmp = a / 1.0; end
code[a_, k_, m_] := N[(a / 1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1}
\end{array}
Initial program 90.5%
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.0
Applied rewrites45.0%
Taylor expanded in k around 0
Applied rewrites20.0%
herbie shell --seed 2025132
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))