Rust f32::asinh

Percentage Accurate: 38.0% → 99.4%
Time: 8.9s
Alternatives: 17
Speedup: 3.6×

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 17 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: 38.0% 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: 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 -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + \left(-0.16666666666666666 \cdot {x}^{3} + \left(-0.044642857142857144 \cdot {x}^{7} + 0.075 \cdot {x}^{5}\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 -1.0)
     (copysign (- (log (- (hypot 1.0 x) x))) x)
     (if (<= t_0 0.05000000074505806)
       (copysign
        (+
         x
         (+
          (* -0.16666666666666666 (pow x 3.0))
          (+ (* -0.044642857142857144 (pow x 7.0)) (* 0.075 (pow x 5.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 <= -1.0f) {
		tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	} else if (t_0 <= 0.05000000074505806f) {
		tmp = copysignf((x + ((-0.16666666666666666f * powf(x, 3.0f)) + ((-0.044642857142857144f * powf(x, 7.0f)) + (0.075f * powf(x, 5.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(-1.0))
		tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x);
	elseif (t_0 <= Float32(0.05000000074505806))
		tmp = copysign(Float32(x + Float32(Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0))) + Float32(Float32(Float32(-0.044642857142857144) * (x ^ Float32(7.0))) + Float32(Float32(0.075) * (x ^ Float32(5.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(-1.0))
		tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x)));
	elseif (t_0 <= single(0.05000000074505806))
		tmp = sign(x) * abs((x + ((single(-0.16666666666666666) * (x ^ single(3.0))) + ((single(-0.044642857142857144) * (x ^ single(7.0))) + (single(0.075) * (x ^ single(5.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 -1:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + \left(-0.16666666666666666 \cdot {x}^{3} + \left(-0.044642857142857144 \cdot {x}^{7} + 0.075 \cdot {x}^{5}\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) < -1

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+7.4%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left(\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(\left|x\right| - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    6. Applied egg-rr11.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left({x}^{2} - \mathsf{fma}\left(x, x, 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. sub-neg11.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left({x}^{2} + \left(-\mathsf{fma}\left(x, x, 1\right)\right)\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      2. sub-neg11.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left({x}^{2} - \mathsf{fma}\left(x, x, 1\right)\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      3. fma-udef11.8%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\left({x}^{2} - \left(\color{blue}{{x}^{2}} + 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      5. associate--r+46.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left(\left({x}^{2} - {x}^{2}\right) - 1\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      6. +-inverses100.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. neg-sub0100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
      11. sub-neg100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-\color{blue}{\left(x + \left(-\mathsf{hypot}\left(1, x\right)\right)\right)}\right), x\right) \]
      12. +-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-\color{blue}{\left(\left(-\mathsf{hypot}\left(1, x\right)\right) + x\right)}\right), x\right) \]
      13. distribute-neg-in100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \color{blue}{\left(\left(-\left(-\mathsf{hypot}\left(1, x\right)\right)\right) + \left(-x\right)\right)}, x\right) \]
      14. remove-double-neg100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\color{blue}{\mathsf{hypot}\left(1, x\right)} + \left(-x\right)\right), x\right) \]
      15. sub-neg100.0%

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

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

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

    1. Initial program 21.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt20.9%

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

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

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

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

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

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

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

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

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

    1. Initial program 61.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr100.0%

        \[\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-sqrt100.0%

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

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

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

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

      \[\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 simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + \left(-0.16666666666666666 \cdot {x}^{3} + \left(-0.044642857142857144 \cdot {x}^{7} + 0.075 \cdot {x}^{5}\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.3% 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 -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\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 -1.0)
     (copysign (- (log (- (hypot 1.0 x) x))) x)
     (if (<= t_0 0.05000000074505806)
       (copysign
        (+ x (+ (* -0.16666666666666666 (pow x 3.0)) (* 0.075 (pow x 5.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 <= -1.0f) {
		tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	} else if (t_0 <= 0.05000000074505806f) {
		tmp = copysignf((x + ((-0.16666666666666666f * powf(x, 3.0f)) + (0.075f * powf(x, 5.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(-1.0))
		tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x);
	elseif (t_0 <= Float32(0.05000000074505806))
		tmp = copysign(Float32(x + Float32(Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0))) + Float32(Float32(0.075) * (x ^ Float32(5.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(-1.0))
		tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x)));
	elseif (t_0 <= single(0.05000000074505806))
		tmp = sign(x) * abs((x + ((single(-0.16666666666666666) * (x ^ single(3.0))) + (single(0.075) * (x ^ single(5.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 -1:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\

\mathbf{elif}\;t_0 \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\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) < -1

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+7.4%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left(\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(\left|x\right| - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    6. Applied egg-rr11.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left({x}^{2} - \mathsf{fma}\left(x, x, 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. sub-neg11.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left({x}^{2} + \left(-\mathsf{fma}\left(x, x, 1\right)\right)\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      2. sub-neg11.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left({x}^{2} - \mathsf{fma}\left(x, x, 1\right)\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      3. fma-udef11.8%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\left({x}^{2} - \left(\color{blue}{{x}^{2}} + 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      5. associate--r+46.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left(\left({x}^{2} - {x}^{2}\right) - 1\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      6. +-inverses100.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. neg-sub0100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
      11. sub-neg100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-\color{blue}{\left(x + \left(-\mathsf{hypot}\left(1, x\right)\right)\right)}\right), x\right) \]
      12. +-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-\color{blue}{\left(\left(-\mathsf{hypot}\left(1, x\right)\right) + x\right)}\right), x\right) \]
      13. distribute-neg-in100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \color{blue}{\left(\left(-\left(-\mathsf{hypot}\left(1, x\right)\right)\right) + \left(-x\right)\right)}, x\right) \]
      14. remove-double-neg100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\color{blue}{\mathsf{hypot}\left(1, x\right)} + \left(-x\right)\right), x\right) \]
      15. sub-neg100.0%

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

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

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

    1. Initial program 21.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt20.9%

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

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

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

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

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

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

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

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

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

    1. Initial program 61.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr100.0%

        \[\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-sqrt100.0%

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

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

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

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

      \[\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 simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + \left(-0.16666666666666666 \cdot {x}^{3} + 0.075 \cdot {x}^{5}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 -1.0)
   (copysign (log (- (fabs x) x)) x)
   (if (<= x 0.05000000074505806)
     (copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
     (copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
	float tmp;
	if (x <= -1.0f) {
		tmp = copysignf(logf((fabsf(x) - x)), x);
	} else if (x <= 0.05000000074505806f) {
		tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-1.0))
		tmp = copysign(log(Float32(abs(x) - x)), x);
	elseif (x <= Float32(0.05000000074505806))
		tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (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)
	tmp = single(0.0);
	if (x <= single(-1.0))
		tmp = sign(x) * abs(log((abs(x) - x)));
	elseif (x <= single(0.05000000074505806))
		tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (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}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\

\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 < -1

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around -inf 97.7%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left|x\right| + -1 \cdot x\right)}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-neg97.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\left(-x\right)}\right), x\right) \]
      2. unsub-neg97.7%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left|x\right| - x\right)}, x\right) \]
    7. Simplified97.7%

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

    if -1 < x < 0.0500000007

    1. Initial program 21.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt20.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{{x}^{3} \cdot -0.16666666666666666}, x\right) \]
    9. Simplified99.6%

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

    if 0.0500000007 < x

    1. Initial program 61.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr100.0%

        \[\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-sqrt100.0%

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

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

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

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

      \[\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}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 99.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 -0.10000000149011612)
   (copysign (- (log (- (hypot 1.0 x) x))) x)
   (if (<= x 0.05000000074505806)
     (copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
     (copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
	float tmp;
	if (x <= -0.10000000149011612f) {
		tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	} else if (x <= 0.05000000074505806f) {
		tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-0.10000000149011612))
		tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x);
	elseif (x <= Float32(0.05000000074505806))
		tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (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)
	tmp = single(0.0);
	if (x <= single(-0.10000000149011612))
		tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x)));
	elseif (x <= single(0.05000000074505806))
		tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (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}
\mathbf{if}\;x \leq -0.10000000149011612:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\

\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 < -0.100000001

    1. Initial program 50.1%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+8.6%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
      2. frac-2neg8.6%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{-\left(\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)}{-\left(\left|x\right| - \mathsf{hypot}\left(1, x\right)\right)}\right)}, x\right) \]
      3. log-div8.6%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left(\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(\left|x\right| - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    6. Applied egg-rr13.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(-\left({x}^{2} - \mathsf{fma}\left(x, x, 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. sub-neg13.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left({x}^{2} + \left(-\mathsf{fma}\left(x, x, 1\right)\right)\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      2. sub-neg13.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left({x}^{2} - \mathsf{fma}\left(x, x, 1\right)\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      3. fma-udef13.0%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\left({x}^{2} - \left(\color{blue}{{x}^{2}} + 1\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      5. associate--r+46.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\left(\left({x}^{2} - {x}^{2}\right) - 1\right)}\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      6. +-inverses99.8%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right), x\right) \]
      10. neg-sub099.8%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)}, x\right) \]
      11. sub-neg99.8%

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-\color{blue}{\left(\left(-\mathsf{hypot}\left(1, x\right)\right) + x\right)}\right), x\right) \]
      13. distribute-neg-in99.8%

        \[\leadsto \mathsf{copysign}\left(-\log \color{blue}{\left(\left(-\left(-\mathsf{hypot}\left(1, x\right)\right)\right) + \left(-x\right)\right)}, x\right) \]
      14. remove-double-neg99.8%

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

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

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

    if -0.100000001 < x < 0.0500000007

    1. Initial program 20.9%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt20.3%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{{x}^{3} \cdot -0.16666666666666666}, x\right) \]
    9. Simplified99.8%

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

    if 0.0500000007 < x

    1. Initial program 61.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr100.0%

        \[\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-sqrt100.0%

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

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

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

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

      \[\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.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.03999999910593033:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-1}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 -0.03999999910593033)
   (copysign (log (/ -1.0 (- x (hypot 1.0 x)))) x)
   (if (<= x 0.05000000074505806)
     (copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
     (copysign (log (+ x (hypot 1.0 x))) x))))
float code(float x) {
	float tmp;
	if (x <= -0.03999999910593033f) {
		tmp = copysignf(logf((-1.0f / (x - hypotf(1.0f, x)))), x);
	} else if (x <= 0.05000000074505806f) {
		tmp = copysignf((x + (-0.16666666666666666f * powf(x, 3.0f))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-0.03999999910593033))
		tmp = copysign(log(Float32(Float32(-1.0) / Float32(x - hypot(Float32(1.0), x)))), x);
	elseif (x <= Float32(0.05000000074505806))
		tmp = copysign(Float32(x + Float32(Float32(-0.16666666666666666) * (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)
	tmp = single(0.0);
	if (x <= single(-0.03999999910593033))
		tmp = sign(x) * abs(log((single(-1.0) / (x - hypot(single(1.0), x)))));
	elseif (x <= single(0.05000000074505806))
		tmp = sign(x) * abs((x + (single(-0.16666666666666666) * (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}
\mathbf{if}\;x \leq -0.03999999910593033:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-1}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)\\

\mathbf{elif}\;x \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 < -0.0399999991

    1. Initial program 51.3%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+11.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
      2. div-sub10.7%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{{\left(\left|x\right|\right)}^{2}}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      4. add-sqr-sqrt-0.0%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      6. add-sqr-sqrt10.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{\color{blue}{x}}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      7. add-sqr-sqrt-0.0%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{x}^{2}}{\color{blue}{\sqrt{x} \cdot \sqrt{x}} - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      9. add-sqr-sqrt4.6%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{x}^{2}}{\color{blue}{x} - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    6. Applied egg-rr13.2%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{{x}^{2}}{x - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{fma}\left(x, x, 1\right)}{x - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
    7. Step-by-step derivation
      1. div-sub15.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{x - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
      2. fma-udef15.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{x}^{2} - \left(\color{blue}{{x}^{2}} + 1\right)}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      4. associate--r+48.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) - 1}}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      5. +-inverses99.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{0} - 1}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      6. metadata-eval99.5%

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

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

    if -0.0399999991 < x < 0.0500000007

    1. Initial program 19.8%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt19.2%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{{x}^{3} \cdot -0.16666666666666666}, x\right) \]
    9. Simplified100.0%

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

    if 0.0500000007 < x

    1. Initial program 61.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr100.0%

        \[\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-sqrt100.0%

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

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

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

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

      \[\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.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.03999999910593033:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-1}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)\\ \mathbf{elif}\;x \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 98.1% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around -inf 97.7%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left|x\right| + -1 \cdot x\right)}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-neg97.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\left(-x\right)}\right), x\right) \]
      2. unsub-neg97.7%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left|x\right| - x\right)}, x\right) \]
    7. Simplified97.7%

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

    if -1 < x < 1

    1. Initial program 22.2%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt21.5%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{{x}^{3} \cdot -0.16666666666666666}, x\right) \]
    9. Simplified99.2%

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.9%

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

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

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

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

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

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

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

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

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

Alternative 7: 98.2% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr-0.0%

        \[\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-sqrt12.9%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around -inf 97.7%

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

    if -1 < x < 1

    1. Initial program 22.2%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt21.5%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{{x}^{3} \cdot -0.16666666666666666}, x\right) \]
    9. Simplified99.2%

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.9%

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

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

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

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

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

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

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

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

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

Alternative 8: 98.1% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr-0.0%

        \[\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-sqrt12.9%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around -inf 97.7%

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

    if -1 < x < 1

    1. Initial program 22.2%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt21.5%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.2%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{{x}^{3} \cdot -0.16666666666666666}, x\right) \]
    9. Simplified99.2%

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
    8. Taylor expanded in x around 0 99.0%

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

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

