Rust f32::acosh

Percentage Accurate: 53.0% → 99.2%
Time: 4.9s
Alternatives: 9
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 9 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.0% 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: 99.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x + \sqrt{x \cdot x + -1} \leq 2000:\\ \;\;\;\;\log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{4} + -1}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= (+ x (sqrt (+ (* x x) -1.0))) 2000.0)
   (log (+ x (sqrt (+ (pow (sqrt x) 4.0) -1.0))))
   (log (+ x x))))
float code(float x) {
	float tmp;
	if ((x + sqrtf(((x * x) + -1.0f))) <= 2000.0f) {
		tmp = logf((x + sqrtf((powf(sqrtf(x), 4.0f) + -1.0f))));
	} else {
		tmp = logf((x + x));
	}
	return tmp;
}
real(4) function code(x)
    real(4), intent (in) :: x
    real(4) :: tmp
    if ((x + sqrt(((x * x) + (-1.0e0)))) <= 2000.0e0) then
        tmp = log((x + sqrt(((sqrt(x) ** 4.0e0) + (-1.0e0)))))
    else
        tmp = log((x + x))
    end if
    code = tmp
end function
function code(x)
	tmp = Float32(0.0)
	if (Float32(x + sqrt(Float32(Float32(x * x) + Float32(-1.0)))) <= Float32(2000.0))
		tmp = log(Float32(x + sqrt(Float32((sqrt(x) ^ Float32(4.0)) + Float32(-1.0)))));
	else
		tmp = log(Float32(x + x));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if ((x + sqrt(((x * x) + single(-1.0)))) <= single(2000.0))
		tmp = log((x + sqrt(((sqrt(x) ^ single(4.0)) + single(-1.0)))));
	else
		tmp = log((x + x));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x + \sqrt{x \cdot x + -1} \leq 2000:\\
\;\;\;\;\log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{4} + -1}\right)\\

\mathbf{else}:\\
\;\;\;\;\log \left(x + x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f32 x (sqrt.f32 (-.f32 (*.f32 x x) #s(literal 1 binary32)))) < 2e3

    1. Initial program 99.9%

      \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. pow299.9%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{{x}^{2}} - 1}\right) \]
      2. add-sqr-sqrt100.0%

        \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2} - 1}\right) \]
      3. pow2100.0%

        \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left({\left(\sqrt{x}\right)}^{2}\right)}}^{2} - 1}\right) \]
      4. pow-pow100.0%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{\left(2 \cdot 2\right)}} - 1}\right) \]
      5. metadata-eval100.0%

        \[\leadsto \log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{\color{blue}{4}} - 1}\right) \]
    4. Applied egg-rr100.0%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{4}} - 1}\right) \]

    if 2e3 < (+.f32 x (sqrt.f32 (-.f32 (*.f32 x x) #s(literal 1 binary32))))

    1. Initial program 45.4%

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

      \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \sqrt{x \cdot x + -1} \leq 2000:\\ \;\;\;\;\log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{4} + -1}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \sqrt{x \cdot x + -1}\\ \mathbf{if}\;t\_0 \leq 2000:\\ \;\;\;\;\log t\_0\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (+ x (sqrt (+ (* x x) -1.0)))))
   (if (<= t_0 2000.0) (log t_0) (log (+ x x)))))
float code(float x) {
	float t_0 = x + sqrtf(((x * x) + -1.0f));
	float tmp;
	if (t_0 <= 2000.0f) {
		tmp = logf(t_0);
	} else {
		tmp = logf((x + x));
	}
	return tmp;
}
real(4) function code(x)
    real(4), intent (in) :: x
    real(4) :: t_0
    real(4) :: tmp
    t_0 = x + sqrt(((x * x) + (-1.0e0)))
    if (t_0 <= 2000.0e0) then
        tmp = log(t_0)
    else
        tmp = log((x + x))
    end if
    code = tmp
end function
function code(x)
	t_0 = Float32(x + sqrt(Float32(Float32(x * x) + Float32(-1.0))))
	tmp = Float32(0.0)
	if (t_0 <= Float32(2000.0))
		tmp = log(t_0);
	else
		tmp = log(Float32(x + x));
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = x + sqrt(((x * x) + single(-1.0)));
	tmp = single(0.0);
	if (t_0 <= single(2000.0))
		tmp = log(t_0);
	else
		tmp = log((x + x));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \sqrt{x \cdot x + -1}\\
\mathbf{if}\;t\_0 \leq 2000:\\
\;\;\;\;\log t\_0\\

