
(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]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
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]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
(FPCore (a k m)
:precision binary64
(let* ((t_0 (exp (* -1.0 (* m (log k))))) (t_1 (/ t_0 a)))
(if (<= k 1e-41)
(* (pow k m) a)
(/ 1.0 (fma k (fma 10.0 t_1 (/ (* k t_0) a)) t_1)))))double code(double a, double k, double m) {
double t_0 = exp((-1.0 * (m * log(k))));
double t_1 = t_0 / a;
double tmp;
if (k <= 1e-41) {
tmp = pow(k, m) * a;
} else {
tmp = 1.0 / fma(k, fma(10.0, t_1, ((k * t_0) / a)), t_1);
}
return tmp;
}
function code(a, k, m) t_0 = exp(Float64(-1.0 * Float64(m * log(k)))) t_1 = Float64(t_0 / a) tmp = 0.0 if (k <= 1e-41) tmp = Float64((k ^ m) * a); else tmp = Float64(1.0 / fma(k, fma(10.0, t_1, Float64(Float64(k * t_0) / a)), t_1)); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Exp[N[(-1.0 * N[(m * N[Log[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / a), $MachinePrecision]}, If[LessEqual[k, 1e-41], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(1.0 / N[(k * N[(10.0 * t$95$1 + N[(N[(k * t$95$0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := e^{-1 \cdot \left(m \cdot \log k\right)}\\
t_1 := \frac{t\_0}{a}\\
\mathbf{if}\;k \leq 10^{-41}:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(k, \mathsf{fma}\left(10, t\_1, \frac{k \cdot t\_0}{a}\right), t\_1\right)}\\
\end{array}
if k < 1.00000000000000001e-41Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-pow.f6482.4%
Applied rewrites82.4%
if 1.00000000000000001e-41 < k Initial program 90.4%
Taylor expanded in k around 0
Applied rewrites82.4%
lift-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
div-flip-revN/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6482.3%
Applied rewrites82.3%
Taylor expanded in k around 0
lower-fma.f64N/A
Applied rewrites71.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ 1.0 (fabs a))))
(*
(copysign 1.0 a)
(if (<= (/ (* (fabs a) (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 4e+233)
(/ (pow k m) (fma k (fma 10.0 t_0 (/ k (fabs a))) t_0))
(* (pow k m) (fabs a))))))double code(double a, double k, double m) {
double t_0 = 1.0 / fabs(a);
double tmp;
if (((fabs(a) * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 4e+233) {
tmp = pow(k, m) / fma(k, fma(10.0, t_0, (k / fabs(a))), t_0);
} else {
tmp = pow(k, m) * fabs(a);
}
return copysign(1.0, a) * tmp;
}
function code(a, k, m) t_0 = Float64(1.0 / abs(a)) tmp = 0.0 if (Float64(Float64(abs(a) * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 4e+233) tmp = Float64((k ^ m) / fma(k, fma(10.0, t_0, Float64(k / abs(a))), t_0)); else tmp = Float64((k ^ m) * abs(a)); end return Float64(copysign(1.0, a) * tmp) end
code[a_, k_, m_] := Block[{t$95$0 = N[(1.0 / N[Abs[a], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[a], $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+233], N[(N[Power[k, m], $MachinePrecision] / N[(k * N[(10.0 * t$95$0 + N[(k / N[Abs[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{1}{\left|a\right|}\\
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|a\right| \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k, \mathsf{fma}\left(10, t\_0, \frac{k}{\left|a\right|}\right), t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot \left|a\right|\\
\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))) < 3.99999999999999989e233Initial program 90.4%
Taylor expanded in k around 0
Applied rewrites82.4%
lift-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
div-flip-revN/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6482.3%
Applied rewrites82.3%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l*N/A
associate-/r*N/A
lift-pow.f64N/A
pow-flipN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
lift-/.f64N/A
Applied rewrites82.3%
Taylor expanded in k around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6491.8%
Applied rewrites91.8%
if 3.99999999999999989e233 < (/.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.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-pow.f6482.4%
Applied rewrites82.4%
(FPCore (a k m)
:precision binary64
(if (<= m -1.85e-6)
(/ 1.0 (* (/ (pow k (- m)) a) 1.0))
(if (<= m 0.41)
(/ (* (+ 1.0 (* m (log k))) a) (fma (- k -10.0) k 1.0))
(* (pow k m) a))))double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e-6) {
tmp = 1.0 / ((pow(k, -m) / a) * 1.0);
} else if (m <= 0.41) {
tmp = ((1.0 + (m * log(k))) * a) / fma((k - -10.0), k, 1.0);
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.85e-6) tmp = Float64(1.0 / Float64(Float64((k ^ Float64(-m)) / a) * 1.0)); elseif (m <= 0.41) tmp = Float64(Float64(Float64(1.0 + Float64(m * log(k))) * a) / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.85e-6], N[(1.0 / N[(N[(N[Power[k, (-m)], $MachinePrecision] / a), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.41], N[(N[(N[(1.0 + N[(m * N[Log[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;m \leq -1.85 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\frac{{k}^{\left(-m\right)}}{a} \cdot 1}\\
\mathbf{elif}\;m \leq 0.41:\\
\;\;\;\;\frac{\left(1 + m \cdot \log k\right) \cdot a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
if m < -1.8500000000000001e-6Initial program 90.4%
Taylor expanded in k around 0
Applied rewrites82.4%
lift-/.f64N/A
*-rgt-identityN/A
metadata-evalN/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
div-flip-revN/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6482.3%
Applied rewrites82.3%
if -1.8500000000000001e-6 < m < 0.409999999999999976Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6441.5%
Applied rewrites41.5%
if 0.409999999999999976 < m Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-pow.f6482.4%
Applied rewrites82.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -1.85e-6)
t_0
(if (<= m 0.41)
(/ (* (+ 1.0 (* m (log k))) a) (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 <= -1.85e-6) {
tmp = t_0;
} else if (m <= 0.41) {
tmp = ((1.0 + (m * log(k))) * a) / 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 <= -1.85e-6) tmp = t_0; elseif (m <= 0.41) tmp = Float64(Float64(Float64(1.0 + Float64(m * log(k))) * a) / 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, -1.85e-6], t$95$0, If[LessEqual[m, 0.41], N[(N[(N[(1.0 + N[(m * N[Log[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -1.85 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 0.41:\\
\;\;\;\;\frac{\left(1 + m \cdot \log k\right) \cdot a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if m < -1.8500000000000001e-6 or 0.409999999999999976 < m Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-pow.f6482.4%
Applied rewrites82.4%
if -1.8500000000000001e-6 < m < 0.409999999999999976Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-+.f64N/A
lower-*.f64N/A
lower-log.f6441.5%
Applied rewrites41.5%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) INFINITY) (/ (* (pow k m) a) (fma (- k -10.0) k 1.0)) (* (+ 1.0 (* k (- (* 99.0 k) 10.0))) a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= ((double) INFINITY)) {
tmp = (pow(k, m) * a) / fma((k - -10.0), k, 1.0);
} else {
tmp = (1.0 + (k * ((99.0 * k) - 10.0))) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= Inf) tmp = Float64(Float64((k ^ m) * a) / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(Float64(1.0 + Float64(k * Float64(Float64(99.0 * k) - 10.0))) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq \infty:\\
\;\;\;\;\frac{{k}^{m} \cdot a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot a\\
\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))) < +inf.0Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
if +inf.0 < (/.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.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.5%
Applied rewrites29.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.36) (* (/ (pow k m) (fma (- k -10.0) k 1.0)) a) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.36) {
tmp = (pow(k, m) / fma((k - -10.0), k, 1.0)) * a;
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 1.36) tmp = Float64(Float64((k ^ m) / fma(Float64(k - -10.0), k, 1.0)) * a); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 1.36], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;m \leq 1.36:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k - -10, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
if m < 1.3600000000000001Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
if 1.3600000000000001 < m Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-pow.f6482.4%
Applied rewrites82.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -1.85e-6)
t_0
(if (<= m 53.0) (/ a (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 <= -1.85e-6) {
tmp = t_0;
} else if (m <= 53.0) {
tmp = a / 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 <= -1.85e-6) tmp = t_0; elseif (m <= 53.0) tmp = Float64(a / 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, -1.85e-6], t$95$0, If[LessEqual[m, 53.0], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -1.85 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 53:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if m < -1.8500000000000001e-6 or 53 < m Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-pow.f6482.4%
Applied rewrites82.4%
if -1.8500000000000001e-6 < m < 53Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
sub-negate-revN/A
sub-flipN/A
metadata-evalN/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6445.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lower--.f6445.9%
Applied rewrites45.9%
(FPCore (a k m)
:precision binary64
(*
(copysign 1.0 a)
(if (<= (/ (* (fabs a) (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 4e+233)
(/ (fabs a) (fma (- k -10.0) k 1.0))
(* (+ 1.0 (* k (- (* 99.0 k) 10.0))) (fabs a)))))double code(double a, double k, double m) {
double tmp;
if (((fabs(a) * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 4e+233) {
tmp = fabs(a) / fma((k - -10.0), k, 1.0);
} else {
tmp = (1.0 + (k * ((99.0 * k) - 10.0))) * fabs(a);
}
return copysign(1.0, a) * tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(abs(a) * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 4e+233) tmp = Float64(abs(a) / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(Float64(1.0 + Float64(k * Float64(Float64(99.0 * k) - 10.0))) * abs(a)); end return Float64(copysign(1.0, a) * tmp) end
code[a_, k_, m_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[a], $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+233], N[(N[Abs[a], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(k * N[(N[(99.0 * k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[a], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|a\right| \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\frac{\left|a\right|}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + k \cdot \left(99 \cdot k - 10\right)\right) \cdot \left|a\right|\\
\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))) < 3.99999999999999989e233Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
sub-negate-revN/A
sub-flipN/A
metadata-evalN/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6445.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lower--.f6445.9%
Applied rewrites45.9%
if 3.99999999999999989e233 < (/.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.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6429.5%
Applied rewrites29.5%
(FPCore (a k m)
:precision binary64
(*
(copysign 1.0 a)
(if (<= (/ (* (fabs a) (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 5e+303)
(/ (fabs a) (fma (- k -10.0) k 1.0))
(* k (fma -10.0 (fabs a) (/ (fabs a) k))))))double code(double a, double k, double m) {
double tmp;
if (((fabs(a) * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 5e+303) {
tmp = fabs(a) / fma((k - -10.0), k, 1.0);
} else {
tmp = k * fma(-10.0, fabs(a), (fabs(a) / k));
}
return copysign(1.0, a) * tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(abs(a) * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 5e+303) tmp = Float64(abs(a) / fma(Float64(k - -10.0), k, 1.0)); else tmp = Float64(k * fma(-10.0, abs(a), Float64(abs(a) / k))); end return Float64(copysign(1.0, a) * tmp) end
code[a_, k_, m_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[a], $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+303], N[(N[Abs[a], $MachinePrecision] / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(k * N[(-10.0 * N[Abs[a], $MachinePrecision] + N[(N[Abs[a], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, a\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|a\right| \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 5 \cdot 10^{+303}:\\
\;\;\;\;\frac{\left|a\right|}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \mathsf{fma}\left(-10, \left|a\right|, \frac{\left|a\right|}{k}\right)\\
\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))) < 4.9999999999999997e303Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
sub-negate-revN/A
sub-flipN/A
metadata-evalN/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6445.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lower--.f6445.9%
Applied rewrites45.9%
if 4.9999999999999997e303 < (/.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.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.5%
Applied rewrites21.5%
Taylor expanded in k around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f6420.1%
Applied rewrites20.1%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) INFINITY) (/ a (fma (- k -10.0) k 1.0)) (fma (* -10.0 k) a a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= ((double) INFINITY)) {
tmp = a / fma((k - -10.0), k, 1.0);
} else {
tmp = fma((-10.0 * k), a, a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= Inf) tmp = Float64(a / fma(Float64(k - -10.0), k, 1.0)); else tmp = fma(Float64(-10.0 * k), a, a); end return tmp end
code[a_, k_, m_] := If[LessEqual[N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(a / N[(N[(k - -10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(-10.0 * k), $MachinePrecision] * a + a), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq \infty:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k - -10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-10 \cdot k, a, a\right)\\
\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))) < +inf.0Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
*-commutativeN/A
+-commutativeN/A
*-commutativeN/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
sub-negate-revN/A
sub-flipN/A
metadata-evalN/A
+-commutativeN/A
lift-+.f64N/A
*-commutativeN/A
lower-fma.f6445.9%
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lower--.f6445.9%
Applied rewrites45.9%
if +inf.0 < (/.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.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.5%
Applied rewrites21.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
lower-*.f6421.5%
Applied rewrites21.5%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) INFINITY) (/ a (+ 1.0 (* k 10.0))) (fma (* -10.0 k) a a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= ((double) INFINITY)) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = fma((-10.0 * k), a, a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= Inf) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = fma(Float64(-10.0 * k), a, a); end return tmp end
code[a_, k_, m_] := If[LessEqual[N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-10.0 * k), $MachinePrecision] * a + a), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq \infty:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-10 \cdot k, a, a\right)\\
\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))) < +inf.0Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
Applied rewrites29.1%
if +inf.0 < (/.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.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.5%
Applied rewrites21.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
lower-*.f6421.5%
Applied rewrites21.5%
(FPCore (a k m) :precision binary64 (fma (* -10.0 k) a a))
double code(double a, double k, double m) {
return fma((-10.0 * k), a, a);
}
function code(a, k, m) return fma(Float64(-10.0 * k), a, a) end
code[a_, k_, m_] := N[(N[(-10.0 * k), $MachinePrecision] * a + a), $MachinePrecision]
\mathsf{fma}\left(-10 \cdot k, a, a\right)
Initial program 90.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.4%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
metadata-evalN/A
associate-+r+N/A
+-commutativeN/A
+-lft-identityN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval90.5%
Applied rewrites90.5%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6421.5%
Applied rewrites21.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-outN/A
lower-fma.f64N/A
distribute-lft-neg-outN/A
metadata-evalN/A
lower-*.f6421.5%
Applied rewrites21.5%
(FPCore (a k m) :precision binary64 (* 1.0 a))
double code(double a, double k, double m) {
return 1.0 * a;
}
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 = 1.0d0 * a
end function
public static double code(double a, double k, double m) {
return 1.0 * a;
}
def code(a, k, m): return 1.0 * a
function code(a, k, m) return Float64(1.0 * a) end
function tmp = code(a, k, m) tmp = 1.0 * a; end
code[a_, k_, m_] := N[(1.0 * a), $MachinePrecision]
1 \cdot a
Initial program 90.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.4%
Taylor expanded in m around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f6445.9%
Applied rewrites45.9%
Taylor expanded in k around 0
Applied rewrites29.1%
Taylor expanded in k around 0
Applied rewrites20.7%
herbie shell --seed 2025179
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))