Rust f32::asinh

Percentage Accurate: 37.6% → 99.6%
Time: 8.7s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 37.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 53.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right)}, x\right) \]
    9. Step-by-step derivation
      1. flip--9.9%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(\left(1 + {x}^{2}\right) - {x}^{2}\right) \cdot \frac{1}{x + \mathsf{hypot}\left(1, x\right)}}}\right), x\right) \]
    11. Step-by-step derivation
      1. associate-*r/9.9%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\frac{1}{x + \mathsf{hypot}\left(1, x\right)}}}\right), x\right) \]
    13. Step-by-step derivation
      1. remove-double-div15.6%

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\mathsf{hypot}\left(1, x\right) + x\right)}, x\right) \]
    15. Step-by-step derivation
      1. add-sqr-sqrt-0.0%

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

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

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

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

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

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

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

    if -0.0599999987 < x < 0.0500000007

    1. Initial program 20.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+20.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. div-sub20.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      6. distribute-neg-frac220.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      17. neg-sub020.7%

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

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

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

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

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

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -9.999999747378752 \cdot 10^{-5}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) + -1\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (if (<=
      (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)
      -9.999999747378752e-5)
   (copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
   (copysign (log1p (+ x (+ (hypot 1.0 x) -1.0))) x)))
float code(float x) {
	float tmp;
	if (copysignf(logf((fabsf(x) + sqrtf(((x * x) + 1.0f)))), x) <= -9.999999747378752e-5f) {
		tmp = copysignf(logf((1.0f / (hypotf(1.0f, x) - x))), x);
	} else {
		tmp = copysignf(log1pf((x + (hypotf(1.0f, x) + -1.0f))), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (copysign(log(Float32(abs(x) + sqrt(Float32(Float32(x * x) + Float32(1.0))))), x) <= Float32(-9.999999747378752e-5))
		tmp = copysign(log(Float32(Float32(1.0) / Float32(hypot(Float32(1.0), x) - x))), x);
	else
		tmp = copysign(log1p(Float32(x + Float32(hypot(Float32(1.0), x) + Float32(-1.0)))), x);
	end
	return tmp
end
\begin{array}{l}

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

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


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

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      6. distribute-neg-frac220.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999975e-5 < (copysign.f32 (log.f32 (+.f32 (fabs.f32 x) (sqrt.f32 (+.f32 (*.f32 x x) #s(literal 1 binary32))))) x)

    1. Initial program 30.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+13.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. div-sub13.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      17. neg-sub015.5%

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right)}, x\right) \]
    9. Step-by-step derivation
      1. flip--14.3%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(\left(1 + {x}^{2}\right) - {x}^{2}\right) \cdot \frac{1}{x + \mathsf{hypot}\left(1, x\right)}}}\right), x\right) \]
    11. Step-by-step derivation
      1. associate-*r/15.2%

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\frac{1}{x + \mathsf{hypot}\left(1, x\right)}}}\right), x\right) \]
    13. Step-by-step derivation
      1. log1p-expm1-u45.5%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(1, x\right)\right) - 1\right)}, x\right) \]
    15. Step-by-step derivation
      1. associate--l+99.2%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{x + \left(\mathsf{hypot}\left(1, x\right) - 1\right)}\right), x\right) \]
    16. Simplified99.2%

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

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

Alternative 3: 98.7% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 51.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{-0.5}{x}\right)}, x\right) \]
    10. Step-by-step derivation
      1. clear-num97.4%

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\frac{x}{-0.5}\right)}, x\right) \]
      3. div-inv97.4%

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot \color{blue}{-2}\right), x\right) \]
    11. Applied egg-rr97.4%

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

    if -2 < x < 0.0500000007

    1. Initial program 22.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) - 1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      10. sub-neg22.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      15. neg-sub022.6%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      17. neg-sub022.6%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right) + \left(-x\right)}}\right), x\right) \]
      19. sub-neg22.6%

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

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

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

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

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

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

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

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

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

    if 0.0500000007 < x

    1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.9% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 51.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{-0.5}{x}\right)}, x\right) \]
    10. Step-by-step derivation
      1. clear-num97.4%

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\frac{x}{-0.5}\right)}, x\right) \]
      3. div-inv97.4%

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot \color{blue}{-2}\right), x\right) \]
    11. Applied egg-rr97.4%

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

    if -2 < x < 0.5

    1. Initial program 23.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      6. distribute-neg-frac223.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < x

    1. Initial program 56.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{--0.5}{-x}\right)}, x\right) \]
      2. div-inv-0.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{1}{\color{blue}{x}}\right), x\right) \]
    11. Applied egg-rr97.7%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    12. Step-by-step derivation
      1. associate-*r/97.7%

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

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

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

