?

Average Error: 15.7 → 0.4
Time: 6.1s
Precision: binary32
Cost: 10208

?

\[x \geq 1\]
\[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
\[\log \left(\left(x + x\right) - \left(\frac{0.5}{x} + 0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right)\right)\right) \]
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x)
 :precision binary32
 (log
  (-
   (+ x x)
   (+ (/ 0.5 x) (* 0.125 (+ (/ 1.0 (pow x 3.0)) (/ 0.5 (pow x 5.0))))))))
float code(float x) {
	return logf((x + sqrtf(((x * x) - 1.0f))));
}
float code(float x) {
	return logf(((x + x) - ((0.5f / x) + (0.125f * ((1.0f / powf(x, 3.0f)) + (0.5f / powf(x, 5.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 + x) - ((0.5e0 / x) + (0.125e0 * ((1.0e0 / (x ** 3.0e0)) + (0.5e0 / (x ** 5.0e0)))))))
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(x + x) - Float32(Float32(Float32(0.5) / x) + Float32(Float32(0.125) * Float32(Float32(Float32(1.0) / (x ^ Float32(3.0))) + Float32(Float32(0.5) / (x ^ Float32(5.0))))))))
end
function tmp = code(x)
	tmp = log((x + sqrt(((x * x) - single(1.0)))));
end
function tmp = code(x)
	tmp = log(((x + x) - ((single(0.5) / x) + (single(0.125) * ((single(1.0) / (x ^ single(3.0))) + (single(0.5) / (x ^ single(5.0))))))));
end
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(\left(x + x\right) - \left(\frac{0.5}{x} + 0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right)\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 15.7

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - \left(0.5 \cdot \frac{1}{x} + \left(0.0625 \cdot \frac{1}{{x}^{5}} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right)} \]
  3. Simplified0.4

    \[\leadsto \log \color{blue}{\left(\left(x + x\right) - \left(0.5 \cdot \frac{1}{x} + \left(0.125 \cdot \frac{1}{{x}^{3}} + 0.0625 \cdot \frac{1}{{x}^{5}}\right)\right)\right)} \]
    Proof

    [Start]0.4

    \[ \log \left(2 \cdot x - \left(0.5 \cdot \frac{1}{x} + \left(0.0625 \cdot \frac{1}{{x}^{5}} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right) \]

    metadata-eval [<=]0.4

    \[ \log \left(\color{blue}{\left(1 + 1\right)} \cdot x - \left(0.5 \cdot \frac{1}{x} + \left(0.0625 \cdot \frac{1}{{x}^{5}} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right) \]

    rational.json-simplify-7 [<=]0.4

    \[ \log \left(\left(1 + 1\right) \cdot \color{blue}{\frac{x}{1}} - \left(0.5 \cdot \frac{1}{x} + \left(0.0625 \cdot \frac{1}{{x}^{5}} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right) \]

    rational.json-simplify-30 [=>]0.4

    \[ \log \left(\color{blue}{\left(x + \frac{x}{1}\right)} - \left(0.5 \cdot \frac{1}{x} + \left(0.0625 \cdot \frac{1}{{x}^{5}} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right) \]

    rational.json-simplify-7 [=>]0.4

    \[ \log \left(\left(x + \color{blue}{x}\right) - \left(0.5 \cdot \frac{1}{x} + \left(0.0625 \cdot \frac{1}{{x}^{5}} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right) \]

    rational.json-simplify-1 [=>]0.4

    \[ \log \left(\left(x + x\right) - \left(0.5 \cdot \frac{1}{x} + \color{blue}{\left(0.125 \cdot \frac{1}{{x}^{3}} + 0.0625 \cdot \frac{1}{{x}^{5}}\right)}\right)\right) \]
  4. Applied egg-rr0.4

    \[\leadsto \log \left(\left(x + x\right) - \color{blue}{\left(\left(0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right) + \frac{0.5}{x}\right) - 0\right)}\right) \]
  5. Simplified0.4

    \[\leadsto \log \left(\left(x + x\right) - \color{blue}{\left(\frac{0.5}{x} + 0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right)\right)}\right) \]
    Proof

    [Start]0.4

    \[ \log \left(\left(x + x\right) - \left(\left(0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right) + \frac{0.5}{x}\right) - 0\right)\right) \]

    rational.json-simplify-5 [=>]0.4

    \[ \log \left(\left(x + x\right) - \color{blue}{\left(0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right) + \frac{0.5}{x}\right)}\right) \]

    rational.json-simplify-1 [=>]0.4

    \[ \log \left(\left(x + x\right) - \color{blue}{\left(\frac{0.5}{x} + 0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right)\right)}\right) \]
  6. Final simplification0.4

    \[\leadsto \log \left(\left(x + x\right) - \left(\frac{0.5}{x} + 0.125 \cdot \left(\frac{1}{{x}^{3}} + \frac{0.5}{{x}^{5}}\right)\right)\right) \]

Alternatives

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

Error

Reproduce?

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