Alternative 9: 84.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -20:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -20.0)
   (copysign (log (- x)) x)
   (if (<= x 1.0) (copysign x x) (copysign (log (+ x x)) x))))
float code(float x) {
	float tmp;
	if (x <= -20.0f) {
		tmp = copysignf(logf(-x), x);
	} else if (x <= 1.0f) {
		tmp = copysignf(x, x);
	} else {
		tmp = copysignf(logf((x + x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-20.0))
		tmp = copysign(log(Float32(-x)), x);
	elseif (x <= Float32(1.0))
		tmp = copysign(x, 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(-20.0))
		tmp = sign(x) * abs(log(-x));
	elseif (x <= single(1.0))
		tmp = sign(x) * abs(x);
	else
		tmp = sign(x) * abs(log((x + x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, 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 < -20

    1. Initial program 48.7%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around -inf 44.7%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-1 \cdot x\right)}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-neg44.7%

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

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

    if -20 < x < 1

    1. Initial program 22.8%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt22.2%

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -20:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 97.2% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, 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 < -1

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr-0.0%

        \[\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-sqrt12.9%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around -inf 97.7%

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

    if -1 < x < 1

    1. Initial program 22.2%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt21.5%

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 97.3% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\

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


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

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right) + \log 1}, x\right) \]
      4. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 \cdot \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)} + \log 1, x\right) \]
      5. *-un-lft-identity100.0%

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

        \[\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-sqr-0.0%

        \[\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-sqrt12.9%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(x + \mathsf{hypot}\left(1, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around -inf 97.7%

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

    if -1 < x < 1

    1. Initial program 22.2%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt21.5%

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 99.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
    8. Taylor expanded in x around 0 99.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 66.9% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\

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


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

    1. Initial program 48.7%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 5.9%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
    8. Taylor expanded in x around 0 -0.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log 0.5 + \left(-8 \cdot {x}^{4} + \left(-1 \cdot \log x + \left(4 \cdot {x}^{2} + 21.333333333333332 \cdot {x}^{6}\right)\right)\right)}, x\right) \]
    9. Simplified26.5%

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

    if -20 < x < 1

    1. Initial program 22.8%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt22.2%

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 61.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 43.9%

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

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

        \[\leadsto \mathsf{copysign}\left(-\color{blue}{\left(-\log x\right)}, x\right) \]
      3. remove-double-neg43.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log x}, x\right) \]
    7. Simplified43.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -20:\\ \;\;\;\;\mathsf{copysign}\left(14.333333333333334, x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log x, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 69.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\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 -1.0) (copysign (log (- x)) x) (copysign (log1p x) x)))