Alternative 5: 97.0% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 51.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{-0.5}{x}\right)}, x\right) \]
    10. Step-by-step derivation
      1. clear-num97.4%

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{-\log \left(\frac{x}{-0.5}\right)}, x\right) \]
      3. div-inv97.4%

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

        \[\leadsto \mathsf{copysign}\left(-\log \left(x \cdot \color{blue}{-2}\right), x\right) \]
    11. Applied egg-rr97.4%

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

    if -2 < x < 0.5

    1. Initial program 23.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      6. distribute-neg-frac223.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < x

    1. Initial program 56.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{--0.5}{-x}\right)}, x\right) \]
      2. div-inv-0.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{1}{\color{blue}{x}}\right), x\right) \]
    11. Applied egg-rr97.7%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    12. Step-by-step derivation
      1. associate-*r/97.7%

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

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

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

Alternative 6: 97.2% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 51.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < x < 0.5

    1. Initial program 23.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      6. distribute-neg-frac223.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < x

    1. Initial program 56.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{--0.5}{-x}\right)}, x\right) \]
      2. div-inv-0.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{1}{\color{blue}{x}}\right), x\right) \]
    11. Applied egg-rr97.7%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.5 \cdot \frac{1}{x}\right)}, x\right) \]
    12. Step-by-step derivation
      1. associate-*r/97.7%

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

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

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

Alternative 7: 97.0% accurate, 1.9× speedup?

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

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

    1. Initial program 51.4%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+6.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. div-sub6.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < x < 0.5

    1. Initial program 23.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      6. distribute-neg-frac223.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.5 < x

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 83.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\ \mathbf{elif}\;x \leq 0.5:\\ \;\;\;\;\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 -3.0)
   (copysign (log (- x)) x)
   (if (<= x 0.5) (copysign x x) (copysign (log (* x 2.0)) x))))
