Rust f32::acosh

Percentage Accurate: 53.9% → 97.9%
Time: 4.1s
Alternatives: 12
Speedup: 2.0×

Specification

?
\[x \geq 1\]
\[\begin{array}{l} \\ \cosh^{-1} x \end{array} \]
(FPCore (x) :precision binary32 (acosh x))
float code(float x) {
	return acoshf(x);
}
function code(x)
	return acosh(x)
end
function tmp = code(x)
	tmp = acosh(x);
end
\begin{array}{l}

\\
\cosh^{-1} x
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 53.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \log \left(x + \sqrt{x \cdot x - 1}\right) \end{array} \]
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
float code(float x) {
	return logf((x + sqrtf(((x * x) - 1.0f))));
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = log((x + sqrt(((x * x) - 1.0e0))))
end function
function code(x)
	return log(Float32(x + sqrt(Float32(Float32(x * x) - Float32(1.0)))))
end
function tmp = code(x)
	tmp = log((x + sqrt(((x * x) - single(1.0)))));
end
\begin{array}{l}

\\
\log \left(x + \sqrt{x \cdot x - 1}\right)
\end{array}

Alternative 1: 97.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \log \left(x \cdot 2 - \frac{0.5}{x}\right) \end{array} \]
(FPCore (x) :precision binary32 (log (- (* x 2.0) (/ 0.5 x))))
float code(float x) {
	return logf(((x * 2.0f) - (0.5f / x)));
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = log(((x * 2.0e0) - (0.5e0 / x)))
end function
function code(x)
	return log(Float32(Float32(x * Float32(2.0)) - Float32(Float32(0.5) / x)))
end
function tmp = code(x)
	tmp = log(((x * single(2.0)) - (single(0.5) / x)));
end
\begin{array}{l}

\\
\log \left(x \cdot 2 - \frac{0.5}{x}\right)
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Final simplification98.8%

    \[\leadsto \log \left(x \cdot 2 - \frac{0.5}{x}\right) \]

Alternative 2: 96.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \log \left(x + x\right) \end{array} \]
(FPCore (x) :precision binary32 (log (+ x x)))
float code(float x) {
	return logf((x + x));
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = log((x + x))
end function
function code(x)
	return log(Float32(x + x))
end
function tmp = code(x)
	tmp = log((x + x));
end
\begin{array}{l}

\\
\log \left(x + x\right)
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  3. Final simplification97.7%

    \[\leadsto \log \left(x + x\right) \]

Alternative 3: 3.1% accurate, 207.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x) :precision binary32 -1.0)
float code(float x) {
	return -1.0f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = -1.0e0
end function
function code(x)
	return Float32(-1.0)
end
function tmp = code(x)
	tmp = single(-1.0);
end
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  3. Step-by-step derivation
    1. flip-+-0.0%

      \[\leadsto \log \color{blue}{\left(\frac{x \cdot x - x \cdot x}{x - x}\right)} \]
    2. difference-of-squares-0.0%

      \[\leadsto \log \left(\frac{\color{blue}{\left(x + x\right) \cdot \left(x - x\right)}}{x - x}\right) \]
    3. count-2-0.0%

      \[\leadsto \log \left(\frac{\color{blue}{\left(2 \cdot x\right)} \cdot \left(x - x\right)}{x - x}\right) \]
    4. *-commutative-0.0%

      \[\leadsto \log \left(\frac{\color{blue}{\left(x \cdot 2\right)} \cdot \left(x - x\right)}{x - x}\right) \]
    5. associate-*r/-0.0%

      \[\leadsto \log \color{blue}{\left(\left(x \cdot 2\right) \cdot \frac{x - x}{x - x}\right)} \]
    6. +-inverses-0.0%

      \[\leadsto \log \left(\left(x \cdot 2\right) \cdot \frac{\color{blue}{0}}{x - x}\right) \]
    7. +-inverses-0.0%

      \[\leadsto \log \left(\left(x \cdot 2\right) \cdot \frac{\color{blue}{x \cdot x - x \cdot x}}{x - x}\right) \]
    8. flip-+17.2%

      \[\leadsto \log \left(\left(x \cdot 2\right) \cdot \color{blue}{\left(x + x\right)}\right) \]
    9. count-217.2%

      \[\leadsto \log \left(\left(x \cdot 2\right) \cdot \color{blue}{\left(2 \cdot x\right)}\right) \]
    10. *-commutative17.2%

      \[\leadsto \log \left(\left(x \cdot 2\right) \cdot \color{blue}{\left(x \cdot 2\right)}\right) \]
    11. sum-log28.0%

      \[\leadsto \color{blue}{\log \left(x \cdot 2\right) + \log \left(x \cdot 2\right)} \]
    12. *-commutative28.0%

      \[\leadsto \log \color{blue}{\left(2 \cdot x\right)} + \log \left(x \cdot 2\right) \]
    13. count-228.0%

      \[\leadsto \log \color{blue}{\left(x + x\right)} + \log \left(x \cdot 2\right) \]
    14. flip-+-0.0%

      \[\leadsto \log \color{blue}{\left(\frac{x \cdot x - x \cdot x}{x - x}\right)} + \log \left(x \cdot 2\right) \]
    15. +-inverses-0.0%

      \[\leadsto \log \left(\frac{\color{blue}{0}}{x - x}\right) + \log \left(x \cdot 2\right) \]
    16. +-inverses-0.0%

      \[\leadsto \log \left(\frac{0}{\color{blue}{0}}\right) + \log \left(x \cdot 2\right) \]
    17. *-commutative-0.0%

      \[\leadsto \log \left(\frac{0}{0}\right) + \log \color{blue}{\left(2 \cdot x\right)} \]
    18. count-2-0.0%

      \[\leadsto \log \left(\frac{0}{0}\right) + \log \color{blue}{\left(x + x\right)} \]
    19. flip-+-0.0%

      \[\leadsto \log \left(\frac{0}{0}\right) + \log \color{blue}{\left(\frac{x \cdot x - x \cdot x}{x - x}\right)} \]
    20. +-inverses-0.0%

      \[\leadsto \log \left(\frac{0}{0}\right) + \log \left(\frac{\color{blue}{0}}{x - x}\right) \]
    21. +-inverses-0.0%

      \[\leadsto \log \left(\frac{0}{0}\right) + \log \left(\frac{0}{\color{blue}{0}}\right) \]
  4. Applied egg-rr-0.0%

    \[\leadsto \color{blue}{\log \left(\frac{0}{0}\right) + \log \left(\frac{0}{0}\right)} \]
  5. Simplified3.1%

    \[\leadsto \color{blue}{-1} \]
  6. Final simplification3.1%

    \[\leadsto -1 \]

Alternative 4: 21.5% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 1.3333333333333333 \end{array} \]
(FPCore (x) :precision binary32 1.3333333333333333)
float code(float x) {
	return 1.3333333333333333f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 1.3333333333333333e0
end function
function code(x)
	return Float32(1.3333333333333333)
end
function tmp = code(x)
	tmp = single(1.3333333333333333);
end
\begin{array}{l}

\\
1.3333333333333333
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr21.4%

    \[\leadsto \color{blue}{1.3333333333333333} \]
  8. Final simplification21.4%

    \[\leadsto 1.3333333333333333 \]

Alternative 5: 21.7% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 1.5 \end{array} \]
(FPCore (x) :precision binary32 1.5)
float code(float x) {
	return 1.5f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 1.5e0
end function
function code(x)
	return Float32(1.5)
end
function tmp = code(x)
	tmp = single(1.5);
end
\begin{array}{l}

\\
1.5
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr21.5%

    \[\leadsto \color{blue}{1.5} \]
  8. Final simplification21.5%

    \[\leadsto 1.5 \]

Alternative 6: 22.3% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 2 \end{array} \]
(FPCore (x) :precision binary32 2.0)
float code(float x) {
	return 2.0f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 2.0e0
end function
function code(x)
	return Float32(2.0)
end
function tmp = code(x)
	tmp = single(2.0);
end
\begin{array}{l}

\\
2
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr22.2%

    \[\leadsto \color{blue}{2} \]
  8. Final simplification22.2%

    \[\leadsto 2 \]

Alternative 7: 22.6% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 2.5 \end{array} \]
(FPCore (x) :precision binary32 2.5)
float code(float x) {
	return 2.5f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 2.5e0
end function
function code(x)
	return Float32(2.5)
end
function tmp = code(x)
	tmp = single(2.5);
end
\begin{array}{l}

\\
2.5
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr22.5%

    \[\leadsto \color{blue}{2.5} \]
  8. Final simplification22.5%

    \[\leadsto 2.5 \]

Alternative 8: 23.6% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 4 \end{array} \]
(FPCore (x) :precision binary32 4.0)
float code(float x) {
	return 4.0f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 4.0e0
end function
function code(x)
	return Float32(4.0)
end
function tmp = code(x)
	tmp = single(4.0);
end
\begin{array}{l}

\\
4
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr23.4%

    \[\leadsto \color{blue}{4} \]
  8. Final simplification23.4%

    \[\leadsto 4 \]

Alternative 9: 23.8% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 4.5 \end{array} \]
(FPCore (x) :precision binary32 4.5)
float code(float x) {
	return 4.5f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 4.5e0
end function
function code(x)
	return Float32(4.5)
end
function tmp = code(x)
	tmp = single(4.5);
end
\begin{array}{l}

\\
4.5
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr23.6%

    \[\leadsto \color{blue}{4.5} \]
  8. Final simplification23.6%

    \[\leadsto 4.5 \]

Alternative 10: 24.0% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 5 \end{array} \]
(FPCore (x) :precision binary32 5.0)
float code(float x) {
	return 5.0f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 5.0e0
end function
function code(x)
	return Float32(5.0)
end
function tmp = code(x)
	tmp = single(5.0);
end
\begin{array}{l}

\\
5
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr23.8%

    \[\leadsto \color{blue}{5} \]
  8. Final simplification23.8%

    \[\leadsto 5 \]

Alternative 11: 24.4% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 6 \end{array} \]
(FPCore (x) :precision binary32 6.0)
float code(float x) {
	return 6.0f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 6.0e0
end function
function code(x)
	return Float32(6.0)
end
function tmp = code(x)
	tmp = single(6.0);
end
\begin{array}{l}

\\
6
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr24.2%

    \[\leadsto \color{blue}{6} \]
  8. Final simplification24.2%

    \[\leadsto 6 \]

Alternative 12: 25.6% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 9 \end{array} \]
(FPCore (x) :precision binary32 9.0)
float code(float x) {
	return 9.0f;
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = 9.0e0
end function
function code(x)
	return Float32(9.0)
end
function tmp = code(x)
	tmp = single(9.0);
end
\begin{array}{l}

\\
9
\end{array}
Derivation
  1. Initial program 54.0%

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

    \[\leadsto \log \color{blue}{\left(2 \cdot x - 0.5 \cdot \frac{1}{x}\right)} \]
  3. Step-by-step derivation
    1. *-commutative98.8%

      \[\leadsto \log \left(\color{blue}{x \cdot 2} - 0.5 \cdot \frac{1}{x}\right) \]
    2. associate-*r/98.8%

      \[\leadsto \log \left(x \cdot 2 - \color{blue}{\frac{0.5 \cdot 1}{x}}\right) \]
    3. metadata-eval98.8%

      \[\leadsto \log \left(x \cdot 2 - \frac{\color{blue}{0.5}}{x}\right) \]
  4. Simplified98.8%

    \[\leadsto \log \color{blue}{\left(x \cdot 2 - \frac{0.5}{x}\right)} \]
  5. Taylor expanded in x around inf 98.3%

    \[\leadsto \color{blue}{\left(\log 2 + -1 \cdot \log \left(\frac{1}{x}\right)\right) - 0.25 \cdot \frac{1}{{x}^{2}}} \]
  6. Simplified40.0%

    \[\leadsto \color{blue}{-1 + \left(-\left(-\log x\right)\right)} \]
  7. Applied egg-rr25.5%

    \[\leadsto \color{blue}{9} \]
  8. Final simplification25.5%

    \[\leadsto 9 \]

Developer target: 99.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \log \left(x + \sqrt{x - 1} \cdot \sqrt{x + 1}\right) \end{array} \]
(FPCore (x)
 :precision binary32
 (log (+ x (* (sqrt (- x 1.0)) (sqrt (+ x 1.0))))))
float code(float x) {
	return logf((x + (sqrtf((x - 1.0f)) * sqrtf((x + 1.0f)))));
}
real(4) function code(x)
    real(4), intent (in) :: x
    code = log((x + (sqrt((x - 1.0e0)) * sqrt((x + 1.0e0)))))
end function
function code(x)
	return log(Float32(x + Float32(sqrt(Float32(x - Float32(1.0))) * sqrt(Float32(x + Float32(1.0))))))
end
function tmp = code(x)
	tmp = log((x + (sqrt((x - single(1.0))) * sqrt((x + single(1.0))))));
end
\begin{array}{l}

\\
\log \left(x + \sqrt{x - 1} \cdot \sqrt{x + 1}\right)
\end{array}

Reproduce

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