Rust f32::asinh

Percentage Accurate: 38.5% → 99.4%
Time: 5.1s
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: 38.5% 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.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ t_1 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ t_2 := \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\ \mathbf{if}\;t\_0 \leq -0.20000000298023224:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left({x}^{2}, {x}^{2} \cdot \left(\frac{-0.125}{x + 1} + \frac{-0.125}{{\left(x + 1\right)}^{2}}\right) + \frac{0.5}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{elif}\;t\_0 \leq 0.30000001192092896:\\ \;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log t\_2\right) \cdot 0.3333333333333333}, x\right)\\ \mathbf{elif}\;t\_0 \leq 0.5:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 8:\\ \;\;\;\;\mathsf{copysign}\left(t\_2, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
        (t_1 (copysign (- (log (- (hypot 1.0 x) x))) x))
        (t_2 (log (+ x (hypot 1.0 x)))))
   (if (<= t_0 -0.20000000298023224)
     t_1
     (if (<= t_0 0.05000000074505806)
       (copysign
        (fma
         (pow x 2.0)
         (+
          (*
           (pow x 2.0)
           (+ (/ -0.125 (+ x 1.0)) (/ -0.125 (pow (+ x 1.0) 2.0))))
          (/ 0.5 (+ x 1.0)))
         (log1p x))
        x)
       (if (<= t_0 0.30000001192092896)
         (copysign (exp (* (* 3.0 (log t_2)) 0.3333333333333333)) x)
         (if (<= t_0 0.5)
           t_1
           (if (<= t_0 8.0)
             (copysign t_2 x)
             (copysign (log (* x (+ 1.0 (/ x x)))) x))))))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float t_1 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	float t_2 = logf((x + hypotf(1.0f, x)));
	float tmp;
	if (t_0 <= -0.20000000298023224f) {
		tmp = t_1;
	} else if (t_0 <= 0.05000000074505806f) {
		tmp = copysignf(fmaf(powf(x, 2.0f), ((powf(x, 2.0f) * ((-0.125f / (x + 1.0f)) + (-0.125f / powf((x + 1.0f), 2.0f)))) + (0.5f / (x + 1.0f))), log1pf(x)), x);
	} else if (t_0 <= 0.30000001192092896f) {
		tmp = copysignf(expf(((3.0f * logf(t_2)) * 0.3333333333333333f)), x);
	} else if (t_0 <= 0.5f) {
		tmp = t_1;
	} else if (t_0 <= 8.0f) {
		tmp = copysignf(t_2, x);
	} else {
		tmp = copysignf(logf((x * (1.0f + (x / x)))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	t_1 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x)
	t_2 = log(Float32(x + hypot(Float32(1.0), x)))
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.20000000298023224))
		tmp = t_1;
	elseif (t_0 <= Float32(0.05000000074505806))
		tmp = copysign(fma((x ^ Float32(2.0)), Float32(Float32((x ^ Float32(2.0)) * Float32(Float32(Float32(-0.125) / Float32(x + Float32(1.0))) + Float32(Float32(-0.125) / (Float32(x + Float32(1.0)) ^ Float32(2.0))))) + Float32(Float32(0.5) / Float32(x + Float32(1.0)))), log1p(x)), x);
	elseif (t_0 <= Float32(0.30000001192092896))
		tmp = copysign(exp(Float32(Float32(Float32(3.0) * log(t_2)) * Float32(0.3333333333333333))), x);
	elseif (t_0 <= Float32(0.5))
		tmp = t_1;
	elseif (t_0 <= Float32(8.0))
		tmp = copysign(t_2, x);
	else
		tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / x)))), x);
	end
	return tmp
end
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq 0.05000000074505806:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left({x}^{2}, {x}^{2} \cdot \left(\frac{-0.125}{x + 1} + \frac{-0.125}{{\left(x + 1\right)}^{2}}\right) + \frac{0.5}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\

\mathbf{elif}\;t\_0 \leq 0.30000001192092896:\\
\;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log t\_2\right) \cdot 0.3333333333333333}, x\right)\\