float code(float x) {
	float tmp;
	if (x <= -1.0f) {
		tmp = copysignf(logf(-x), x);
	} else {
		tmp = copysignf(log1pf(x), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-1.0))
		tmp = copysign(log(Float32(-x)), x);
	else
		tmp = copysign(log1p(x), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\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 < -1

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around -inf 44.4%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-1 \cdot x\right)}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-neg44.4%

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

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

    if -1 < x

    1. Initial program 36.7%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 27.7%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{x}\right), x\right) \]
    7. Simplified74.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 65.1% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(14.333333333333334, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -1.0) (copysign 14.333333333333334 x) (copysign (log1p x) x)))
float code(float x) {
	float tmp;
	if (x <= -1.0f) {
		tmp = copysignf(14.333333333333334f, x);
	} else {
		tmp = copysignf(log1pf(x), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-1.0))
		tmp = copysign(Float32(14.333333333333334), x);
	else
		tmp = copysign(log1p(x), x);
	end
	return tmp
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(14.333333333333334, 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 < -1

    1. Initial program 49.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 5.8%

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
    8. Taylor expanded in x around 0 -0.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log 0.5 + \left(-8 \cdot {x}^{4} + \left(-1 \cdot \log x + \left(4 \cdot {x}^{2} + 21.333333333333332 \cdot {x}^{6}\right)\right)\right)}, x\right) \]
    9. Simplified26.4%

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

    if -1 < x

    1. Initial program 36.7%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 27.7%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{x}\right), x\right) \]
    7. Simplified74.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\mathsf{copysign}\left(14.333333333333334, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 62.8% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -20 \lor \neg \left(x \leq 20\right):\\ \;\;\;\;\mathsf{copysign}\left(14.333333333333334, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (or (<= x -20.0) (not (<= x 20.0)))
   (copysign 14.333333333333334 x)
   (copysign x x)))
