?

Average Error: 16.0 → 0.5
Time: 10.2s
Precision: binary32
Cost: 16768

?

\[x \geq 1\]
\[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
\[\left(\log x + \log 2\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x)
 :precision binary32
 (-
  (+ (log x) (log 2.0))
  (+
   (* 0.25 (/ 1.0 (pow x 2.0)))
   (+
    (* 0.09375 (/ 1.0 (pow x 4.0)))
    (* 0.052083333333333336 (/ 1.0 (pow x 6.0)))))))
float code(float x) {
	return logf((x + sqrtf(((x * x) - 1.0f))));
}
float code(float x) {
	return (logf(x) + logf(2.0f)) - ((0.25f * (1.0f / powf(x, 2.0f))) + ((0.09375f * (1.0f / powf(x, 4.0f))) + (0.052083333333333336f * (1.0f / powf(x, 6.0f)))));
}
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(x) + log(2.0e0)) - ((0.25e0 * (1.0e0 / (x ** 2.0e0))) + ((0.09375e0 * (1.0e0 / (x ** 4.0e0))) + (0.052083333333333336e0 * (1.0e0 / (x ** 6.0e0)))))
end function
function code(x)
	return log(Float32(x + sqrt(Float32(Float32(x * x) - Float32(1.0)))))
end
function code(x)
	return Float32(Float32(log(x) + log(Float32(2.0))) - Float32(Float32(Float32(0.25) * Float32(Float32(1.0) / (x ^ Float32(2.0)))) + Float32(Float32(Float32(0.09375) * Float32(Float32(1.0) / (x ^ Float32(4.0)))) + Float32(Float32(0.052083333333333336) * Float32(Float32(1.0) / (x ^ Float32(6.0)))))))
end
function tmp = code(x)
	tmp = log((x + sqrt(((x * x) - single(1.0)))));
end
function tmp = code(x)
	tmp = (log(x) + log(single(2.0))) - ((single(0.25) * (single(1.0) / (x ^ single(2.0)))) + ((single(0.09375) * (single(1.0) / (x ^ single(4.0)))) + (single(0.052083333333333336) * (single(1.0) / (x ^ single(6.0))))));
end
\log \left(x + \sqrt{x \cdot x - 1}\right)
\left(\log x + \log 2\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original16.0
Target0.3
Herbie0.5
\[\log \left(x + \sqrt{x - 1} \cdot \sqrt{x + 1}\right) \]

Derivation?

  1. Initial program 16.0

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

    \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) + \log 2\right) - \left(0.09375 \cdot \frac{1}{{x}^{4}} + \left(0.052083333333333336 \cdot \frac{1}{{x}^{6}} + 0.25 \cdot \frac{1}{{x}^{2}}\right)\right)} \]
  3. Simplified0.5

    \[\leadsto \color{blue}{\left(\log 2 + \left(-\log \left(\frac{1}{x}\right)\right)\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right)} \]
    Proof

    [Start]0.5

    \[ \left(-1 \cdot \log \left(\frac{1}{x}\right) + \log 2\right) - \left(0.09375 \cdot \frac{1}{{x}^{4}} + \left(0.052083333333333336 \cdot \frac{1}{{x}^{6}} + 0.25 \cdot \frac{1}{{x}^{2}}\right)\right) \]

    rational.json-simplify-1 [<=]0.5

    \[ \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right)} - \left(0.09375 \cdot \frac{1}{{x}^{4}} + \left(0.052083333333333336 \cdot \frac{1}{{x}^{6}} + 0.25 \cdot \frac{1}{{x}^{2}}\right)\right) \]

    rational.json-simplify-2 [=>]0.5

    \[ \left(\log 2 + \color{blue}{\log \left(\frac{1}{x}\right) \cdot -1}\right) - \left(0.09375 \cdot \frac{1}{{x}^{4}} + \left(0.052083333333333336 \cdot \frac{1}{{x}^{6}} + 0.25 \cdot \frac{1}{{x}^{2}}\right)\right) \]

    rational.json-simplify-9 [=>]0.5

    \[ \left(\log 2 + \color{blue}{\left(-\log \left(\frac{1}{x}\right)\right)}\right) - \left(0.09375 \cdot \frac{1}{{x}^{4}} + \left(0.052083333333333336 \cdot \frac{1}{{x}^{6}} + 0.25 \cdot \frac{1}{{x}^{2}}\right)\right) \]

    rational.json-simplify-41 [<=]0.5

    \[ \left(\log 2 + \left(-\log \left(\frac{1}{x}\right)\right)\right) - \color{blue}{\left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right)} \]
  4. Taylor expanded in x around 0 0.5

    \[\leadsto \color{blue}{\left(\log 2 - -1 \cdot \log x\right)} - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]
  5. Simplified0.5

    \[\leadsto \color{blue}{\left(\log 2 - \left(-\log x\right)\right)} - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]
    Proof

    [Start]0.5

    \[ \left(\log 2 - -1 \cdot \log x\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]

    rational.json-simplify-2 [=>]0.5

    \[ \left(\log 2 - \color{blue}{\log x \cdot -1}\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]

    rational.json-simplify-9 [=>]0.5

    \[ \left(\log 2 - \color{blue}{\left(-\log x\right)}\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]
  6. Applied egg-rr0.5

    \[\leadsto \color{blue}{\left(\log x + \log 2\right)} - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]
  7. Final simplification0.5

    \[\leadsto \left(\log x + \log 2\right) - \left(0.25 \cdot \frac{1}{{x}^{2}} + \left(0.09375 \cdot \frac{1}{{x}^{4}} + 0.052083333333333336 \cdot \frac{1}{{x}^{6}}\right)\right) \]

Alternatives

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

Error

Reproduce?

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