?

Average Error: 15.8 → 0.8
Time: 3.1s
Precision: binary32
Cost: 6496

?

\[x \geq 1\]
\[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
\[\left|\log \left(\frac{0.5}{x}\right)\right| \]
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x) :precision binary32 (fabs (log (/ 0.5 x))))
float code(float x) {
	return logf((x + sqrtf(((x * x) - 1.0f))));
}
float code(float x) {
	return fabsf(logf((0.5f / 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 = abs(log((0.5e0 / x)))
end function
function code(x)
	return log(Float32(x + sqrt(Float32(Float32(x * x) - Float32(1.0)))))
end
function code(x)
	return abs(log(Float32(Float32(0.5) / x)))
end
function tmp = code(x)
	tmp = log((x + sqrt(((x * x) - single(1.0)))));
end
function tmp = code(x)
	tmp = abs(log((single(0.5) / x)));
end
\log \left(x + \sqrt{x \cdot x - 1}\right)
\left|\log \left(\frac{0.5}{x}\right)\right|

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 15.8

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Taylor expanded in x around -inf 31.0

    \[\leadsto \log \color{blue}{\left(\frac{0.5}{x}\right)} \]
  3. Applied egg-rr0.8

    \[\leadsto \color{blue}{\sqrt{{\log \left(\frac{0.5}{x}\right)}^{2}}} \]
  4. Applied egg-rr0.8

    \[\leadsto \color{blue}{\left|\log \left(\frac{0.5}{x}\right)\right|} \]
  5. Final simplification0.8

    \[\leadsto \left|\log \left(\frac{0.5}{x}\right)\right| \]

Alternatives

Alternative 1
Error0.6
Cost3424
\[\log \left(x \cdot 2 + \frac{-0.5}{x}\right) \]
Alternative 2
Error1.0
Cost3296
\[\log \left(x + x\right) \]
Alternative 3
Error30.0
Cost32
\[0 \]

Error

Reproduce?

herbie shell --seed 2023045 
(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)))))