?

Average Accuracy: 50.2% → 100.0%
Time: 4.1s
Precision: binary64
Cost: 26048

?

\[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
\[\log \left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{x + -1}, x\right)\right) \]
(FPCore (x) :precision binary64 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x)
 :precision binary64
 (log (fma (sqrt (+ x 1.0)) (sqrt (+ x -1.0)) x)))
double code(double x) {
	return log((x + sqrt(((x * x) - 1.0))));
}
double code(double x) {
	return log(fma(sqrt((x + 1.0)), sqrt((x + -1.0)), x));
}
function code(x)
	return log(Float64(x + sqrt(Float64(Float64(x * x) - 1.0))))
end
function code(x)
	return log(fma(sqrt(Float64(x + 1.0)), sqrt(Float64(x + -1.0)), x))
end
code[x_] := N[Log[N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Log[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(x + -1.0), $MachinePrecision]], $MachinePrecision] + x), $MachinePrecision]], $MachinePrecision]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{x + -1}, x\right)\right)

Error?

Derivation?

  1. Initial program 55.1%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Applied egg-rr100.0%

    \[\leadsto \log \color{blue}{\left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{x + -1}, x\right)\right)} \]
    Step-by-step derivation

    [Start]55.1

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

    +-commutative [=>]55.1

    \[ \log \color{blue}{\left(\sqrt{x \cdot x - 1} + x\right)} \]

    difference-of-sqr-1 [=>]55.1

    \[ \log \left(\sqrt{\color{blue}{\left(x + 1\right) \cdot \left(x - 1\right)}} + x\right) \]

    sqrt-prod [=>]100.0

    \[ \log \left(\color{blue}{\sqrt{x + 1} \cdot \sqrt{x - 1}} + x\right) \]

    fma-def [=>]100.0

    \[ \log \color{blue}{\left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{x - 1}, x\right)\right)} \]

    sub-neg [=>]100.0

    \[ \log \left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{\color{blue}{x + \left(-1\right)}}, x\right)\right) \]

    metadata-eval [=>]100.0

    \[ \log \left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{x + \color{blue}{-1}}, x\right)\right) \]
  3. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy99.6%
Cost6848
\[\log \left(x \cdot 2 - \frac{0.5}{x}\right) \]
Alternative 2
Accuracy99.1%
Cost6592
\[\log \left(x + x\right) \]
Alternative 3
Accuracy31.4%
Cost6464
\[\log x \]

Error

Reproduce?

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