Rust f32::asinh

Percentage Accurate: 37.6% → 98.5%
Time: 8.5s
Alternatives: 16
Speedup: 3.8×

Specification

?
\[\begin{array}{l} \\ \sinh^{-1} x \end{array} \]
(FPCore (x) :precision binary32 (asinh x))
float code(float x) {
	return asinhf(x);
}
function code(x)
	return asinh(x)
end
function tmp = code(x)
	tmp = asinh(x);
end
\begin{array}{l}

\\
\sinh^{-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 16 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: 37.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \end{array} \]
(FPCore (x)
 :precision binary32
 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
float code(float x) {
	return copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
}
function code(x)
	return copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
end
function tmp = code(x)
	tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0))))));
end
\begin{array}{l}

\\
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\end{array}

Alternative 1: 98.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|x\right| + 1\\ t_1 := {t_0}^{2}\\ t_2 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ \mathbf{if}\;t_2 \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;t_2 \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{t_0} + \frac{3}{t_1}\right), \left(\frac{30}{{t_0}^{3}} + \left(\frac{45}{t_1} + \frac{45}{t_0}\right)\right) \cdot \left(0.001388888888888889 \cdot {x}^{6}\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_0}, \mathsf{log1p}\left(\left|x\right|\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (+ (fabs x) 1.0))
        (t_1 (pow t_0 2.0))
        (t_2 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_2 -5.0)
     (copysign (log (+ (- x x) (/ -0.5 x))) x)
     (if (<= t_2 0.10000000149011612)
       (copysign
        (+
         (fma
          -0.041666666666666664
          (* (pow x 4.0) (+ (/ 3.0 t_0) (/ 3.0 t_1)))
          (*
           (+ (/ 30.0 (pow t_0 3.0)) (+ (/ 45.0 t_1) (/ 45.0 t_0)))
           (* 0.001388888888888889 (pow x 6.0))))
         (fma 0.5 (/ (pow x 2.0) t_0) (log1p (fabs x))))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = fabsf(x) + 1.0f;
	float t_1 = powf(t_0, 2.0f);
	float t_2 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float tmp;
	if (t_2 <= -5.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (t_2 <= 0.10000000149011612f) {
		tmp = copysignf((fmaf(-0.041666666666666664f, (powf(x, 4.0f) * ((3.0f / t_0) + (3.0f / t_1))), (((30.0f / powf(t_0, 3.0f)) + ((45.0f / t_1) + (45.0f / t_0))) * (0.001388888888888889f * powf(x, 6.0f)))) + fmaf(0.5f, (powf(x, 2.0f) / t_0), log1pf(fabsf(x)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = Float32(abs(x) + Float32(1.0))
	t_1 = t_0 ^ Float32(2.0)
	t_2 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	tmp = Float32(0.0)
	if (t_2 <= Float32(-5.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (t_2 <= Float32(0.10000000149011612))
		tmp = copysign(Float32(fma(Float32(-0.041666666666666664), Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / t_0) + Float32(Float32(3.0) / t_1))), Float32(Float32(Float32(Float32(30.0) / (t_0 ^ Float32(3.0))) + Float32(Float32(Float32(45.0) / t_1) + Float32(Float32(45.0) / t_0))) * Float32(Float32(0.001388888888888889) * (x ^ Float32(6.0))))) + fma(Float32(0.5), Float32((x ^ Float32(2.0)) / t_0), log1p(abs(x)))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|x\right| + 1\\
t_1 := {t_0}^{2}\\
t_2 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_2 \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;t_2 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{t_0} + \frac{3}{t_1}\right), \left(\frac{30}{{t_0}^{3}} + \left(\frac{45}{t_1} + \frac{45}{t_0}\right)\right) \cdot \left(0.001388888888888889 \cdot {x}^{6}\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_0}, \mathsf{log1p}\left(\left|x\right|\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -5

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001

    1. Initial program 23.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 23.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right) + \left(-0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) + \left(0.001388888888888889 \cdot \left({x}^{6} \cdot \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + \left(45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}} + 45 \cdot \frac{1}{1 + \left|x\right|}\right)\right)\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right)\right)}, x\right) \]
    3. Step-by-step derivation
      1. +-commutative23.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\left(-0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) + \left(0.001388888888888889 \cdot \left({x}^{6} \cdot \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + \left(45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}} + 45 \cdot \frac{1}{1 + \left|x\right|}\right)\right)\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right)\right) + \log \left(1 + \left|x\right|\right)}, x\right) \]
      2. associate-+r+23.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\left(\left(-0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) + 0.001388888888888889 \cdot \left({x}^{6} \cdot \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + \left(45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}} + 45 \cdot \frac{1}{1 + \left|x\right|}\right)\right)\right)\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right)} + \log \left(1 + \left|x\right|\right), x\right) \]
    4. Simplified99.5%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{1 + \left|x\right|} + \frac{3}{{\left(1 + \left|x\right|\right)}^{2}}\right), \left(\frac{30}{{\left(1 + \left|x\right|\right)}^{3}} + \left(\frac{45}{{\left(1 + \left|x\right|\right)}^{2}} + \frac{45}{1 + \left|x\right|}\right)\right) \cdot \left(0.001388888888888889 \cdot {x}^{6}\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \mathsf{log1p}\left(\left|x\right|\right)\right)}, x\right) \]

    if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 46.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{\left|x\right| + 1} + \frac{3}{{\left(\left|x\right| + 1\right)}^{2}}\right), \left(\frac{30}{{\left(\left|x\right| + 1\right)}^{3}} + \left(\frac{45}{{\left(\left|x\right| + 1\right)}^{2}} + \frac{45}{\left|x\right| + 1}\right)\right) \cdot \left(0.001388888888888889 \cdot {x}^{6}\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{\left|x\right| + 1}, \mathsf{log1p}\left(\left|x\right|\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 2: 98.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + 1\right)}^{2}\\ t_1 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ \mathbf{if}\;t_1 \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;t_1 \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{x + 1} + \frac{3}{t_0}\right), \left(0.001388888888888889 \cdot {x}^{6}\right) \cdot \left(\frac{30}{{\left(x + 1\right)}^{3}} + \left(\frac{45}{t_0} + \frac{45}{x + 1}\right)\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (pow (+ x 1.0) 2.0))
        (t_1 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_1 -5.0)
     (copysign (log (+ (- x x) (/ -0.5 x))) x)
     (if (<= t_1 0.10000000149011612)
       (copysign
        (+
         (fma
          -0.041666666666666664
          (* (pow x 4.0) (+ (/ 3.0 (+ x 1.0)) (/ 3.0 t_0)))
          (*
           (* 0.001388888888888889 (pow x 6.0))
           (+
            (/ 30.0 (pow (+ x 1.0) 3.0))
            (+ (/ 45.0 t_0) (/ 45.0 (+ x 1.0))))))
         (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = powf((x + 1.0f), 2.0f);
	float t_1 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float tmp;
	if (t_1 <= -5.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (t_1 <= 0.10000000149011612f) {
		tmp = copysignf((fmaf(-0.041666666666666664f, (powf(x, 4.0f) * ((3.0f / (x + 1.0f)) + (3.0f / t_0))), ((0.001388888888888889f * powf(x, 6.0f)) * ((30.0f / powf((x + 1.0f), 3.0f)) + ((45.0f / t_0) + (45.0f / (x + 1.0f)))))) + fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = Float32(x + Float32(1.0)) ^ Float32(2.0)
	t_1 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	tmp = Float32(0.0)
	if (t_1 <= Float32(-5.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (t_1 <= Float32(0.10000000149011612))
		tmp = copysign(Float32(fma(Float32(-0.041666666666666664), Float32((x ^ Float32(4.0)) * Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / t_0))), Float32(Float32(Float32(0.001388888888888889) * (x ^ Float32(6.0))) * Float32(Float32(Float32(30.0) / (Float32(x + Float32(1.0)) ^ Float32(3.0))) + Float32(Float32(Float32(45.0) / t_0) + Float32(Float32(45.0) / Float32(x + Float32(1.0))))))) + fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x + 1\right)}^{2}\\
t_1 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_1 \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;t_1 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{x + 1} + \frac{3}{t_0}\right), \left(0.001388888888888889 \cdot {x}^{6}\right) \cdot \left(\frac{30}{{\left(x + 1\right)}^{3}} + \left(\frac{45}{t_0} + \frac{45}{x + 1}\right)\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -5

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001

    1. Initial program 23.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 23.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right) + \left(-0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) + \left(0.001388888888888889 \cdot \left({x}^{6} \cdot \left(30 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{3}} + \left(45 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}} + 45 \cdot \frac{1}{1 + \left|x\right|}\right)\right)\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right)\right)}, x\right) \]
    3. Simplified99.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{1 + x} + \frac{3}{{\left(1 + x\right)}^{2}}\right), \left(\frac{30}{{\left(1 + x\right)}^{3}} + \left(\frac{45}{{\left(1 + x\right)}^{2}} + \frac{45}{1 + x}\right)\right) \cdot \left(0.001388888888888889 \cdot {x}^{6}\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \mathsf{log1p}\left(x\right)\right)}, x\right) \]

    if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 46.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, {x}^{4} \cdot \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right), \left(0.001388888888888889 \cdot {x}^{6}\right) \cdot \left(\frac{30}{{\left(x + 1\right)}^{3}} + \left(\frac{45}{{\left(x + 1\right)}^{2}} + \frac{45}{x + 1}\right)\right)\right) + \mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 3: 99.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ t_1 := \left|x\right| + 1\\ \mathbf{if}\;t_0 \leq -0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_1}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \left(\frac{3}{t_1} + \frac{3}{{t_1}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
        (t_1 (+ (fabs x) 1.0)))
   (if (<= t_0 -0.10000000149011612)
     (copysign (log (+ (fabs x) (hypot 1.0 x))) x)
     (if (<= t_0 0.10000000149011612)
       (copysign
        (+
         (fma 0.5 (/ (pow x 2.0) t_1) (log1p (fabs x)))
         (*
          (+ (/ 3.0 t_1) (/ 3.0 (pow t_1 2.0)))
          (* -0.041666666666666664 (pow x 4.0))))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float t_1 = fabsf(x) + 1.0f;
	float tmp;
	if (t_0 <= -0.10000000149011612f) {
		tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
	} else if (t_0 <= 0.10000000149011612f) {
		tmp = copysignf((fmaf(0.5f, (powf(x, 2.0f) / t_1), log1pf(fabsf(x))) + (((3.0f / t_1) + (3.0f / powf(t_1, 2.0f))) * (-0.041666666666666664f * powf(x, 4.0f)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	t_1 = Float32(abs(x) + Float32(1.0))
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.10000000149011612))
		tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x);
	elseif (t_0 <= Float32(0.10000000149011612))
		tmp = copysign(Float32(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / t_1), log1p(abs(x))) + Float32(Float32(Float32(Float32(3.0) / t_1) + Float32(Float32(3.0) / (t_1 ^ Float32(2.0)))) * Float32(Float32(-0.041666666666666664) * (x ^ Float32(4.0))))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
t_1 := \left|x\right| + 1\\
\mathbf{if}\;t_0 \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{t_1}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \left(\frac{3}{t_1} + \frac{3}{{t_1}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -0.100000001

    1. Initial program 53.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative53.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-def98.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified98.4%

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]

    if -0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001

    1. Initial program 21.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 21.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right) + \left(-0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right)}, x\right) \]
    3. Step-by-step derivation
      1. +-commutative21.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left|x\right|\right) + \color{blue}{\left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right)\right)}, x\right) \]
      2. associate-+r+21.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\left(\log \left(1 + \left|x\right|\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right) + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right)}, x\right) \]
      3. +-commutative21.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)\right)} + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right), x\right) \]
      4. fma-def21.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \log \left(1 + \left|x\right|\right)\right)} + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right), x\right) \]
      5. log1p-def99.9%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \color{blue}{\mathsf{log1p}\left(\left|x\right|\right)}\right) + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right), x\right) \]
      6. associate-*r*99.9%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \color{blue}{\left(-0.041666666666666664 \cdot {x}^{4}\right) \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)}, x\right) \]
      7. *-commutative99.9%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \color{blue}{\left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right)}, x\right) \]
    4. Simplified99.9%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \left(\frac{3}{1 + \left|x\right|} + \frac{3}{{\left(1 + \left|x\right|\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right)}, x\right) \]

    if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 46.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{\left|x\right| + 1}, \mathsf{log1p}\left(\left|x\right|\right)\right) + \left(\frac{3}{\left|x\right| + 1} + \frac{3}{{\left(\left|x\right| + 1\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 4: 99.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ \mathbf{if}\;t_0 \leq -0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right) + \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_0 -0.10000000149011612)
     (copysign (log (+ (fabs x) (hypot 1.0 x))) x)
     (if (<= t_0 0.10000000149011612)
       (copysign
        (+
         (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x))
         (*
          (+ (/ 3.0 (+ x 1.0)) (/ 3.0 (pow (+ x 1.0) 2.0)))
          (* -0.041666666666666664 (pow x 4.0))))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float tmp;
	if (t_0 <= -0.10000000149011612f) {
		tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
	} else if (t_0 <= 0.10000000149011612f) {
		tmp = copysignf((fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)) + (((3.0f / (x + 1.0f)) + (3.0f / powf((x + 1.0f), 2.0f))) * (-0.041666666666666664f * powf(x, 4.0f)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.10000000149011612))
		tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x);
	elseif (t_0 <= Float32(0.10000000149011612))
		tmp = copysign(Float32(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)) + Float32(Float32(Float32(Float32(3.0) / Float32(x + Float32(1.0))) + Float32(Float32(3.0) / (Float32(x + Float32(1.0)) ^ Float32(2.0)))) * Float32(Float32(-0.041666666666666664) * (x ^ Float32(4.0))))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right) + \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -0.100000001

    1. Initial program 53.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative53.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-def98.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified98.4%

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]

    if -0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001

    1. Initial program 21.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 21.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right) + \left(-0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right)}, x\right) \]
    3. Step-by-step derivation
      1. +-commutative21.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left|x\right|\right) + \color{blue}{\left(0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right)\right)}, x\right) \]
      2. associate-+r+21.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\left(\log \left(1 + \left|x\right|\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}\right) + -0.041666666666666664 \cdot \left({x}^{4} \cdot \left(3 \cdot \frac{1}{1 + \left|x\right|} + 3 \cdot \frac{1}{{\left(1 + \left|x\right|\right)}^{2}}\right)\right)}, x\right) \]
    4. Simplified99.9%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \mathsf{log1p}\left(x\right)\right) + \left(\frac{3}{1 + x} + \frac{3}{{\left(1 + x\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right)}, x\right) \]

    if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 46.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right) + \left(\frac{3}{x + 1} + \frac{3}{{\left(x + 1\right)}^{2}}\right) \cdot \left(-0.041666666666666664 \cdot {x}^{4}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 5: 99.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ \mathbf{if}\;t_0 \leq -0.019999999552965164:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.009999999776482582:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_0 -0.019999999552965164)
     (copysign (log (+ (fabs x) (hypot 1.0 x))) x)
     (if (<= t_0 0.009999999776482582)
       (copysign (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)) x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float tmp;
	if (t_0 <= -0.019999999552965164f) {
		tmp = copysignf(logf((fabsf(x) + hypotf(1.0f, x))), x);
	} else if (t_0 <= 0.009999999776482582f) {
		tmp = copysignf(fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.019999999552965164))
		tmp = copysign(log(Float32(abs(x) + hypot(Float32(1.0), x))), x);
	elseif (t_0 <= Float32(0.009999999776482582))
		tmp = copysign(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -0.019999999552965164:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.009999999776482582:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -0.0199999996

    1. Initial program 53.6%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative53.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-def98.3%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified98.3%

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]

    if -0.0199999996 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.00999999978

    1. Initial program 19.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 20.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right) + 0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|}}, x\right) \]
    3. Step-by-step derivation
      1. +-commutative20.6%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.5 \cdot \frac{{x}^{2}}{1 + \left|x\right|} + \log \left(1 + \left|x\right|\right)}, x\right) \]
      2. fma-def20.6%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|x\right|}, \log \left(1 + \left|x\right|\right)\right)}, x\right) \]
      3. rem-square-sqrt10.9%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|}, \log \left(1 + \left|x\right|\right)\right), x\right) \]
      4. fabs-sqr10.9%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \color{blue}{\sqrt{x} \cdot \sqrt{x}}}, \log \left(1 + \left|x\right|\right)\right), x\right) \]
      5. rem-square-sqrt20.5%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + \color{blue}{x}}, \log \left(1 + \left|x\right|\right)\right), x\right) \]
      6. log1p-def99.5%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \color{blue}{\mathsf{log1p}\left(\left|x\right|\right)}\right), x\right) \]
      7. rem-square-sqrt46.8%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \mathsf{log1p}\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right), x\right) \]
      8. fabs-sqr46.8%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \mathsf{log1p}\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right), x\right) \]
      9. rem-square-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \mathsf{log1p}\left(\color{blue}{x}\right)\right), x\right) \]
    4. Simplified99.9%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{fma}\left(0.5, \frac{{x}^{2}}{1 + x}, \mathsf{log1p}\left(x\right)\right)}, x\right) \]

    if 0.00999999978 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 46.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.9%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.9%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.7%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.7%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.7%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -0.019999999552965164:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.009999999776482582:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 6: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ \mathbf{if}\;t_0 \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-0.5 \cdot {x}^{3} + \left(0.225 \cdot {x}^{5} + x \cdot 3\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_0 -5.0)
     (copysign (log (+ (- x x) (/ -0.5 x))) x)
     (if (<= t_0 0.10000000149011612)
       (copysign
        (*
         0.3333333333333333
         (+ (* -0.5 (pow x 3.0)) (+ (* 0.225 (pow x 5.0)) (* x 3.0))))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float tmp;
	if (t_0 <= -5.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (t_0 <= 0.10000000149011612f) {
		tmp = copysignf((0.3333333333333333f * ((-0.5f * powf(x, 3.0f)) + ((0.225f * powf(x, 5.0f)) + (x * 3.0f)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-5.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (t_0 <= Float32(0.10000000149011612))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(Float32(-0.5) * (x ^ Float32(3.0))) + Float32(Float32(Float32(0.225) * (x ^ Float32(5.0))) + Float32(x * Float32(3.0))))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0))))));
	tmp = single(0.0);
	if (t_0 <= single(-5.0))
		tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x))));
	elseif (t_0 <= single(0.10000000149011612))
		tmp = sign(x) * abs((single(0.3333333333333333) * ((single(-0.5) * (x ^ single(3.0))) + ((single(0.225) * (x ^ single(5.0))) + (x * single(3.0))))));
	else
		tmp = sign(x) * abs(log((x + hypot(single(1.0), x))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-0.5 \cdot {x}^{3} + \left(0.225 \cdot {x}^{5} + x \cdot 3\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < -5

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.100000001

    1. Initial program 23.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube23.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/323.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow23.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative23.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt10.6%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr10.6%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt23.7%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr23.7%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 98.5%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(-0.5 \cdot {x}^{3} + \left(0.225 \cdot {x}^{5} + 3 \cdot x\right)\right)}, x\right) \]

    if 0.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 46.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -5:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-0.5 \cdot {x}^{3} + \left(0.225 \cdot {x}^{5} + x \cdot 3\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 7: 97.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -50.0)
   (copysign (log (+ (- x x) (/ -0.5 x))) x)
   (if (<= x 0.10000000149011612)
     (copysign
      (* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
      x)
     (copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
	float tmp;
	if (x <= -50.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (x <= 0.10000000149011612f) {
		tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-50.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (x <= Float32(0.10000000149011612))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * Float32(x + Float32((x ^ Float32(3.0)) * Float32(-0.16666666666666666))))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-50.0))
		tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x))));
	elseif (x <= single(0.10000000149011612))
		tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * (x + ((x ^ single(3.0)) * single(-0.16666666666666666))))));
	else
		tmp = sign(x) * abs(log((x + hypot(single(1.0), x))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -50

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -50 < x < 0.100000001

    1. Initial program 23.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube23.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/323.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow23.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative23.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt10.6%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr10.6%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt23.7%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr23.7%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 97.9%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{\left(x + -0.16666666666666666 \cdot {x}^{3}\right)}\right), x\right) \]

    if 0.100000001 < x

    1. Initial program 46.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. *-un-lft-identity46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      2. *-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot 1\right)}, x\right) \]
      3. log-prod46.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right) + \log 1}, x\right) \]
      4. +-commutative46.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right) + \log 1, x\right) \]
      5. hypot-1-def99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right) + \log 1, x\right) \]
      6. add-sqr-sqrt99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      7. fabs-sqr99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      8. add-sqr-sqrt99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right) + \log 1, x\right) \]
      9. metadata-eval99.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + \color{blue}{0}, x\right) \]
    3. Applied egg-rr99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right) + 0}, x\right) \]
    4. Step-by-step derivation
      1. +-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    5. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]

