(FPCore (a k m)
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
↓
(FPCore (a k m)
:precision binary64
(if (<= k 4.1e+169)
(/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k)))
(if (<= k 2.9e+259) (/ (/ (/ a k) (sqrt k)) (sqrt k)) (/ a (* k k)))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
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
↓
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 4.1d+169) then
tmp = (a * (k ** m)) / ((1.0d0 + (k * 10.0d0)) + (k * k))
else if (k <= 2.9d+259) then
tmp = ((a / k) / sqrt(k)) / sqrt(k)
else
tmp = a / (k * k)
end if
code = tmp
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));
}
↓
public static double code(double a, double k, double m) {
double tmp;
if (k <= 4.1e+169) {
tmp = (a * Math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
} else if (k <= 2.9e+259) {
tmp = ((a / k) / Math.sqrt(k)) / Math.sqrt(k);
} else {
tmp = a / (k * k);
}
return tmp;
}
\[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)}}
\]
Proof
(*.f64 a (/.f64 (pow.f64 k m) (fma.f64 k (+.f64 k 10) 1))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (fma.f64 k (Rewrite<= +-commutative_binary64 (+.f64 10 k)) 1))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 k (+.f64 10 k)) 1)))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (+.f64 (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 10 k) (*.f64 k k))) 1))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (Rewrite<= +-commutative_binary64 (+.f64 1 (+.f64 (*.f64 10 k) (*.f64 k k)))))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))))): 1 points increase in error, 0 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))): 1 points increase in error, 5 points decrease in error
Taylor expanded in m around 0 12.9
\[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(k + 10\right)}}
\]
Taylor expanded in k around inf 12.9
\[\leadsto \color{blue}{\frac{a}{{k}^{2}}}
\]
Simplified6.4
\[\leadsto \color{blue}{\frac{\frac{a}{k}}{k}}
\]
Proof
(/.f64 (/.f64 a k) k): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-/r*_binary64 (/.f64 a (*.f64 k k))): 34 points increase in error, 28 points decrease in error
(/.f64 a (Rewrite<= unpow2_binary64 (pow.f64 k 2))): 0 points increase in error, 0 points decrease in error
\[\leadsto \color{blue}{a \cdot \frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)}}
\]
Proof
(*.f64 a (/.f64 (pow.f64 k m) (fma.f64 k (+.f64 k 10) 1))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (fma.f64 k (Rewrite<= +-commutative_binary64 (+.f64 10 k)) 1))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 k (+.f64 10 k)) 1)))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (+.f64 (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 10 k) (*.f64 k k))) 1))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (Rewrite<= +-commutative_binary64 (+.f64 1 (+.f64 (*.f64 10 k) (*.f64 k k)))))): 0 points increase in error, 0 points decrease in error
(*.f64 a (/.f64 (pow.f64 k m) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))))): 1 points increase in error, 0 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))): 1 points increase in error, 5 points decrease in error
Taylor expanded in m around 0 3.4
\[\leadsto \color{blue}{\frac{a}{1 + k \cdot \left(k + 10\right)}}
\]
Taylor expanded in k around inf 3.4
\[\leadsto \color{blue}{\frac{a}{{k}^{2}}}
\]
Simplified1.7
\[\leadsto \color{blue}{\frac{\frac{a}{k}}{k}}
\]
Proof
(/.f64 (/.f64 a k) k): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-/r*_binary64 (/.f64 a (*.f64 k k))): 34 points increase in error, 28 points decrease in error
(/.f64 a (Rewrite<= unpow2_binary64 (pow.f64 k 2))): 0 points increase in error, 0 points decrease in error
Taylor expanded in a around 0 3.4
\[\leadsto \color{blue}{\frac{a}{{k}^{2}}}
\]
Simplified3.4
\[\leadsto \color{blue}{\frac{a}{k \cdot k}}
\]
Proof
(/.f64 a (*.f64 k k)): 0 points increase in error, 0 points decrease in error
(/.f64 a (Rewrite<= unpow2_binary64 (pow.f64 k 2))): 0 points increase in error, 0 points decrease in error
herbie shell --seed 2022308
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))