\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(t\_2, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.300000012 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5

    1. Initial program 55.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{\color{blue}{x \cdot 1}}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      9. associate-/l*9.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\mathsf{hypot}\left(1, x\right)}{\color{blue}{-1}}\right), x\right) \]
      17. *-rgt-identity100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\color{blue}{\mathsf{hypot}\left(1, x\right) \cdot 1}}{-1}\right), x\right) \]
      18. associate-/l*100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \color{blue}{-1 \cdot \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      21. neg-mul-1100.0%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \color{blue}{\left(-\mathsf{hypot}\left(1, x\right)\right)}\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.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.0500000007

    1. Initial program 16.4%

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

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

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

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

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

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

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

    if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.300000012

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{e^{\left(3 \cdot \log \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) \cdot 0.3333333333333333}}, x\right) \]

    if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x)

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot \left(1 + \frac{x}{x}\right)\right)}, x\right) \]
  3. Recombined 5 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.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left({x}^{2}, {x}^{2} \cdot \left(\frac{-0.125}{x + 1} + \frac{-0.125}{{\left(x + 1\right)}^{2}}\right) + \frac{0.5}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.30000001192092896:\\ \;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) \cdot 0.3333333333333333}, x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 8:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ t_1 := \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\ t_2 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{if}\;t\_0 \leq -0.20000000298023224:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{elif}\;t\_0 \leq 0.05000000074505806:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 0.30000001192092896:\\ \;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log t\_1\right) \cdot 0.3333333333333333}, x\right)\\ \mathbf{elif}\;t\_0 \leq 0.5:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 8:\\ \;\;\;\;\mathsf{copysign}\left(t\_1, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
        (t_1 (log (+ x (hypot 1.0 x))))
        (t_2 (copysign (- (log (- (hypot 1.0 x) x))) x)))
   (if (<= t_0 -0.20000000298023224)
     t_2
     (if (<= t_0 0.004999999888241291)
       (copysign (fma 0.5 (/ (pow x 2.0) (+ x 1.0)) (log1p x)) x)
       (if (<= t_0 0.05000000074505806)
         t_2
         (if (<= t_0 0.30000001192092896)
           (copysign (exp (* (* 3.0 (log t_1)) 0.3333333333333333)) x)
           (if (<= t_0 0.5)
             t_2
             (if (<= t_0 8.0)
               (copysign t_1 x)
               (copysign (log (* x (+ 1.0 (/ x x)))) x)))))))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float t_1 = logf((x + hypotf(1.0f, x)));
	float t_2 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	float tmp;
	if (t_0 <= -0.20000000298023224f) {
		tmp = t_2;
	} else if (t_0 <= 0.004999999888241291f) {
		tmp = copysignf(fmaf(0.5f, (powf(x, 2.0f) / (x + 1.0f)), log1pf(x)), x);
	} else if (t_0 <= 0.05000000074505806f) {
		tmp = t_2;
	} else if (t_0 <= 0.30000001192092896f) {
		tmp = copysignf(expf(((3.0f * logf(t_1)) * 0.3333333333333333f)), x);
	} else if (t_0 <= 0.5f) {
		tmp = t_2;
	} else if (t_0 <= 8.0f) {
		tmp = copysignf(t_1, x);
	} else {
		tmp = copysignf(logf((x * (1.0f + (x / x)))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	t_1 = log(Float32(x + hypot(Float32(1.0), x)))
	t_2 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.20000000298023224))
		tmp = t_2;
	elseif (t_0 <= Float32(0.004999999888241291))
		tmp = copysign(fma(Float32(0.5), Float32((x ^ Float32(2.0)) / Float32(x + Float32(1.0))), log1p(x)), x);
	elseif (t_0 <= Float32(0.05000000074505806))
		tmp = t_2;
	elseif (t_0 <= Float32(0.30000001192092896))
		tmp = copysign(exp(Float32(Float32(Float32(3.0) * log(t_1)) * Float32(0.3333333333333333))), x);
	elseif (t_0 <= Float32(0.5))
		tmp = t_2;
	elseif (t_0 <= Float32(8.0))
		tmp = copysign(t_1, x);
	else
		tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / x)))), x);
	end
	return tmp
end
\begin{array}{l}

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

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

\mathbf{elif}\;t\_0 \leq 0.05000000074505806:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_0 \leq 0.30000001192092896:\\
\;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log t\_1\right) \cdot 0.3333333333333333}, x\right)\\

\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(t\_1, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.0500000007 or 0.300000012 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5

    1. Initial program 56.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{x}{\color{blue}{-1}} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      8. *-rgt-identity11.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{\color{blue}{x \cdot 1}}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      9. associate-/l*11.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\color{blue}{x \cdot \frac{1}{-1}} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      10. metadata-eval11.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot \color{blue}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      11. *-commutative11.7%

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\mathsf{hypot}\left(1, x\right)}{\color{blue}{-1}}\right), x\right) \]
      17. *-rgt-identity99.8%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\color{blue}{\mathsf{hypot}\left(1, x\right) \cdot 1}}{-1}\right), x\right) \]
      18. associate-/l*99.8%

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \color{blue}{-1 \cdot \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      21. neg-mul-199.8%

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

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

    if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989

    1. Initial program 15.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0500000007 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.300000012

    1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{e^{\left(3 \cdot \log \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) \cdot 0.3333333333333333}}, x\right) \]

    if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x)

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -0.20000000298023224:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.004999999888241291:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(0.5, \frac{{x}^{2}}{x + 1}, \mathsf{log1p}\left(x\right)\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.05000000074505806:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.30000001192092896:\\ \;\;\;\;\mathsf{copysign}\left(e^{\left(3 \cdot \log \log \left(x + \mathsf{hypot}\left(1, x\right)\right)\right) \cdot 0.3333333333333333}, x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{elif}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq 8:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.1% accurate, 0.2× speedup?

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

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

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

\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5

    1. Initial program 57.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{x}{\color{blue}{-1}} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      8. *-rgt-identity12.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{\color{blue}{x \cdot 1}}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      9. associate-/l*12.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\color{blue}{x \cdot \frac{1}{-1}} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      10. metadata-eval12.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot \color{blue}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      11. *-commutative12.7%

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\mathsf{hypot}\left(1, x\right)}{\color{blue}{-1}}\right), x\right) \]
      17. *-rgt-identity99.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\color{blue}{\mathsf{hypot}\left(1, x\right) \cdot 1}}{-1}\right), x\right) \]
      18. associate-/l*99.7%

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \color{blue}{-1}\right), x\right) \]
      20. *-commutative99.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \color{blue}{-1 \cdot \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      21. neg-mul-199.7%

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

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

    if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989

    1. Initial program 15.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x)

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\ t_1 := \mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\ \mathbf{if}\;t\_0 \leq -0.20000000298023224:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{elif}\;t\_0 \leq 0.5:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 8:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(1 + \frac{x}{x}\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
        (t_1 (copysign (- (log (- (hypot 1.0 x) x))) x)))
   (if (<= t_0 -0.20000000298023224)
     t_1
     (if (<= t_0 0.004999999888241291)
       (copysign x x)
       (if (<= t_0 0.5)
         t_1
         (if (<= t_0 8.0)
           (copysign (log (+ x (hypot 1.0 x))) x)
           (copysign (log (* x (+ 1.0 (/ x x)))) x)))))))