Alternative 8: 97.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -50.0)
   (copysign (log (+ (- x x) (/ -0.5 x))) x)
   (if (<= x 0.4000000059604645)
     (copysign
      (* 0.3333333333333333 (* 3.0 (+ x (* (pow x 3.0) -0.16666666666666666))))
      x)
     (copysign (log (+ (/ 0.5 x) (+ x x))) x))))
float code(float x) {
	float tmp;
	if (x <= -50.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (3.0f * (x + (powf(x, 3.0f) * -0.16666666666666666f)))), x);
	} else {
		tmp = copysignf(logf(((0.5f / x) + (x + x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-50.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(Float32(3.0) * Float32(x + Float32((x ^ Float32(3.0)) * Float32(-0.16666666666666666))))), x);
	else
		tmp = copysign(log(Float32(Float32(Float32(0.5) / x) + Float32(x + x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-50.0))
		tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x))));
	elseif (x <= single(0.4000000059604645))
		tmp = sign(x) * abs((single(0.3333333333333333) * (single(3.0) * (x + ((x ^ single(3.0)) * single(-0.16666666666666666))))));
	else
		tmp = sign(x) * abs(log(((single(0.5) / x) + (x + x))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -50

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -50 < x < 0.400000006

    1. Initial program 24.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube24.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/324.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt24.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr24.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 97.6%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{\left(x + -0.16666666666666666 \cdot {x}^{3}\right)}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 99.4%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left(\left|x\right| + 0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
    3. Step-by-step derivation
      1. associate-+r+99.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + \left|x\right|\right) + 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
      2. +-commutative99.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.5 \cdot \frac{1}{x} + \left(x + \left|x\right|\right)\right)}, x\right) \]
      3. associate-*r/99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\frac{0.5 \cdot 1}{x}} + \left(x + \left|x\right|\right)\right), x\right) \]
      4. metadata-eval99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{0.5}}{x} + \left(x + \left|x\right|\right)\right), x\right) \]
      5. rem-square-sqrt99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right), x\right) \]
      6. fabs-sqr99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right), x\right) \]
      7. rem-square-sqrt99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \color{blue}{x}\right)\right), x\right) \]
    4. Simplified99.4%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{0.5}{x} + \left(x + x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \left(x + {x}^{3} \cdot -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]

Alternative 9: 96.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -50.0)
   (copysign (log (+ (- x x) (/ -0.5 x))) x)
   (if (<= x 0.4000000059604645)
     (copysign (* 0.3333333333333333 (* x 3.0)) x)
     (copysign (log (+ (/ 0.5 x) (+ x x))) x))))
