| Alternative 1 | |
|---|---|
| Error | 0.3 |
| Cost | 9888 |
\[\log \left(x + \sqrt{x + 1} \cdot \sqrt{x + -1}\right)
\]
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x) :precision binary32 (log (fma (sqrt (+ x 1.0)) (sqrt (+ x -1.0)) x)))
float code(float x) {
return logf((x + sqrtf(((x * x) - 1.0f))));
}
float code(float x) {
return logf(fmaf(sqrtf((x + 1.0f)), sqrtf((x + -1.0f)), x));
}
function code(x) return log(Float32(x + sqrt(Float32(Float32(x * x) - Float32(1.0))))) end
function code(x) return log(fma(sqrt(Float32(x + Float32(1.0))), sqrt(Float32(x + Float32(-1.0))), x)) end
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(\mathsf{fma}\left(\sqrt{x + 1}, \sqrt{x + -1}, x\right)\right)
| Original | 16.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 16.0
Applied egg-rr0.3
Applied egg-rr0.2
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.3 |
| Cost | 9888 |
| Alternative 2 | |
|---|---|
| Error | 16.0 |
| Cost | 6624 |
herbie shell --seed 2022334
(FPCore (x)
:name "Rust f32::acosh"
:precision binary32
:pre (>= x 1.0)
:herbie-target
(log (+ x (* (sqrt (- x 1.0)) (sqrt (+ x 1.0)))))
(log (+ x (sqrt (- (* x x) 1.0)))))