float code(float x) {
	float t_0 = copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x);
	float t_1 = copysignf(-logf((hypotf(1.0f, x) - x)), x);
	float tmp;
	if (t_0 <= -0.20000000298023224f) {
		tmp = t_1;
	} else if (t_0 <= 0.004999999888241291f) {
		tmp = copysignf(x, x);
	} else if (t_0 <= 0.5f) {
		tmp = t_1;
	} else if (t_0 <= 8.0f) {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	} else {
		tmp = copysignf(logf((x * (1.0f + (x / x)))), x);
	}
	return tmp;
}
function code(x)
	t_0 = copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x)
	t_1 = copysign(Float32(-log(Float32(hypot(Float32(1.0), x) - x))), x)
	tmp = Float32(0.0)
	if (t_0 <= Float32(-0.20000000298023224))
		tmp = t_1;
	elseif (t_0 <= Float32(0.004999999888241291))
		tmp = copysign(x, x);
	elseif (t_0 <= Float32(0.5))
		tmp = t_1;
	elseif (t_0 <= Float32(8.0))
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	else
		tmp = copysign(log(Float32(x * Float32(Float32(1.0) + Float32(x / x)))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + single(1.0))))));
	t_1 = sign(x) * abs(-log((hypot(single(1.0), x) - x)));
	tmp = single(0.0);
	if (t_0 <= single(-0.20000000298023224))
		tmp = t_1;
	elseif (t_0 <= single(0.004999999888241291))
		tmp = sign(x) * abs(x);
	elseif (t_0 <= single(0.5))
		tmp = t_1;
	elseif (t_0 <= single(8.0))
		tmp = sign(x) * abs(log((x + hypot(single(1.0), x))));
	else
		tmp = sign(x) * abs(log((x * (single(1.0) + (x / x)))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

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

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

\mathbf{elif}\;t\_0 \leq 0.5:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 8:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < -0.200000003 or 0.00499999989 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.5

    1. Initial program 57.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{x}{\color{blue}{-1}} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      8. *-rgt-identity12.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\frac{\color{blue}{x \cdot 1}}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      9. associate-/l*12.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(\color{blue}{x \cdot \frac{1}{-1}} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      10. metadata-eval12.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot \color{blue}{-1} - \frac{\mathsf{hypot}\left(1, x\right)}{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}\right), x\right) \]
      11. *-commutative12.7%

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\mathsf{hypot}\left(1, x\right)}{\color{blue}{-1}}\right), x\right) \]
      17. *-rgt-identity99.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \frac{\color{blue}{\mathsf{hypot}\left(1, x\right) \cdot 1}}{-1}\right), x\right) \]
      18. associate-/l*99.7%

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \color{blue}{-1}\right), x\right) \]
      20. *-commutative99.7%

        \[\leadsto \mathsf{copysign}\left(-\log \left(-1 \cdot x - \color{blue}{-1 \cdot \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      21. neg-mul-199.7%

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

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

    if -0.200000003 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 0.00499999989

    1. Initial program 15.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 99.9%

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

    if 0.5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x) < 8

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x)

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot \left(1 + \frac{x}{x}\right)\right)}, x\right) \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 5: 71.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(\frac{1}{x} + \log x, x\right)\\ \mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(1 + \log x, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -2.0)
   (copysign (log (- x)) x)
   (if (<= x 0.5)
     (copysign x x)
     (if (<= x 2.0)
       (copysign (+ (/ 1.0 x) (log x)) x)
       (if (or (<= x 6.0)
               (and (not (<= x 20.0))
                    (or (<= x 100.0)
                        (and (not (<= x 5000.0))
                             (or (<= x 10000000000.0)
                                 (and (not (<= x 499999997952.0))
                                      (or (<= x 19999999655936.0)
                                          (and (not (<= x 100000000376832.0))
                                               (or (<= x 499999993495552.0)
                                                   (and (not
                                                         (<=
                                                          x
                                                          30000000817692670.0))
                                                        (or (<=
                                                             x
                                                             199999996861349900.0)
                                                            (and (not
                                                                  (<=
                                                                   x
                                                                   499999992153374700.0))
                                                                 (or (<=
                                                                      x
                                                                      7.000000069917397e+21)
                                                                     (and (not
                                                                           (<=
                                                                            x
                                                                            5.0000001268882145e+25))
                                                                          (or (<=
                                                                               x
                                                                               9.999999884841548e+26)
                                                                              (and (not
                                                                                    (<=
                                                                                     x
                                                                                     1.4999999753475345e+28))
                                                                                   (or (<=
                                                                                        x
                                                                                        5.000000075237331e+28)
                                                                                       (and (not
                                                                                             (<=
                                                                                              x
                                                                                              4.000000060189865e+29))
                                                                                            (or (<=
                                                                                                 x
                                                                                                 2.000000066362707e+32)
                                                                                                (and (not
                                                                                                      (<=
                                                                                                       x
                                                                                                       4.9999999724786364e+32))
                                                                                                     (or (<=
                                                                                                          x
                                                                                                          4.999999895107384e+33)
                                                                                                         (and (not
                                                                                                               (<=
                                                                                                                x
                                                                                                                8.500000224013066e+33))
                                                                                                              (or (<=
                                                                                                                   x
                                                                                                                   1.2000000491021745e+35)
                                                                                                                  (and (not
                                                                                                                        (<=
                                                                                                                         x
                                                                                                                         2.0000000818369575e+35))
                                                                                                                       (<=
                                                                                                                        x
                                                                                                                        9.999999933815813e+36)))))))))))))))))))))))))
         (copysign (log (* x E)) x)
         (copysign (+ 1.0 (log x)) x))))))
