Average Error: 0.0 → 0.0
Time: 1.5s
Precision: binary64
\[-\log \left(\frac{1}{x} - 1\right) \]
\[-\log \left(\mathsf{fma}\left({x}^{-0.5}, \sqrt{\frac{1}{x}}, -1\right)\right) \]
-\log \left(\frac{1}{x} - 1\right)
-\log \left(\mathsf{fma}\left({x}^{-0.5}, \sqrt{\frac{1}{x}}, -1\right)\right)
(FPCore (x) :precision binary64 (- (log (- (/ 1.0 x) 1.0))))
(FPCore (x)
 :precision binary64
 (- (log (fma (pow x -0.5) (sqrt (/ 1.0 x)) -1.0))))
double code(double x) {
	return -log((1.0 / x) - 1.0);
}
double code(double x) {
	return -log(fma(pow(x, -0.5), sqrt(1.0 / x), -1.0));
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[-\log \left(\frac{1}{x} - 1\right) \]
  2. Applied add-sqr-sqrt_binary640.0

    \[\leadsto -\log \left(\color{blue}{\sqrt{\frac{1}{x}} \cdot \sqrt{\frac{1}{x}}} - 1\right) \]
  3. Applied fma-neg_binary640.0

    \[\leadsto -\log \color{blue}{\left(\mathsf{fma}\left(\sqrt{\frac{1}{x}}, \sqrt{\frac{1}{x}}, -1\right)\right)} \]
  4. Simplified0.0

    \[\leadsto -\log \left(\mathsf{fma}\left(\sqrt{\frac{1}{x}}, \sqrt{\frac{1}{x}}, \color{blue}{-1}\right)\right) \]
  5. Applied inv-pow_binary640.0

    \[\leadsto -\log \left(\mathsf{fma}\left(\sqrt{\color{blue}{{x}^{-1}}}, \sqrt{\frac{1}{x}}, -1\right)\right) \]
  6. Applied sqrt-pow1_binary640.0

    \[\leadsto -\log \left(\mathsf{fma}\left(\color{blue}{{x}^{\left(\frac{-1}{2}\right)}}, \sqrt{\frac{1}{x}}, -1\right)\right) \]
  7. Simplified0.0

    \[\leadsto -\log \left(\mathsf{fma}\left({x}^{\color{blue}{-0.5}}, \sqrt{\frac{1}{x}}, -1\right)\right) \]
  8. Final simplification0.0

    \[\leadsto -\log \left(\mathsf{fma}\left({x}^{-0.5}, \sqrt{\frac{1}{x}}, -1\right)\right) \]

Reproduce

herbie shell --seed 2022077 
(FPCore (x)
  :name "neg log"
  :precision binary64
  (- (log (- (/ 1.0 x) 1.0))))