float code(float x) {
	float tmp;
	if (x <= -50.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
	} else {
		tmp = copysignf(logf(((0.5f / x) + (x + x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-50.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x);
	else
		tmp = copysign(log(Float32(Float32(Float32(0.5) / x) + Float32(x + x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-50.0))
		tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x))));
	elseif (x <= single(0.4000000059604645))
		tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0))));
	else
		tmp = sign(x) * abs(log(((single(0.5) / x) + (x + x))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -50

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -50 < x < 0.400000006

    1. Initial program 24.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube24.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/324.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt24.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr24.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 95.9%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 99.4%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left(\left|x\right| + 0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
    3. Step-by-step derivation
      1. associate-+r+99.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + \left|x\right|\right) + 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
      2. +-commutative99.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.5 \cdot \frac{1}{x} + \left(x + \left|x\right|\right)\right)}, x\right) \]
      3. associate-*r/99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\frac{0.5 \cdot 1}{x}} + \left(x + \left|x\right|\right)\right), x\right) \]
      4. metadata-eval99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{0.5}}{x} + \left(x + \left|x\right|\right)\right), x\right) \]
      5. rem-square-sqrt99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right), x\right) \]
      6. fabs-sqr99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right), x\right) \]
      7. rem-square-sqrt99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \color{blue}{x}\right)\right), x\right) \]
    4. Simplified99.4%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{0.5}{x} + \left(x + x\right)\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + x\right)\right), x\right)\\ \end{array} \]

