Average Error: 31.8 → 0.7
Time: 3.9s
Precision: binary64
\[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
\[\log 2 + \log x \]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log 2 + \log x
(FPCore (x) :precision binary64 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x) :precision binary64 (+ (log 2.0) (log x)))
double code(double x) {
	return log(x + sqrt((x * x) - 1.0));
}
double code(double x) {
	return log(2.0) + log(x);
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.8

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Simplified31.8

    \[\leadsto \color{blue}{\log \left(x + \sqrt{\mathsf{fma}\left(x, x, -1\right)}\right)} \]
  3. Taylor expanded in x around inf 0.7

    \[\leadsto \color{blue}{\log 2 - \log \left(\frac{1}{x}\right)} \]
  4. Simplified0.7

    \[\leadsto \color{blue}{\log 2 + \log x} \]
  5. Final simplification0.7

    \[\leadsto \log 2 + \log x \]

Reproduce

herbie shell --seed 2022068 
(FPCore (x)
  :name "Hyperbolic arc-cosine"
  :precision binary64
  (log (+ x (sqrt (- (* x x) 1.0)))))