Rust f32::asinh

Percentage Accurate: 37.9% → 99.4%
Time: 7.8s
Alternatives: 14
Speedup: 4.0×

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 14 alternatives:

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

Initial Program: 37.9% 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.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 -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(\left(\mathsf{hypot}\left(1, x\right) - x\right) + -1\right), x\right)\\ \mathbf{elif}\;t_0 \leq 0.10000000149011612:\\ \;\;\;\;\mathsf{copysign}\left(x + \left(0.075 \cdot {x}^{5} + -0.16666666666666666 \cdot {x}^{3}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(1 + \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) + -1\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
   (if (<= t_0 -0.4000000059604645)
     (copysign (- (log1p (+ (- (hypot 1.0 x) x) -1.0))) x)
     (if (<= t_0 0.10000000149011612)
       (copysign
        (+ x (+ (* 0.075 (pow x 5.0)) (* -0.16666666666666666 (pow x 3.0))))
        x)
       (copysign (log (+ (+ 1.0 (+ x (hypot 1.0 x))) -1.0)) x)))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float tmp;
	if (t_0 <= -0.4000000059604645f) {
		tmp = copysignf(-log1pf(((hypotf(1.0f, x) - x) + -1.0f)), x);
	} else if (t_0 <= 0.10000000149011612f) {
		tmp = copysignf((x + ((0.075f * powf(x, 5.0f)) + (-0.16666666666666666f * powf(x, 3.0f)))), x);
	} else {
		tmp = copysignf(logf(((1.0f + (x + hypotf(1.0f, x))) + -1.0f)), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.4000000059604645))
		tmp = copysign(Float32(-log1p(Float32(Float32(hypot(Float32(1.0), x) - x) + Float32(-1.0)))), x);
	elseif (t_0 <= Float32(0.10000000149011612))
		tmp = copysign(Float32(x + Float32(Float32(Float32(0.075) * (x ^ Float32(5.0))) + Float32(Float32(-0.16666666666666666) * (x ^ Float32(3.0))))), x);
	else
		tmp = copysign(log(Float32(Float32(Float32(1.0) + Float32(x + hypot(Float32(1.0), x))) + Float32(-1.0))), x);
	end
	return tmp
end
\begin{array}{l}

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

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

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


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

    1. Initial program 50.2%

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

        \[\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-+6.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. frac-2neg6.0%

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

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

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

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

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

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

        \[\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. +-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) \]
    9. Step-by-step derivation
      1. log1p-expm1-u100.0%

        \[\leadsto \mathsf{copysign}\left(-\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\right)\right)}, x\right) \]
      2. expm1-udef100.0%

        \[\leadsto \mathsf{copysign}\left(-\mathsf{log1p}\left(\color{blue}{e^{\log \left(\mathsf{hypot}\left(1, x\right) - x\right)} - 1}\right), x\right) \]
      3. add-exp-log100.0%

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

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

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

    1. Initial program 18.4%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified18.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-sqr-sqrt17.8%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{2 \cdot \log \left(\sqrt{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.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x)

    1. Initial program 59.6%

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

        \[\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. Step-by-step derivation
      1. expm1-log1p-u99.8%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(e^{\color{blue}{\log \left(1 + \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)}} - 1\right), x\right) \]
      4. rem-exp-log100.0%

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(\left(\mathsf{hypot}\left(1, x\right) - x\right) + -1\right), x\right)\\

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

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


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

    1. Initial program 50.2%

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

        \[\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-+6.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. frac-2neg6.0%

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

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

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

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

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

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

        \[\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. +-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) \]
    9. Step-by-step derivation
      1. log1p-expm1-u100.0%

        \[\leadsto \mathsf{copysign}\left(-\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\right)\right)}, x\right) \]
      2. expm1-udef100.0%

        \[\leadsto \mathsf{copysign}\left(-\mathsf{log1p}\left(\color{blue}{e^{\log \left(\mathsf{hypot}\left(1, x\right) - x\right)} - 1}\right), x\right) \]
      3. add-exp-log100.0%

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

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

    if -0.400000006 < x < 0.00200000009

    1. Initial program 17.8%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified17.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. add-sqr-sqrt17.2%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{2 \cdot \log \left(\sqrt{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.00200000009 < x

    1. Initial program 60.1%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified99.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. expm1-log1p-u99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(e^{\color{blue}{\log \left(1 + \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)\right)}} - 1\right), x\right) \]
      4. rem-exp-log99.8%

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

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

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

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

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

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