Alternative 10: 96.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -50.0)
   (copysign (log (+ (- x x) (/ -0.5 x))) x)
   (if (<= x 0.4000000059604645)
     (copysign (* 0.3333333333333333 (* x 3.0)) x)
     (copysign (log (+ x x)) x))))
float code(float x) {
	float tmp;
	if (x <= -50.0f) {
		tmp = copysignf(logf(((x - x) + (-0.5f / x))), x);
	} else if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
	} else {
		tmp = copysignf(logf((x + x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-50.0))
		tmp = copysign(log(Float32(Float32(x - x) + Float32(Float32(-0.5) / x))), x);
	elseif (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x);
	else
		tmp = copysign(log(Float32(x + x)), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-50.0))
		tmp = sign(x) * abs(log(((x - x) + (single(-0.5) / x))));
	elseif (x <= single(0.4000000059604645))
		tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0))));
	else
		tmp = sign(x) * abs(log((x + x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -50

    1. Initial program 50.3%

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + -1 \cdot x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
      2. neg-mul-198.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| + \color{blue}{\left(-x\right)}\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      3. unsub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\left(\left|x\right| - x\right)} + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      4. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      5. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      6. rem-square-sqrt99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\color{blue}{x} - x\right) + \left(-0.5 \cdot \frac{1}{x}\right)\right), x\right) \]
      7. associate-*r/99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right), x\right) \]
      8. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      9. distribute-neg-frac99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      10. metadata-eval99.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{\color{blue}{-0.5}}{x}\right), x\right) \]
    4. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x - x\right) + \frac{-0.5}{x}\right)}, x\right) \]

    if -50 < x < 0.400000006

    1. Initial program 24.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube24.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/324.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt24.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr24.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 95.9%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left|x\right|\right)}, x\right) \]
    3. Step-by-step derivation
      1. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right), x\right) \]
      2. fabs-sqr98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right), x\right) \]
      3. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{x}\right), x\right) \]
    4. Simplified98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + x\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(x - x\right) + \frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]

