(FPCore (a k m)
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
↓
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k)))))
(if (<= t_1 -5e-303) t_1 (if (<= t_1 0.0) (/ 1.0 (* k (/ k t_0))) t_1))))
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= (-5d-303)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = 1.0d0 / (k * (k / t_0))
else
tmp = t_1
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));
}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < -4.9999999999999998e-303 or -0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))
\[\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))))): 0 points increase in error, 1 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k)))): 3 points increase in error, 7 points decrease in error
Applied egg-rr3.3
\[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(k, k + 10, 1\right)}{a \cdot {k}^{m}}}}
\]
herbie shell --seed 2022295
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))