Alternative 3: 98.7% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 - \frac{0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.0020000000949949026:\\ \;\;\;\;\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 -2.0)
   (copysign (- (log (- (* x -2.0) (/ 0.5 x)))) x)
   (if (<= x 0.0020000000949949026)
     (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 <= -2.0f) {
		tmp = copysignf(-logf(((x * -2.0f) - (0.5f / x))), x);
	} else if (x <= 0.0020000000949949026f) {
		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(-2.0))
		tmp = copysign(Float32(-log(Float32(Float32(x * Float32(-2.0)) - Float32(Float32(0.5) / x)))), x);
	elseif (x <= Float32(0.0020000000949949026))
		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(-2.0))
		tmp = sign(x) * abs(-log(((x * single(-2.0)) - (single(0.5) / x))));
	elseif (x <= single(0.0020000000949949026))
		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 -2:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 - \frac{0.5}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.0020000000949949026:\\
\;\;\;\;\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 < -2

    1. Initial program 48.9%

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

        \[\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-+3.7%

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

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

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

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

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

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

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

        \[\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+45.3%

        \[\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) \]
    9. Taylor expanded in x around -inf 99.5%

      \[\leadsto \mathsf{copysign}\left(-\log \color{blue}{\left(-2 \cdot x - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    10. Step-by-step derivation
      1. *-commutative99.5%

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot -2 - \frac{\color{blue}{0.5}}{x}\right), x\right) \]
    11. Simplified99.5%

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

    if -2 < x < 0.00200000009

    1. Initial program 19.1%

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

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

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

      \[\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-sqr-sqrt18.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.00200000009 < x

    1. Initial program 60.1%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified99.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. *-un-lft-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 - \frac{0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.0020000000949949026:\\ \;\;\;\;\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.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.0020000000949949026:\\ \;\;\;\;\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.4000000059604645)
   (copysign (- (log (- (hypot 1.0 x) x))) x)
   (if (<= x 0.0020000000949949026)
     (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.4000000059604645f) {
		tmp = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	} else if (x <= 0.0020000000949949026f) {
		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.4000000059604645))
		tmp = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x);
	elseif (x <= Float32(0.0020000000949949026))
		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.4000000059604645))
		tmp = sign(x) * abs(-log((hypot(single(1.0), x) - x)));
	elseif (x <= single(0.0020000000949949026))
		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.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\

\mathbf{elif}\;x \leq 0.0020000000949949026:\\
\;\;\;\;\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.400000006

    1. Initial program 50.2%

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

        \[\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-+6.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. frac-2neg6.0%

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

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

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

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

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

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

        \[\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. +-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 -0.400000006 < x < 0.00200000009

    1. Initial program 17.8%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified17.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. add-sqr-sqrt17.2%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{2 \cdot \log \left(\sqrt{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.00200000009 < x

    1. Initial program 60.1%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified99.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. *-un-lft-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;x \leq 0.0020000000949949026:\\ \;\;\;\;\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.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(\left(\mathsf{hypot}\left(1, x\right) - x\right) + -1\right), x\right)\\ \mathbf{elif}\;x \leq 0.0020000000949949026:\\ \;\;\;\;\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.4000000059604645)
   (copysign (- (log1p (+ (- (hypot 1.0 x) x) -1.0))) x)
   (if (<= x 0.0020000000949949026)
     (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.4000000059604645f) {
		tmp = copysignf(-log1pf(((hypotf(1.0f, x) - x) + -1.0f)), x);
	} else if (x <= 0.0020000000949949026f) {
		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.4000000059604645))
		tmp = copysign(Float32(-log1p(Float32(Float32(hypot(Float32(1.0), x) - x) + Float32(-1.0)))), x);
	elseif (x <= Float32(0.0020000000949949026))
		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
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.4000000059604645:\\
\;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(\left(\mathsf{hypot}\left(1, x\right) - x\right) + -1\right), x\right)\\

\mathbf{elif}\;x \leq 0.0020000000949949026:\\
\;\;\;\;\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.400000006

    1. Initial program 50.2%

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

        \[\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-+6.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. frac-2neg6.0%

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

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

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

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

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

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

        \[\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. +-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) \]
    9. Step-by-step derivation
      1. log1p-expm1-u100.0%

        \[\leadsto \mathsf{copysign}\left(-\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\right)\right)}, x\right) \]
      2. expm1-udef100.0%

        \[\leadsto \mathsf{copysign}\left(-\mathsf{log1p}\left(\color{blue}{e^{\log \left(\mathsf{hypot}\left(1, x\right) - x\right)} - 1}\right), x\right) \]
      3. add-exp-log100.0%

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

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

    if -0.400000006 < x < 0.00200000009

    1. Initial program 17.8%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified17.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. add-sqr-sqrt17.2%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{2 \cdot \log \left(\sqrt{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.00200000009 < x

    1. Initial program 60.1%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified99.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. *-un-lft-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.4000000059604645:\\ \;\;\;\;\mathsf{copysign}\left(-\mathsf{log1p}\left(\left(\mathsf{hypot}\left(1, x\right) - x\right) + -1\right), x\right)\\ \mathbf{elif}\;x \leq 0.0020000000949949026:\\ \;\;\;\;\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.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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} + \left(x + x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -2.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 x))) x))))