Alternative 11: 83.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -0.5)
   (copysign (- (log (/ -1.0 x))) x)
   (if (<= x 0.4000000059604645)
     (copysign (* 0.3333333333333333 (* x 3.0)) x)
     (copysign (log (+ x x)) x))))
float code(float x) {
	float tmp;
	if (x <= -0.5f) {
		tmp = copysignf(-logf((-1.0f / x)), x);
	} else if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
	} else {
		tmp = copysignf(logf((x + x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-0.5))
		tmp = copysign(Float32(-log(Float32(Float32(-1.0) / x))), x);
	elseif (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x);
	else
		tmp = copysign(log(Float32(x + x)), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-0.5))
		tmp = sign(x) * abs(-log((single(-1.0) / x)));
	elseif (x <= single(0.4000000059604645))
		tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0))));
	else
		tmp = sign(x) * abs(log((x + x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -0.5

    1. Initial program 51.1%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-1 \cdot \log \left(\frac{-1}{x}\right)}, x\right) \]
    3. Step-by-step derivation
      1. mul-1-neg45.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\frac{-1}{x}\right)}, x\right) \]
    4. Simplified45.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\frac{-1}{x}\right)}, x\right) \]

    if -0.5 < x < 0.400000006

    1. Initial program 23.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube23.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/323.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.3%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow23.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative23.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt11.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr11.4%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt23.7%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr23.7%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 96.3%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left|x\right|\right)}, x\right) \]
    3. Step-by-step derivation
      1. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right), x\right) \]
      2. fabs-sqr98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right), x\right) \]
      3. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{x}\right), x\right) \]
    4. Simplified98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + x\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\frac{-1}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]

