| Alternative 1 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 6848 |
\[\log \left(x \cdot 2 - \frac{0.5}{x}\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)
Initial program 55.1%
Applied egg-rr100.0%
[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)
\] |
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 99.6% |
| Cost | 6848 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 6592 |
| Alternative 3 | |
|---|---|
| Accuracy | 31.4% |
| Cost | 6464 |
herbie shell --seed 2023157
(FPCore (x)
:name "Hyperbolic arc-cosine"
:precision binary64
(log (+ x (sqrt (- (* x x) 1.0)))))