float code(float x) {
	float tmp;
	if (x <= -2.0f) {
		tmp = copysignf(logf(-x), x);
	} else if (x <= 0.5f) {
		tmp = copysignf(x, x);
	} else if (x <= 2.0f) {
		tmp = copysignf(((1.0f / x) + logf(x)), x);
	} else if ((x <= 6.0f) || (!(x <= 20.0f) && ((x <= 100.0f) || (!(x <= 5000.0f) && ((x <= 10000000000.0f) || (!(x <= 499999997952.0f) && ((x <= 19999999655936.0f) || (!(x <= 100000000376832.0f) && ((x <= 499999993495552.0f) || (!(x <= 30000000817692670.0f) && ((x <= 199999996861349900.0f) || (!(x <= 499999992153374700.0f) && ((x <= 7.000000069917397e+21f) || (!(x <= 5.0000001268882145e+25f) && ((x <= 9.999999884841548e+26f) || (!(x <= 1.4999999753475345e+28f) && ((x <= 5.000000075237331e+28f) || (!(x <= 4.000000060189865e+29f) && ((x <= 2.000000066362707e+32f) || (!(x <= 4.9999999724786364e+32f) && ((x <= 4.999999895107384e+33f) || (!(x <= 8.500000224013066e+33f) && ((x <= 1.2000000491021745e+35f) || (!(x <= 2.0000000818369575e+35f) && (x <= 9.999999933815813e+36f))))))))))))))))))))))))) {
		tmp = copysignf(logf((x * ((float) M_E))), x);
	} else {
		tmp = copysignf((1.0f + logf(x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-2.0))
		tmp = copysign(log(Float32(-x)), x);
	elseif (x <= Float32(0.5))
		tmp = copysign(x, x);
	elseif (x <= Float32(2.0))
		tmp = copysign(Float32(Float32(Float32(1.0) / x) + log(x)), x);
	elseif ((x <= Float32(6.0)) || (!(x <= Float32(20.0)) && ((x <= Float32(100.0)) || (!(x <= Float32(5000.0)) && ((x <= Float32(10000000000.0)) || (!(x <= Float32(499999997952.0)) && ((x <= Float32(19999999655936.0)) || (!(x <= Float32(100000000376832.0)) && ((x <= Float32(499999993495552.0)) || (!(x <= Float32(30000000817692670.0)) && ((x <= Float32(199999996861349900.0)) || (!(x <= Float32(499999992153374700.0)) && ((x <= Float32(7.000000069917397e+21)) || (!(x <= Float32(5.0000001268882145e+25)) && ((x <= Float32(9.999999884841548e+26)) || (!(x <= Float32(1.4999999753475345e+28)) && ((x <= Float32(5.000000075237331e+28)) || (!(x <= Float32(4.000000060189865e+29)) && ((x <= Float32(2.000000066362707e+32)) || (!(x <= Float32(4.9999999724786364e+32)) && ((x <= Float32(4.999999895107384e+33)) || (!(x <= Float32(8.500000224013066e+33)) && ((x <= Float32(1.2000000491021745e+35)) || (!(x <= Float32(2.0000000818369575e+35)) && (x <= Float32(9.999999933815813e+36))))))))))))))))))))))))))
		tmp = copysign(log(Float32(x * Float32(exp(1)))), x);
	else
		tmp = copysign(Float32(Float32(1.0) + log(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));
	elseif (x <= single(0.5))
		tmp = sign(x) * abs(x);
	elseif (x <= single(2.0))
		tmp = sign(x) * abs(((single(1.0) / x) + log(x)));
	elseif ((x <= single(6.0)) || (~((x <= single(20.0))) && ((x <= single(100.0)) || (~((x <= single(5000.0))) && ((x <= single(10000000000.0)) || (~((x <= single(499999997952.0))) && ((x <= single(19999999655936.0)) || (~((x <= single(100000000376832.0))) && ((x <= single(499999993495552.0)) || (~((x <= single(30000000817692670.0))) && ((x <= single(199999996861349900.0)) || (~((x <= single(499999992153374700.0))) && ((x <= single(7.000000069917397e+21)) || (~((x <= single(5.0000001268882145e+25))) && ((x <= single(9.999999884841548e+26)) || (~((x <= single(1.4999999753475345e+28))) && ((x <= single(5.000000075237331e+28)) || (~((x <= single(4.000000060189865e+29))) && ((x <= single(2.000000066362707e+32)) || (~((x <= single(4.9999999724786364e+32))) && ((x <= single(4.999999895107384e+33)) || (~((x <= single(8.500000224013066e+33))) && ((x <= single(1.2000000491021745e+35)) || (~((x <= single(2.0000000818369575e+35))) && (x <= single(9.999999933815813e+36))))))))))))))))))))))))))
		tmp = sign(x) * abs(log((x * single(2.71828182845904523536))));
	else
		tmp = sign(x) * abs((single(1.0) + log(x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

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

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

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

\mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

    if -2 < x < 0.5

    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. Taylor expanded in x around 0 16.0%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 98.0%

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around inf 42.5%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \left(-\color{blue}{\left(-\log x\right)}\right), x\right) \]
      4. remove-double-neg42.5%

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \color{blue}{\log x}, x\right) \]
    10. Simplified42.5%

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

    if 2 < x < 6 or 20 < x < 100 or 5e3 < x < 1e10 or 499999998000 < x < 1.99999997e13 or 1e14 < x < 4.99999993e14 or 3.00000008e16 < x < 1.99999997e17 or 4.99999992e17 < x < 7.00000007e21 or 5.00000013e25 < x < 9.99999988e26 or 1.49999998e28 < x < 5.00000008e28 or 4.00000006e29 < x < 2.00000007e32 or 4.99999997e32 < x < 4.9999999e33 or 8.50000022e33 < x < 1.20000005e35 or 2.00000008e35 < x < 9.99999993e36

    1. Initial program 46.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log x + \frac{x}{x}}, x\right) \]
    8. Step-by-step derivation
      1. add-log-exp48.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(e^{\log x + \frac{x}{x}}\right)}, x\right) \]
      2. *-inverses48.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(e^{\log x} \cdot e^{1}\right)}, x\right) \]
      4. add-exp-log48.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} \cdot e^{1}\right), x\right) \]
      5. exp-1-e48.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \color{blue}{e}\right), x\right) \]
    9. Applied egg-rr48.9%

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

    if 6 < x < 20 or 100 < x < 5e3 or 1e10 < x < 499999998000 or 1.99999997e13 < x < 1e14 or 4.99999993e14 < x < 3.00000008e16 or 1.99999997e17 < x < 4.99999992e17 or 7.00000007e21 < x < 5.00000013e25 or 9.99999988e26 < x < 1.49999998e28 or 5.00000008e28 < x < 4.00000006e29 or 2.00000007e32 < x < 4.99999997e32 or 4.9999999e33 < x < 8.50000022e33 or 1.20000005e35 < x < 2.00000008e35 or 9.99999993e36 < x

    1. Initial program 53.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(\frac{1}{x} + \log x, x\right)\\ \mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(1 + \log x, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 71.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\ \mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(1 + \log x, x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<= x -2.0)
   (copysign (log (- x)) x)
   (if (<= x 0.5)
     (copysign x x)
     (if (<= x 2.0)
       (copysign (* x (+ 1.0 (* x (- (* x 0.3333333333333333) 0.5)))) x)
       (if (or (<= x 6.0)
               (and (not (<= x 20.0))
                    (or (<= x 100.0)
                        (and (not (<= x 5000.0))
                             (or (<= x 10000000000.0)
                                 (and (not (<= x 499999997952.0))
                                      (or (<= x 19999999655936.0)
                                          (and (not (<= x 100000000376832.0))
                                               (or (<= x 499999993495552.0)
                                                   (and (not
                                                         (<=
                                                          x
                                                          30000000817692670.0))
                                                        (or (<=
                                                             x
                                                             199999996861349900.0)
                                                            (and (not
                                                                  (<=
                                                                   x
                                                                   499999992153374700.0))
                                                                 (or (<=
                                                                      x
                                                                      7.000000069917397e+21)
                                                                     (and (not
                                                                           (<=
                                                                            x
                                                                            5.0000001268882145e+25))
                                                                          (or (<=
                                                                               x
                                                                               9.999999884841548e+26)
                                                                              (and (not
                                                                                    (<=
                                                                                     x
                                                                                     1.4999999753475345e+28))
                                                                                   (or (<=
                                                                                        x
                                                                                        5.000000075237331e+28)
                                                                                       (and (not
                                                                                             (<=
                                                                                              x
                                                                                              4.000000060189865e+29))
                                                                                            (or (<=
                                                                                                 x
                                                                                                 2.000000066362707e+32)
                                                                                                (and (not
                                                                                                      (<=
                                                                                                       x
                                                                                                       4.9999999724786364e+32))
                                                                                                     (or (<=
                                                                                                          x
                                                                                                          4.999999895107384e+33)
                                                                                                         (and (not
                                                                                                               (<=
                                                                                                                x
                                                                                                                8.500000224013066e+33))
                                                                                                              (or (<=
                                                                                                                   x
                                                                                                                   1.2000000491021745e+35)
                                                                                                                  (and (not
                                                                                                                        (<=
                                                                                                                         x
                                                                                                                         2.0000000818369575e+35))
                                                                                                                       (<=
                                                                                                                        x
                                                                                                                        9.999999933815813e+36)))))))))))))))))))))))))
         (copysign (log (* x E)) x)
         (copysign (+ 1.0 (log x)) x))))))