Alternative 12: 84.0% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(-1 - \log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -50.0)
   (copysign (- -1.0 (log (- x))) x)
   (if (<= x 0.4000000059604645)
     (copysign (* 0.3333333333333333 (* x 3.0)) x)
     (copysign (log (+ x x)) x))))
float code(float x) {
	float tmp;
	if (x <= -50.0f) {
		tmp = copysignf((-1.0f - logf(-x)), x);
	} else if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
	} else {
		tmp = copysignf(logf((x + x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-50.0))
		tmp = copysign(Float32(Float32(-1.0) - log(Float32(-x))), x);
	elseif (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x);
	else
		tmp = copysign(log(Float32(x + x)), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-50.0))
		tmp = sign(x) * abs((single(-1.0) - log(-x)));
	elseif (x <= single(0.4000000059604645))
		tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0))));
	else
		tmp = sign(x) * abs(log((x + x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -50:\\
\;\;\;\;\mathsf{copysign}\left(-1 - \log \left(-x\right), x\right)\\

\mathbf{elif}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -50

    1. Initial program 50.3%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 6.1%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left(\left|x\right| + 0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
    3. Step-by-step derivation
      1. associate-+r+-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + \left|x\right|\right) + 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
      2. +-commutative-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.5 \cdot \frac{1}{x} + \left(x + \left|x\right|\right)\right)}, x\right) \]
      3. associate-*r/-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{\frac{0.5 \cdot 1}{x}} + \left(x + \left|x\right|\right)\right), x\right) \]
      4. metadata-eval-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{0.5}}{x} + \left(x + \left|x\right|\right)\right), x\right) \]
      5. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right), x\right) \]
      6. fabs-sqr-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right), x\right) \]
      7. rem-square-sqrt-0.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5}{x} + \left(x + \color{blue}{x}\right)\right), x\right) \]
    4. Simplified-0.0%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{0.5}{x} + \left(x + x\right)\right)}, x\right) \]
    5. Applied egg-rr-0.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log -0.5 - \log \left(-x\right)}, x\right) \]
    6. Simplified48.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-1 - \log \left(-x\right)}, x\right) \]

    if -50 < x < 0.400000006

    1. Initial program 24.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube24.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/324.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow23.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow323.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative24.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def23.9%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr11.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt24.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr24.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 95.9%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left|x\right|\right)}, x\right) \]
    3. Step-by-step derivation
      1. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right), x\right) \]
      2. fabs-sqr98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right), x\right) \]
      3. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{x}\right), x\right) \]
    4. Simplified98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + x\right)}, x\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(-1 - \log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]

