| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 3552 |
\[\log \left(\frac{1.5}{x} - \left(\frac{2}{x} - \left(x + x\right)\right)\right)
\]
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x) :precision binary32 (log (- (/ 1.5 x) (- (* -4.0 (- (/ 7.5 x) (/ 8.0 x))) (+ x x)))))
float code(float x) {
return logf((x + sqrtf(((x * x) - 1.0f))));
}
float code(float x) {
return logf(((1.5f / x) - ((-4.0f * ((7.5f / x) - (8.0f / x))) - (x + x))));
}
real(4) function code(x)
real(4), intent (in) :: x
code = log((x + sqrt(((x * x) - 1.0e0))))
end function
real(4) function code(x)
real(4), intent (in) :: x
code = log(((1.5e0 / x) - (((-4.0e0) * ((7.5e0 / x) - (8.0e0 / x))) - (x + x))))
end function
function code(x) return log(Float32(x + sqrt(Float32(Float32(x * x) - Float32(1.0))))) end
function code(x) return log(Float32(Float32(Float32(1.5) / x) - Float32(Float32(Float32(-4.0) * Float32(Float32(Float32(7.5) / x) - Float32(Float32(8.0) / x))) - Float32(x + x)))) end
function tmp = code(x) tmp = log((x + sqrt(((x * x) - single(1.0))))); end
function tmp = code(x) tmp = log(((single(1.5) / x) - ((single(-4.0) * ((single(7.5) / x) - (single(8.0) / x))) - (x + x)))); end
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(\frac{1.5}{x} - \left(-4 \cdot \left(\frac{7.5}{x} - \frac{8}{x}\right) - \left(x + x\right)\right)\right)
Results
| Original | 16.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
Initial program 16.0
Taylor expanded in x around inf 0.6
Simplified0.6
[Start]0.6 | \[ \log \left(x + \left(x - 0.5 \cdot \frac{1}{x}\right)\right)
\] |
|---|---|
rational.json-simplify-20 [=>]0.6 | \[ \log \left(x + \left(x - \color{blue}{\frac{1 \cdot 0.5}{x}}\right)\right)
\] |
metadata-eval [=>]0.6 | \[ \log \left(x + \left(x - \frac{\color{blue}{0.5}}{x}\right)\right)
\] |
Applied egg-rr0.6
Applied egg-rr0.6
Final simplification0.6
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 3552 |
| Alternative 2 | |
|---|---|
| Error | 0.6 |
| Cost | 3424 |
| Alternative 3 | |
|---|---|
| Error | 1.0 |
| Cost | 3296 |
herbie shell --seed 2023066
(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)))))