float code(float x) {
	float tmp;
	if ((x <= -20.0f) || !(x <= 20.0f)) {
		tmp = copysignf(14.333333333333334f, x);
	} else {
		tmp = copysignf(x, x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if ((x <= Float32(-20.0)) || !(x <= Float32(20.0)))
		tmp = copysign(Float32(14.333333333333334), x);
	else
		tmp = copysign(x, x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if ((x <= single(-20.0)) || ~((x <= single(20.0))))
		tmp = sign(x) * abs(single(14.333333333333334));
	else
		tmp = sign(x) * abs(x);
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -20 \lor \neg \left(x \leq 20\right):\\
\;\;\;\;\mathsf{copysign}\left(14.333333333333334, x\right)\\

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


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

    1. Initial program 55.0%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 56.1%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x + \left(\left|x\right| + 0.5 \cdot \frac{1}{x}\right)\right)}, x\right) \]
    6. Step-by-step derivation
      1. rem-square-sqrt53.4%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
    8. Taylor expanded in x around 0 1.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log 0.5 + \left(-8 \cdot {x}^{4} + \left(-1 \cdot \log x + \left(4 \cdot {x}^{2} + 21.333333333333332 \cdot {x}^{6}\right)\right)\right)}, x\right) \]
    9. Simplified27.4%

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

    if -20 < x < 20

    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. +-commutative23.4%

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. add-cube-cbrt22.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -20 \lor \neg \left(x \leq 20\right):\\ \;\;\;\;\mathsf{copysign}\left(14.333333333333334, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 17.5% accurate, 4.0× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 31.9%

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
  8. Taylor expanded in x around 0 3.7%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{\log 0.5 + \left(-8 \cdot {x}^{4} + \left(-1 \cdot \log x + 4 \cdot {x}^{2}\right)\right)}, x\right) \]
  9. Simplified18.0%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{-7}, x\right) \]
  10. Final simplification18.0%

    \[\leadsto \mathsf{copysign}\left(-7, x\right) \]
  11. Add Preprocessing

Alternative 17: 18.4% accurate, 4.0× speedup?

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

\\
\mathsf{copysign}\left(14.333333333333334, x\right)
\end{array}
Derivation
  1. Initial program 39.8%

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

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

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

    \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 31.9%

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(x + x\right) + \frac{0.5}{x}\right)}, x\right) \]
  8. Taylor expanded in x around 0 3.1%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{\log 0.5 + \left(-8 \cdot {x}^{4} + \left(-1 \cdot \log x + \left(4 \cdot {x}^{2} + 21.333333333333332 \cdot {x}^{6}\right)\right)\right)}, x\right) \]
  9. Simplified19.0%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{14.333333333333334}, x\right) \]
  10. Final simplification19.0%

    \[\leadsto \mathsf{copysign}\left(14.333333333333334, x\right) \]
  11. Add Preprocessing

Developer target: 99.6% 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 2024026 
(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))