\mathbf{else}:\\
\;\;\;\;\log \left(x + x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f32 x (sqrt.f32 (-.f32 (*.f32 x x) #s(literal 1 binary32)))) < 2e3

    1. Initial program 99.9%

      \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
    2. Add Preprocessing

    if 2e3 < (+.f32 x (sqrt.f32 (-.f32 (*.f32 x x) #s(literal 1 binary32))))

    1. Initial program 45.4%

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

      \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \sqrt{x \cdot x + -1} \leq 2000:\\ \;\;\;\;\log \left(x + \sqrt{x \cdot x + -1}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.0% 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 50.3%

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

    \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  4. Add Preprocessing

Alternative 4: 44.1% accurate, 2.0× speedup?

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

\\
\log x
\end{array}
Derivation
  1. Initial program 50.3%

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

    \[\leadsto \log \left(x + \color{blue}{x}\right) \]
  4. Taylor expanded in x around 0 95.9%

    \[\leadsto \color{blue}{\log 2 + \log x} \]
  5. Simplified44.0%

    \[\leadsto \color{blue}{\log x} \]
  6. Add Preprocessing

Alternative 5: 11.2% accurate, 29.6× speedup?

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

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

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow250.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{x}^{2}} - 1}\right) \]
    2. add-sqr-sqrt50.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2} - 1}\right) \]
    3. pow250.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left({\left(\sqrt{x}\right)}^{2}\right)}}^{2} - 1}\right) \]
    4. pow-pow50.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{\left(2 \cdot 2\right)}} - 1}\right) \]
    5. metadata-eval50.3%

      \[\leadsto \log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{\color{blue}{4}} - 1}\right) \]
  4. Applied egg-rr50.3%

    \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{4}} - 1}\right) \]
  5. Taylor expanded in x around 0 -0.0%

    \[\leadsto \color{blue}{\log \left(\sqrt{-1}\right) + x \cdot \left({x}^{2} \cdot \left(0.075 \cdot \frac{{x}^{2}}{{\left(\sqrt{-1}\right)}^{5}} - 0.16666666666666666 \cdot \frac{1}{{\left(\sqrt{-1}\right)}^{3}}\right) + \frac{1}{\sqrt{-1}}\right)} \]
  6. Simplified11.6%

    \[\leadsto \color{blue}{-2 + x \cdot 0.9083333333333333} \]
  7. Taylor expanded in x around inf 11.6%

    \[\leadsto \color{blue}{x \cdot \left(0.9083333333333333 - 2 \cdot \frac{1}{x}\right)} \]
  8. Step-by-step derivation
    1. associate-*r/11.6%

      \[\leadsto x \cdot \left(0.9083333333333333 - \color{blue}{\frac{2 \cdot 1}{x}}\right) \]
    2. metadata-eval11.6%

      \[\leadsto x \cdot \left(0.9083333333333333 - \frac{\color{blue}{2}}{x}\right) \]
  9. Simplified11.6%

    \[\leadsto \color{blue}{x \cdot \left(0.9083333333333333 - \frac{2}{x}\right)} \]
  10. Add Preprocessing

Alternative 6: 11.2% accurate, 41.4× speedup?

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

\\
-2 + x \cdot 0.9083333333333333
\end{array}
Derivation
  1. Initial program 50.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow250.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{x}^{2}} - 1}\right) \]
    2. add-sqr-sqrt50.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2} - 1}\right) \]
    3. pow250.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left({\left(\sqrt{x}\right)}^{2}\right)}}^{2} - 1}\right) \]
    4. pow-pow50.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{\left(2 \cdot 2\right)}} - 1}\right) \]
    5. metadata-eval50.3%

      \[\leadsto \log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{\color{blue}{4}} - 1}\right) \]
  4. Applied egg-rr50.3%

    \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{4}} - 1}\right) \]
  5. Taylor expanded in x around 0 -0.0%

    \[\leadsto \color{blue}{\log \left(\sqrt{-1}\right) + x \cdot \left({x}^{2} \cdot \left(0.075 \cdot \frac{{x}^{2}}{{\left(\sqrt{-1}\right)}^{5}} - 0.16666666666666666 \cdot \frac{1}{{\left(\sqrt{-1}\right)}^{3}}\right) + \frac{1}{\sqrt{-1}}\right)} \]
  6. Simplified11.6%

    \[\leadsto \color{blue}{-2 + x \cdot 0.9083333333333333} \]
  7. Add Preprocessing

Alternative 7: 11.2% accurate, 41.4× speedup?

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