float code(float x) {
	float tmp;
	if (x <= -3.0f) {
		tmp = copysignf(logf(-x), x);
	} else if (x <= 0.5f) {
		tmp = copysignf(x, x);
	} else {
		tmp = copysignf(logf((x * 2.0f)), x);
	}
	return tmp;
}
function code(x)
	tmp = Float32(0.0)
	if (x <= Float32(-3.0))
		tmp = copysign(log(Float32(-x)), x);
	elseif (x <= Float32(0.5))
		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(-3.0))
		tmp = sign(x) * abs(log(-x));
	elseif (x <= single(0.5))
		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 -3:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\

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

    1. Initial program 50.7%

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

    1. Initial program 23.6%

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

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

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

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. flip-+23.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. div-sub23.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      17. neg-sub023.7%

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

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

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

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

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

    if 0.5 < x

    1. Initial program 56.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.9% 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.0%

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

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

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

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

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

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

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

    if -1 < x

    1. Initial program 33.3%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 62.7% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 33.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{{x}^{2} - \color{blue}{\left(x \cdot x + 1\right)}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      8. unpow218.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{{x}^{2} - \left(\color{blue}{{x}^{2}} + 1\right)}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      9. associate--r+32.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) - 1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      10. sub-neg32.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) + \left(-1\right)}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      11. +-inverses52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{0} + \left(-1\right)}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      12. metadata-eval52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{0 + \color{blue}{-1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      13. metadata-eval52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{-1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      14. metadata-eval52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
      15. neg-sub052.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{0 - \left(x - \mathsf{hypot}\left(1, x\right)\right)}}\right), x\right) \]
      16. associate--r-52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      17. neg-sub052.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(-x\right)} + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
      18. +-commutative52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right) + \left(-x\right)}}\right), x\right) \]
      19. sub-neg52.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right) - x}}\right), x\right) \]
    8. Simplified52.2%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right)}, x\right) \]
    9. Taylor expanded in x around 0 64.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x}, x\right) \]

    if 0.5 < x

    1. Initial program 56.4%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Step-by-step derivation
      1. +-commutative56.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-def99.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 44.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left|x\right|\right)}, x\right) \]
    6. Step-by-step derivation
      1. log1p-define44.3%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right|\right)}, x\right) \]
      2. rem-square-sqrt44.3%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right), x\right) \]
      3. fabs-sqr44.3%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right), x\right) \]
      4. rem-square-sqrt44.3%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{x}\right), x\right) \]
    7. Simplified44.3%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right)}, x\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 54.4% 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 38.9%

    \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
  2. Step-by-step derivation
    1. +-commutative38.9%

      \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
    2. hypot-1-def63.0%

      \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right) \]
  3. Simplified63.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-+14.4%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
    2. div-sub14.5%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\left|x\right| \cdot \left|x\right|}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
    3. pow214.5%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{{\left(\left|x\right|\right)}^{2}}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    4. add-sqr-sqrt6.2%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    5. fabs-sqr6.2%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    6. add-sqr-sqrt14.5%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{\color{blue}{x}}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    7. add-sqr-sqrt6.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{x}^{2}}{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    8. fabs-sqr6.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{x}^{2}}{\color{blue}{\sqrt{x} \cdot \sqrt{x}} - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    9. add-sqr-sqrt12.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{{x}^{2}}{\color{blue}{x} - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
  6. Applied egg-rr15.3%

    \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{{x}^{2}}{x - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{fma}\left(x, x, 1\right)}{x - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
  7. Step-by-step derivation
    1. div-sub15.8%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{x - \mathsf{hypot}\left(1, x\right)}\right)}, x\right) \]
    2. remove-double-neg15.8%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-\left(-\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{x - \mathsf{hypot}\left(1, x\right)}\right)\right)}, x\right) \]
    3. distribute-frac-neg215.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}}\right), x\right) \]
    4. neg-mul-115.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(-\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{\color{blue}{-1 \cdot \left(x - \mathsf{hypot}\left(1, x\right)\right)}}\right), x\right) \]
    5. associate-/r*15.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(-\color{blue}{\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{x - \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
    6. distribute-neg-frac215.8%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\frac{{x}^{2} - \mathsf{fma}\left(x, x, 1\right)}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right)}, x\right) \]
    7. fma-undefine15.7%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{{x}^{2} - \color{blue}{\left(x \cdot x + 1\right)}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    8. unpow215.7%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{{x}^{2} - \left(\color{blue}{{x}^{2}} + 1\right)}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    9. associate--r+26.6%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) - 1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    10. sub-neg26.6%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) + \left(-1\right)}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    11. +-inverses41.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{0} + \left(-1\right)}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    12. metadata-eval41.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{0 + \color{blue}{-1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    13. metadata-eval41.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\frac{\color{blue}{-1}}{-1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    14. metadata-eval41.8%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{\color{blue}{1}}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}\right), x\right) \]
    15. neg-sub043.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{0 - \left(x - \mathsf{hypot}\left(1, x\right)\right)}}\right), x\right) \]
    16. associate--r-43.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
    17. neg-sub043.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(-x\right)} + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]
    18. +-commutative43.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right) + \left(-x\right)}}\right), x\right) \]
    19. sub-neg43.1%

      \[\leadsto \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right) - x}}\right), x\right) \]
  8. Simplified43.1%

    \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right)}, x\right) \]
  9. Taylor expanded in x around 0 52.5%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{x}, x\right) \]
  10. Add Preprocessing

Developer Target 1: 99.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\left|x\right|}\\ \mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t\_0\right) + t\_0}\right), x\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (/ 1.0 (fabs x))))
   (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
float code(float x) {
	float t_0 = 1.0f / fabsf(x);
	return copysignf(log1pf((fabsf(x) + (fabsf(x) / (hypotf(1.0f, t_0) + t_0)))), x);
}
function code(x)
	t_0 = Float32(Float32(1.0) / abs(x))
	return copysign(log1p(Float32(abs(x) + Float32(abs(x) / Float32(hypot(Float32(1.0), t_0) + t_0)))), x)
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t\_0\right) + t\_0}\right), x\right)
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024180 
(FPCore (x)
  :name "Rust f32::asinh"
  :precision binary32

  :alt
  (! :herbie-platform default (let* ((ax (fabs x)) (ix (/ 1 ax))) (copysign (log1p (+ ax (/ ax (+ (hypot 1 ix) ix)))) x)))

  (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))