float code(float x) {
	float tmp;
	if (x <= -2.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 + x))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-2.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(Float32(0.5) / x) + Float32(x + x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-2.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) + (x + x))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\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} + \left(x + x\right)\right), x\right)\\


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

    1. Initial program 48.9%

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

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

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

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

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

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

      \[\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 98.8%

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

    if -2 < x < 1

    1. Initial program 20.3%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified20.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. Step-by-step derivation
      1. add-sqr-sqrt19.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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 98.6%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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} + \left(x + x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.3% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 - \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} + \left(x + x\right)\right), x\right)\\


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

    1. Initial program 48.9%

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

        \[\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-+3.7%

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

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

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

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

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

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

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

        \[\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+45.3%

        \[\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) \]
    9. Taylor expanded in x around -inf 99.5%

      \[\leadsto \mathsf{copysign}\left(-\log \color{blue}{\left(-2 \cdot x - 0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    10. Step-by-step derivation
      1. *-commutative99.5%

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot -2 - \frac{\color{blue}{0.5}}{x}\right), x\right) \]
    11. Simplified99.5%

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

    if -2 < x < 1

    1. Initial program 20.3%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified20.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. Step-by-step derivation
      1. add-sqr-sqrt19.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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 98.6%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(x \cdot -2 - \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} + \left(x + x\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 98.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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 -2.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 <= -2.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(-2.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(Float32(-log(Float32(Float32(0.5) / x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-2.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 -2:\\
\;\;\;\;\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 < -2

    1. Initial program 48.9%

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

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

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

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

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

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

      \[\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 98.8%

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

    if -2 < x < 1

    1. Initial program 20.3%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified20.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. Step-by-step derivation
      1. add-sqr-sqrt19.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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. Step-by-step derivation
      1. flip-+10.9%

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

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

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

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

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

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

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

        \[\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+13.4%

        \[\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. +-inverses16.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)}, x\right) \]
    9. Taylor expanded in x around inf 96.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.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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: 97.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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 -2.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 <= -2.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(-2.0))
		tmp = copysign(log(Float32(Float32(-0.5) / x)), x);
	elseif (x <= Float32(1.0))
		tmp = copysign(x, x);
	else
		tmp = copysign(Float32(-log(Float32(Float32(0.5) / x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = single(0.0);
	if (x <= single(-2.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 -2:\\
\;\;\;\;\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 < -2

    1. Initial program 48.9%

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

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

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

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

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

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

      \[\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 98.8%

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

    if -2 < x < 1

    1. Initial program 20.3%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified20.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. Step-by-step derivation
      1. add-sqr-sqrt19.7%

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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. Step-by-step derivation
      1. flip-+10.9%

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

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

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

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

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

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

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

        \[\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+13.4%

        \[\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. +-inverses16.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)}, x\right) \]
    9. Taylor expanded in x around inf 96.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.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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 10: 83.8% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\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 -50.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 <= -50.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(-50.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(-50.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 -50:\\
\;\;\;\;\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 < -50

    1. Initial program 48.2%

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

        \[\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 45.2%

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

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

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

    if -50 < x < 1

    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.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified21.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-sqr-sqrt20.4%

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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 96.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\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 11: 97.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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 -2.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 <= -2.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(-2.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(-2.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 -2:\\
\;\;\;\;\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 < -2

    1. Initial program 48.9%

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

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

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

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

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

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

      \[\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 98.8%

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

    if -2 < x < 1

    1. Initial program 20.3%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified20.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. Step-by-step derivation
      1. add-sqr-sqrt19.7%

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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 96.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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 12: 69.1% accurate, 2.0× speedup?

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

    1. Initial program 48.9%

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

        \[\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 45.0%

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

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

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

    if -2 < x

    1. Initial program 32.5%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified45.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. Taylor expanded in x around 0 26.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\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 13: 62.6% accurate, 2.0× speedup?

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified50.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-sqr-sqrt50.0%

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 59.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative59.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 0 43.5%

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

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

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

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

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

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

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

Alternative 14: 54.6% accurate, 4.0× speedup?

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
  3. Simplified61.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-sqr-sqrt61.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\color{blue}{x}, x\right) \]
  8. Final simplification53.2%

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

Developer target: 99.4% 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 2024017 
(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))