Alternative 13: 74.9% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x 0.4000000059604645)
   (copysign (* 0.3333333333333333 (* x 3.0)) x)
   (copysign (log (+ x x)) x)))
float code(float x) {
	float tmp;
	if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
	} else {
		tmp = copysignf(logf((x + x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x);
	else
		tmp = copysign(log(Float32(x + x)), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(0.4000000059604645))
		tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0))));
	else
		tmp = sign(x) * abs(log((x + x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.400000006

    1. Initial program 33.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube28.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/328.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow28.3%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow328.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow32.8%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative32.8%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def49.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt7.5%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr7.5%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt19.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr19.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 66.7%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around inf 98.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left|x\right|\right)}, x\right) \]
    3. Step-by-step derivation
      1. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right), x\right) \]
      2. fabs-sqr98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right), x\right) \]
      3. rem-square-sqrt98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \color{blue}{x}\right), x\right) \]
    4. Simplified98.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]

Alternative 14: 61.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x 0.4000000059604645)
   (copysign (* 0.3333333333333333 (* x 3.0)) x)
   (copysign (log1p x) x)))
float code(float x) {
	float tmp;
	if (x <= 0.4000000059604645f) {
		tmp = copysignf((0.3333333333333333f * (x * 3.0f)), x);
	} else {
		tmp = copysignf(log1pf(x), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(0.4000000059604645))
		tmp = copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x);
	else
		tmp = copysign(log1p(x), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 0.400000006

    1. Initial program 33.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. add-cbrt-cube28.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
      2. pow1/328.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
      3. log-pow28.3%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      4. pow328.3%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
      5. log-pow32.8%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
      6. +-commutative32.8%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
      7. hypot-1-def49.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
      8. add-sqr-sqrt7.5%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      9. fabs-sqr7.5%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. add-sqr-sqrt19.0%

        \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    3. Applied egg-rr19.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    4. Taylor expanded in x around 0 66.7%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]

    if 0.400000006 < x

    1. Initial program 45.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Taylor expanded in x around 0 44.5%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right)}, x\right) \]
    3. Step-by-step derivation
      1. log1p-def44.5%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right|\right)}, x\right) \]
      2. rem-square-sqrt44.5%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right), x\right) \]
      3. fabs-sqr44.5%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right), x\right) \]
      4. rem-square-sqrt44.5%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{x}\right), x\right) \]
    4. Simplified44.5%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]