float code(float x) {
	float tmp;
	if (x <= -2.0f) {
		tmp = copysignf(logf(-x), x);
	} else if (x <= 0.5f) {
		tmp = copysignf(x, x);
	} else if (x <= 2.0f) {
		tmp = copysignf((x * (1.0f + (x * ((x * 0.3333333333333333f) - 0.5f)))), x);
	} else if ((x <= 6.0f) || (!(x <= 20.0f) && ((x <= 100.0f) || (!(x <= 5000.0f) && ((x <= 10000000000.0f) || (!(x <= 499999997952.0f) && ((x <= 19999999655936.0f) || (!(x <= 100000000376832.0f) && ((x <= 499999993495552.0f) || (!(x <= 30000000817692670.0f) && ((x <= 199999996861349900.0f) || (!(x <= 499999992153374700.0f) && ((x <= 7.000000069917397e+21f) || (!(x <= 5.0000001268882145e+25f) && ((x <= 9.999999884841548e+26f) || (!(x <= 1.4999999753475345e+28f) && ((x <= 5.000000075237331e+28f) || (!(x <= 4.000000060189865e+29f) && ((x <= 2.000000066362707e+32f) || (!(x <= 4.9999999724786364e+32f) && ((x <= 4.999999895107384e+33f) || (!(x <= 8.500000224013066e+33f) && ((x <= 1.2000000491021745e+35f) || (!(x <= 2.0000000818369575e+35f) && (x <= 9.999999933815813e+36f))))))))))))))))))))))))) {
		tmp = copysignf(logf((x * ((float) M_E))), x);
	} else {
		tmp = copysignf((1.0f + logf(x)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-2.0))
		tmp = copysign(log(Float32(-x)), x);
	elseif (x <= Float32(0.5))
		tmp = copysign(x, x);
	elseif (x <= Float32(2.0))
		tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32(x * Float32(Float32(x * Float32(0.3333333333333333)) - Float32(0.5))))), x);
	elseif ((x <= Float32(6.0)) || (!(x <= Float32(20.0)) && ((x <= Float32(100.0)) || (!(x <= Float32(5000.0)) && ((x <= Float32(10000000000.0)) || (!(x <= Float32(499999997952.0)) && ((x <= Float32(19999999655936.0)) || (!(x <= Float32(100000000376832.0)) && ((x <= Float32(499999993495552.0)) || (!(x <= Float32(30000000817692670.0)) && ((x <= Float32(199999996861349900.0)) || (!(x <= Float32(499999992153374700.0)) && ((x <= Float32(7.000000069917397e+21)) || (!(x <= Float32(5.0000001268882145e+25)) && ((x <= Float32(9.999999884841548e+26)) || (!(x <= Float32(1.4999999753475345e+28)) && ((x <= Float32(5.000000075237331e+28)) || (!(x <= Float32(4.000000060189865e+29)) && ((x <= Float32(2.000000066362707e+32)) || (!(x <= Float32(4.9999999724786364e+32)) && ((x <= Float32(4.999999895107384e+33)) || (!(x <= Float32(8.500000224013066e+33)) && ((x <= Float32(1.2000000491021745e+35)) || (!(x <= Float32(2.0000000818369575e+35)) && (x <= Float32(9.999999933815813e+36))))))))))))))))))))))))))
		tmp = copysign(log(Float32(x * Float32(exp(1)))), x);
	else
		tmp = copysign(Float32(Float32(1.0) + log(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));
	elseif (x <= single(0.5))
		tmp = sign(x) * abs(x);
	elseif (x <= single(2.0))
		tmp = sign(x) * abs((x * (single(1.0) + (x * ((x * single(0.3333333333333333)) - single(0.5))))));
	elseif ((x <= single(6.0)) || (~((x <= single(20.0))) && ((x <= single(100.0)) || (~((x <= single(5000.0))) && ((x <= single(10000000000.0)) || (~((x <= single(499999997952.0))) && ((x <= single(19999999655936.0)) || (~((x <= single(100000000376832.0))) && ((x <= single(499999993495552.0)) || (~((x <= single(30000000817692670.0))) && ((x <= single(199999996861349900.0)) || (~((x <= single(499999992153374700.0))) && ((x <= single(7.000000069917397e+21)) || (~((x <= single(5.0000001268882145e+25))) && ((x <= single(9.999999884841548e+26)) || (~((x <= single(1.4999999753475345e+28))) && ((x <= single(5.000000075237331e+28)) || (~((x <= single(4.000000060189865e+29))) && ((x <= single(2.000000066362707e+32)) || (~((x <= single(4.9999999724786364e+32))) && ((x <= single(4.999999895107384e+33)) || (~((x <= single(8.500000224013066e+33))) && ((x <= single(1.2000000491021745e+35)) || (~((x <= single(2.0000000818369575e+35))) && (x <= single(9.999999933815813e+36))))))))))))))))))))))))))
		tmp = sign(x) * abs(log((x * single(2.71828182845904523536))));
	else
		tmp = sign(x) * abs((single(1.0) + log(x)));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

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

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

\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\

\mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

    if -2 < x < 0.5

    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. Taylor expanded in x around 0 16.0%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 98.0%

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 38.6%

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

    if 2 < x < 6 or 20 < x < 100 or 5e3 < x < 1e10 or 499999998000 < x < 1.99999997e13 or 1e14 < x < 4.99999993e14 or 3.00000008e16 < x < 1.99999997e17 or 4.99999992e17 < x < 7.00000007e21 or 5.00000013e25 < x < 9.99999988e26 or 1.49999998e28 < x < 5.00000008e28 or 4.00000006e29 < x < 2.00000007e32 or 4.99999997e32 < x < 4.9999999e33 or 8.50000022e33 < x < 1.20000005e35 or 2.00000008e35 < x < 9.99999993e36

    1. Initial program 46.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log x + \frac{x}{x}}, x\right) \]
    8. Step-by-step derivation
      1. add-log-exp48.9%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(e^{\log x + \frac{x}{x}}\right)}, x\right) \]
      2. *-inverses48.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(e^{\log x} \cdot e^{1}\right)}, x\right) \]
      4. add-exp-log48.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} \cdot e^{1}\right), x\right) \]
      5. exp-1-e48.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \color{blue}{e}\right), x\right) \]
    9. Applied egg-rr48.9%

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

    if 6 < x < 20 or 100 < x < 5e3 or 1e10 < x < 499999998000 or 1.99999997e13 < x < 1e14 or 4.99999993e14 < x < 3.00000008e16 or 1.99999997e17 < x < 4.99999992e17 or 7.00000007e21 < x < 5.00000013e25 or 9.99999988e26 < x < 1.49999998e28 or 5.00000008e28 < x < 4.00000006e29 or 2.00000007e32 < x < 4.99999997e32 or 4.9999999e33 < x < 8.50000022e33 or 1.20000005e35 < x < 2.00000008e35 or 9.99999993e36 < x

    1. Initial program 53.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\ \mathbf{elif}\;x \leq 6 \lor \neg \left(x \leq 20\right) \land \left(x \leq 100 \lor \neg \left(x \leq 5000\right) \land \left(x \leq 10000000000 \lor \neg \left(x \leq 499999997952\right) \land \left(x \leq 19999999655936 \lor \neg \left(x \leq 100000000376832\right) \land \left(x \leq 499999993495552 \lor \neg \left(x \leq 30000000817692670\right) \land \left(x \leq 199999996861349900 \lor \neg \left(x \leq 499999992153374700\right) \land \left(x \leq 7.000000069917397 \cdot 10^{+21} \lor \neg \left(x \leq 5.0000001268882145 \cdot 10^{+25}\right) \land \left(x \leq 9.999999884841548 \cdot 10^{+26} \lor \neg \left(x \leq 1.4999999753475345 \cdot 10^{+28}\right) \land \left(x \leq 5.000000075237331 \cdot 10^{+28} \lor \neg \left(x \leq 4.000000060189865 \cdot 10^{+29}\right) \land \left(x \leq 2.000000066362707 \cdot 10^{+32} \lor \neg \left(x \leq 4.9999999724786364 \cdot 10^{+32}\right) \land \left(x \leq 4.999999895107384 \cdot 10^{+33} \lor \neg \left(x \leq 8.500000224013066 \cdot 10^{+33}\right) \land \left(x \leq 1.2000000491021745 \cdot 10^{+35} \lor \neg \left(x \leq 2.0000000818369575 \cdot 10^{+35}\right) \land x \leq 9.999999933815813 \cdot 10^{+36}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right)\right):\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot e\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(1 + \log x, x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.3% accurate, 1.3× speedup?

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

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

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

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

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < x < 0.00499999989

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 99.4%

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

    if 0.00499999989 < x < 500

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

        \[\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-sqrt96.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-sqr96.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-sqrt96.5%

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

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

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

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

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

    if 500 < x

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 97.4% accurate, 1.8× speedup?

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

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

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

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

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

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < x < 0.00499999989

    1. Initial program 15.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 99.4%

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

    if 0.00499999989 < x < 0.5

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\left(1 + \color{blue}{\left(x \cdot 1 + x \cdot \left(-0.16666666666666666 \cdot {x}^{2}\right)\right)}\right) - 1, x\right) \]
      2. *-rgt-identity73.7%

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

        \[\leadsto \mathsf{copysign}\left(\left(1 + \left(x + x \cdot \color{blue}{\left({x}^{2} \cdot -0.16666666666666666\right)}\right)\right) - 1, x\right) \]
      4. associate-*r*73.7%

        \[\leadsto \mathsf{copysign}\left(\left(1 + \left(x + \color{blue}{\left(x \cdot {x}^{2}\right) \cdot -0.16666666666666666}\right)\right) - 1, x\right) \]
      5. unpow273.7%

        \[\leadsto \mathsf{copysign}\left(\left(1 + \left(x + \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot -0.16666666666666666\right)\right) - 1, x\right) \]
      6. cube-mult73.7%

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

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around inf 42.5%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \left(-\color{blue}{\left(-\log x\right)}\right), x\right) \]
      4. remove-double-neg42.5%

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \color{blue}{\log x}, x\right) \]
    10. Simplified42.5%

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

    if 2 < x

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 97.1% accurate, 1.8× speedup?

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

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

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

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

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < x < 0.5

    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. Taylor expanded in x around 0 16.0%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 98.0%

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around inf 42.5%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \left(-\color{blue}{\left(-\log x\right)}\right), x\right) \]
      4. remove-double-neg42.5%

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \color{blue}{\log x}, x\right) \]
    10. Simplified42.5%

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

    if 2 < x

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 83.8% accurate, 1.8× speedup?

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

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

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

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

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

    if -2 < x < 0.5

    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. Taylor expanded in x around 0 16.0%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 98.0%

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around inf 42.5%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \left(-\color{blue}{\left(-\log x\right)}\right), x\right) \]
      4. remove-double-neg42.5%

        \[\leadsto \mathsf{copysign}\left(\frac{1}{x} + \color{blue}{\log x}, x\right) \]
    10. Simplified42.5%

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

    if 2 < x

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot \left(1 + \frac{x}{x}\right)\right)}, x\right) \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 11: 71.3% accurate, 1.9× speedup?

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

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

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

