Rust f32::asinh

Percentage Accurate: 37.2% → 99.3%
Time: 6.3s
Alternatives: 10
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 10 alternatives:

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

Initial Program: 37.2% 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.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0.0020000000949949026:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot 0.075 - 0.16666666666666666\right)\right), x\right)\\

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


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

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

        \[\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.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. pow29.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-sqrt-0.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-sqr-0.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-sqrt9.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-def9.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-def9.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-sqrt9.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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.100000001 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) 1)))) x) < 0.00200000009

    1. Initial program 19.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 48.3%

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

        \[\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. *-un-lft-identity99.9%

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

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

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

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

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

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

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

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

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

Alternative 2: 98.5% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 51.7%

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

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

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

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

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

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

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

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

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

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

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

    if -20 < x < 0.00200000009

    1. Initial program 20.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.00200000009 < x

    1. Initial program 48.3%

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

        \[\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. *-un-lft-identity99.9%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.3% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

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

        \[\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.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. pow29.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-sqrt-0.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-sqr-0.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-sqrt9.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-def9.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-def9.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-sqrt9.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 19.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)}, x\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-in99.9%

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

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

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

        \[\leadsto \mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right), x\right) \]
      5. unpow399.9%

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

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

    if 0.00200000009 < x

    1. Initial program 48.3%

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

        \[\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. *-un-lft-identity99.9%

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

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

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

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

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

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

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

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

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

Alternative 4: 97.8% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 51.7%

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

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

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

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

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

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

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

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

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

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

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

    if -20 < x < 1

    1. Initial program 21.5%

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

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

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

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

        \[\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) \]
      5. fabs-sqr10.1%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)}, x\right) \]
    10. Step-by-step derivation
      1. distribute-rgt-in98.5%

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

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

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

        \[\leadsto \mathsf{copysign}\left(x + -0.16666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right), x\right) \]
      5. unpow398.5%

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

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

    if 1 < x

    1. Initial program 46.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative97.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot 2\right)}, x\right) \]
    9. Simplified97.4%

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

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

Alternative 5: 83.8% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 51.7%

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

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

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

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

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

    if -20 < x < 1

    1. Initial program 21.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 46.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative97.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot 2\right)}, x\right) \]
    9. Simplified97.4%

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

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

Alternative 6: 97.2% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 51.7%

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

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

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

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

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

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

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

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

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

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

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

    if -20 < x < 1

    1. Initial program 21.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 46.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative97.4%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot 2\right)}, x\right) \]
    9. Simplified97.4%

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

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

Alternative 7: 69.1% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 52.5%

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

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

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

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

    if -1 < x

    1. Initial program 29.6%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 63.3% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 52.5%

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

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

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

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

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

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

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

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

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

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

    if -1 < x

    1. Initial program 29.6%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 15.9% accurate, 4.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\color{blue}{\left(-\log \left(\frac{-1}{x}\right)\right) - \frac{x}{x}}, x\right) \]
  8. Applied egg-rr15.9%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{-1}, x\right) \]
  9. Final simplification15.9%

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

Alternative 10: 54.3% 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 35.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(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 2024076 
(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))