Alternative 15: 53.0% accurate, 3.8× speedup?

\[\begin{array}{l} \\ \mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right) \end{array} \]
(FPCore (x) :precision binary32 (copysign (* 0.3333333333333333 (* x 3.0)) x))
float code(float x) {
	return copysignf((0.3333333333333333f * (x * 3.0f)), x);
}
function code(x)
	return copysign(Float32(Float32(0.3333333333333333) * Float32(x * Float32(3.0))), x)
end
function tmp = code(x)
	tmp = sign(x) * abs((single(0.3333333333333333) * (x * single(3.0))));
end
\begin{array}{l}

\\
\mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right)
\end{array}
Derivation
  1. Initial program 36.4%

    \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
  2. Step-by-step derivation
    1. add-cbrt-cube30.2%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
    2. pow1/330.1%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
    3. log-pow30.1%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
    4. pow330.0%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
    5. log-pow36.2%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
    6. +-commutative36.2%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
    7. hypot-1-def62.5%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
    8. add-sqr-sqrt32.1%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    9. fabs-sqr32.1%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    10. add-sqr-sqrt40.5%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
  3. Applied egg-rr40.5%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
  4. Taylor expanded in x around 0 51.7%

    \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \color{blue}{x}\right), x\right) \]
  5. Final simplification51.7%

    \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(x \cdot 3\right), x\right) \]

Alternative 16: 18.8% accurate, 3.9× speedup?

\[\begin{array}{l} \\ \mathsf{copysign}\left(0.3333333333333333 \cdot \left(-x\right), x\right) \end{array} \]
(FPCore (x) :precision binary32 (copysign (* 0.3333333333333333 (- x)) x))
float code(float x) {
	return copysignf((0.3333333333333333f * -x), x);
}
function code(x)
	return copysign(Float32(Float32(0.3333333333333333) * Float32(-x)), x)
end
function tmp = code(x)
	tmp = sign(x) * abs((single(0.3333333333333333) * -x));
end
\begin{array}{l}

\\
\mathsf{copysign}\left(0.3333333333333333 \cdot \left(-x\right), x\right)
\end{array}
Derivation
  1. Initial program 36.4%

    \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
  2. Step-by-step derivation
    1. add-cbrt-cube30.2%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\sqrt[3]{\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}\right)}, x\right) \]
    2. pow1/330.1%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left({\left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}^{0.3333333333333333}\right)}, x\right) \]
    3. log-pow30.1%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \log \left(\left(\left(\left|x\right| + \sqrt{x \cdot x + 1}\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right) \cdot \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
    4. pow330.0%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \log \color{blue}{\left({\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)}^{3}\right)}, x\right) \]
    5. log-pow36.2%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot \log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right)\right)}, x\right) \]
    6. +-commutative36.2%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right)\right), x\right) \]
    7. hypot-1-def62.5%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right)\right), x\right) \]
    8. add-sqr-sqrt32.1%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    9. fabs-sqr32.1%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
    10. add-sqr-sqrt40.5%

      \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(3 \cdot \log \left(\color{blue}{x} + \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
  3. Applied egg-rr40.5%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{0.3333333333333333 \cdot \left(3 \cdot \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
  4. Taylor expanded in x around 0 51.7%

    \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(3 \cdot x\right)}, x\right) \]
  5. Simplified18.3%

    \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \color{blue}{\left(-x\right)}, x\right) \]
  6. Final simplification18.3%

    \[\leadsto \mathsf{copysign}\left(0.3333333333333333 \cdot \left(-x\right), x\right) \]

Developer target: 99.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\left|x\right|}\\ \mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t_0\right) + t_0}\right), x\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (/ 1.0 (fabs x))))
   (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
float code(float x) {
	float t_0 = 1.0f / fabsf(x);
	return copysignf(log1pf((fabsf(x) + (fabsf(x) / (hypotf(1.0f, t_0) + t_0)))), x);
}
function code(x)
	t_0 = Float32(Float32(1.0) / abs(x))
	return copysign(log1p(Float32(abs(x) + Float32(abs(x) / Float32(hypot(Float32(1.0), t_0) + t_0)))), x)
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t_0\right) + t_0}\right), x\right)
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023292 
(FPCore (x)
  :name "Rust f32::asinh"
  :precision binary32

  :herbie-target
  (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)

  (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))