\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

    if -2 < x < 0.5

    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. Taylor expanded in x around 0 16.0%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 98.0%

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 38.6%

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

    if 2 < x

    1. Initial program 49.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\left(-\color{blue}{\left(-\log x\right)}\right) + \frac{\left|x\right|}{x}, x\right) \]
      3. remove-double-neg48.5%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log x + \frac{x}{x}}, x\right) \]
    8. Step-by-step derivation
      1. add-log-exp48.5%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(e^{\log x + \color{blue}{1}}\right), x\right) \]
      3. exp-sum48.5%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(e^{\log x} \cdot e^{1}\right)}, x\right) \]
      4. add-exp-log48.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\color{blue}{x} \cdot e^{1}\right), x\right) \]
      5. exp-1-e48.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \color{blue}{e}\right), x\right) \]
    9. Applied egg-rr48.5%

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

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

Alternative 12: 70.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\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)
   (if (<= x 0.5)
     (copysign x x)
     (if (<= x 2.0)
       (copysign (* x (+ 1.0 (* x (- (* x 0.3333333333333333) 0.5)))) x)
       (copysign (log1p x) x)))))
float code(float x) {
	float tmp;
	if (x <= -2.0f) {
		tmp = copysignf(logf(-x), x);
	} else if (x <= 0.5f) {
		tmp = copysignf(x, x);
	} else if (x <= 2.0f) {
		tmp = copysignf((x * (1.0f + (x * ((x * 0.3333333333333333f) - 0.5f)))), 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);
	elseif (x <= Float32(0.5))
		tmp = copysign(x, x);
	elseif (x <= Float32(2.0))
		tmp = copysign(Float32(x * Float32(Float32(1.0) + Float32(x * Float32(Float32(x * Float32(0.3333333333333333)) - Float32(0.5))))), 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{elif}\;x \leq 0.5:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\

\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + x \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\right), x\right)\\

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


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

    1. Initial program 54.5%

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

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

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

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

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

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

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

    if -2 < x < 0.5

    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. Taylor expanded in x around 0 16.0%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 98.0%

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

    if 0.5 < x < 2

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 38.6%

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

    if 2 < x

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 62.4% accurate, 2.0× speedup?

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

    1. Initial program 32.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
    8. Taylor expanded in x around 0 65.3%

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

    if 2 < x

    1. Initial program 49.5%

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

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

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

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

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

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

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

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

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

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

Alternative 14: 54.1% 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 36.5%

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
  8. Taylor expanded in x around 0 51.9%

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

Developer target: 99.5% accurate, 0.6× speedup?

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

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

Reproduce

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

  :alt
  (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))