\\
-2 + x \cdot 0.8333333333333334
\end{array}
Derivation
  1. Initial program 50.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow250.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{x}^{2}} - 1}\right) \]
    2. add-sqr-sqrt50.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2} - 1}\right) \]
    3. pow250.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left({\left(\sqrt{x}\right)}^{2}\right)}}^{2} - 1}\right) \]
    4. pow-pow50.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{\left(2 \cdot 2\right)}} - 1}\right) \]
    5. metadata-eval50.3%

      \[\leadsto \log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{\color{blue}{4}} - 1}\right) \]
  4. Applied egg-rr50.3%

    \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{4}} - 1}\right) \]
  5. Taylor expanded in x around 0 -0.0%

    \[\leadsto \color{blue}{\log \left(\sqrt{-1}\right) + x \cdot \left(-0.16666666666666666 \cdot \frac{{x}^{2}}{{\left(\sqrt{-1}\right)}^{3}} + \frac{1}{\sqrt{-1}}\right)} \]
  6. Simplified11.6%

    \[\leadsto \color{blue}{-2 + x \cdot 0.8333333333333334} \]
  7. Add Preprocessing

Alternative 8: 11.4% accurate, 69.0× speedup?

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

\\
x \cdot 0.8333333333333334
\end{array}
Derivation
  1. Initial program 50.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow250.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{x}^{2}} - 1}\right) \]
    2. add-sqr-sqrt50.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2} - 1}\right) \]
    3. pow250.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left({\left(\sqrt{x}\right)}^{2}\right)}}^{2} - 1}\right) \]
    4. pow-pow50.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{\left(2 \cdot 2\right)}} - 1}\right) \]
    5. metadata-eval50.3%

      \[\leadsto \log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{\color{blue}{4}} - 1}\right) \]
  4. Applied egg-rr50.3%

    \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{4}} - 1}\right) \]
  5. Taylor expanded in x around 0 -0.0%

    \[\leadsto \color{blue}{\log \left(\sqrt{-1}\right) + x \cdot \left(-0.16666666666666666 \cdot \frac{{x}^{2}}{{\left(\sqrt{-1}\right)}^{3}} + \frac{1}{\sqrt{-1}}\right)} \]
  6. Simplified11.6%

    \[\leadsto \color{blue}{-2 + x \cdot 0.8333333333333334} \]
  7. Taylor expanded in x around inf 11.6%

    \[\leadsto \color{blue}{x \cdot \left(0.8333333333333334 - 2 \cdot \frac{1}{x}\right)} \]
  8. Step-by-step derivation
    1. associate-*r/11.6%

      \[\leadsto x \cdot \left(0.8333333333333334 - \color{blue}{\frac{2 \cdot 1}{x}}\right) \]
    2. metadata-eval11.6%

      \[\leadsto x \cdot \left(0.8333333333333334 - \frac{\color{blue}{2}}{x}\right) \]
  9. Simplified11.6%

    \[\leadsto \color{blue}{x \cdot \left(0.8333333333333334 - \frac{2}{x}\right)} \]
  10. Taylor expanded in x around inf 11.6%

    \[\leadsto x \cdot \color{blue}{0.8333333333333334} \]
  11. Add Preprocessing

Alternative 9: 3.1% 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 50.3%

    \[\log \left(x + \sqrt{x \cdot x - 1}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. pow250.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{x}^{2}} - 1}\right) \]
    2. add-sqr-sqrt50.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2} - 1}\right) \]
    3. pow250.3%

      \[\leadsto \log \left(x + \sqrt{{\color{blue}{\left({\left(\sqrt{x}\right)}^{2}\right)}}^{2} - 1}\right) \]
    4. pow-pow50.3%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{\left(2 \cdot 2\right)}} - 1}\right) \]
    5. metadata-eval50.3%

      \[\leadsto \log \left(x + \sqrt{{\left(\sqrt{x}\right)}^{\color{blue}{4}} - 1}\right) \]
  4. Applied egg-rr50.3%

    \[\leadsto \log \left(x + \sqrt{\color{blue}{{\left(\sqrt{x}\right)}^{4}} - 1}\right) \]
  5. Taylor expanded in x around 0 -0.0%

    \[\leadsto \color{blue}{\log \left(\sqrt{-1}\right) + x \cdot \left(-0.16666666666666666 \cdot \frac{{x}^{2}}{{\left(\sqrt{-1}\right)}^{3}} + \frac{1}{\sqrt{-1}}\right)} \]
  6. Simplified11.6%

    \[\leadsto \color{blue}{-2 + x \cdot 0.8333333333333334} \]
  7. Taylor expanded in x around 0 3.1%

    \[\leadsto \color{blue}{-2} \]
  8. Add Preprocessing

Developer Target 1: 99.2% 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 2024144 
(FPCore (x)
  :name "Rust f32::acosh"
  :precision binary32
  :pre (>= x 1.0)

  :alt
  (! :herbie-platform default (log (+ x (* (sqrt (- x 1)) (sqrt (+ x 1))))))

  (log (+ x (sqrt (- (* x x) 1.0)))))