Rust f32::asinh

Percentage Accurate: 37.7% → 99.3%
Time: 9.5s
Alternatives: 15
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 15 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\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. log-div12.5%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 20.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 20.8%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{x} + {x}^{2} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      4. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{x \cdot \left(x \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)}\right)\right), x\right) \]
      6. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} - 0.125\right) \cdot \left(x \cdot x\right)}\right)\right)\right)\right), x\right) \]
      8. sub-neg21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.1%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow2100.0%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg100.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) + \left(-0.16666666666666666\right)\right) \cdot \left(x \cdot x\right)\right), x\right) \]
      7. metadata-eval100.0%

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified100.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right)}, x\right) \]
    9. Step-by-step derivation
      1. distribute-rgt-in100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{1 \cdot x + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x}, x\right) \]
      2. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative100.0%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr100.0%

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

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

    1. Initial program 61.1%

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

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

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

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

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

Alternative 2: 99.2% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;x \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\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. log-div12.5%

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

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

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

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

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

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

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

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

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

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

    if -2 < x < 0.00499999989

    1. Initial program 20.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 20.8%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{x} + {x}^{2} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      4. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{x \cdot \left(x \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)}\right)\right), x\right) \]
      6. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} - 0.125\right) \cdot \left(x \cdot x\right)}\right)\right)\right)\right), x\right) \]
      8. sub-neg21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.1%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow2100.0%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg100.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) + \left(-0.16666666666666666\right)\right) \cdot \left(x \cdot x\right)\right), x\right) \]
      7. metadata-eval100.0%

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified100.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right)}, x\right) \]
    9. Step-by-step derivation
      1. distribute-rgt-in100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{1 \cdot x + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x}, x\right) \]
      2. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative100.0%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr100.0%

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

    if 0.00499999989 < x

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

Alternative 3: 99.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot x\right)\\ \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{t\_0 \cdot t\_0}\right) - \frac{0.0625}{x \cdot t\_0}\right) - 0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.004999999888241291:\\ \;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (* x (* x x))))
   (if (<= x -2.0)
     (copysign
      (log
       (/
        (-
         (-
          (+ (/ 0.125 (* x x)) (/ 0.0390625 (* t_0 t_0)))
          (/ 0.0625 (* x t_0)))
         0.5)
        x))
      x)
     (if (<= x 0.004999999888241291)
       (copysign
        (+
         x
         (*
          x
          (*
           (* x x)
           (+
            (* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
            -0.16666666666666666))))
        x)
       (copysign (log (+ x (hypot 1.0 x))) x)))))
float code(float x) {
	float t_0 = x * (x * x);
	float tmp;
	if (x <= -2.0f) {
		tmp = copysignf(logf((((((0.125f / (x * x)) + (0.0390625f / (t_0 * t_0))) - (0.0625f / (x * t_0))) - 0.5f) / x)), x);
	} else if (x <= 0.004999999888241291f) {
		tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
	} else {
		tmp = copysignf(logf((x + hypotf(1.0f, x))), x);
	}
	return tmp;
}
function code(x)
	t_0 = Float32(x * Float32(x * x))
	tmp = Float32(0.0)
	if (x <= Float32(-2.0))
		tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) + Float32(Float32(0.0390625) / Float32(t_0 * t_0))) - Float32(Float32(0.0625) / Float32(x * t_0))) - Float32(0.5)) / x)), x);
	elseif (x <= Float32(0.004999999888241291))
		tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x);
	else
		tmp = copysign(log(Float32(x + hypot(Float32(1.0), x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = x * (x * x);
	tmp = single(0.0);
	if (x <= single(-2.0))
		tmp = sign(x) * abs(log((((((single(0.125) / (x * x)) + (single(0.0390625) / (t_0 * t_0))) - (single(0.0625) / (x * t_0))) - single(0.5)) / x)));
	elseif (x <= single(0.004999999888241291))
		tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666))))));
	else
		tmp = sign(x) * abs(log((x + hypot(single(1.0), x))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{t\_0 \cdot t\_0}\right) - \frac{0.0625}{x \cdot t\_0}\right) - 0.5}{x}\right), x\right)\\

\mathbf{elif}\;x \leq 0.004999999888241291:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-1 \cdot \frac{\left(0.5 + \frac{0.0625}{{x}^{4}}\right) - \left(0.125 \cdot \frac{1}{{x}^{2}} + 0.0390625 \cdot \frac{1}{{x}^{6}}\right)}{x}\right)}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-neg99.6%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-\frac{\left(0.5 + \frac{0.0625}{{x}^{4}}\right) - \left(0.125 \cdot \frac{1}{{x}^{2}} + 0.0390625 \cdot \frac{1}{{x}^{6}}\right)}{x}\right)}, x\right) \]
      2. neg-sub099.6%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0 - \frac{\left(0.5 + \frac{0.0625}{{x}^{4}}\right) - \left(0.125 \cdot \frac{1}{{x}^{2}} + 0.0390625 \cdot \frac{1}{{x}^{6}}\right)}{x}\right)}, x\right) \]
    7. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0 - \frac{0.5 + \left(\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} - \left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)}\right)\right)}{x}\right)}, x\right) \]

    if -2 < x < 0.00499999989

    1. Initial program 20.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 20.8%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{x} + {x}^{2} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      4. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{x \cdot \left(x \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)}\right)\right), x\right) \]
      6. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} - 0.125\right) \cdot \left(x \cdot x\right)}\right)\right)\right)\right), x\right) \]
      8. sub-neg21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.1%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.1%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow2100.0%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg100.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) + \left(-0.16666666666666666\right)\right) \cdot \left(x \cdot x\right)\right), x\right) \]
      7. metadata-eval100.0%

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified100.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right)}, x\right) \]
    9. Step-by-step derivation
      1. distribute-rgt-in100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{1 \cdot x + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x}, x\right) \]
      2. *-un-lft-identity100.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative100.0%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative100.0%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr100.0%

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

    if 0.00499999989 < x

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

Alternative 4: 99.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot x\right)\\ t_1 := t\_0 \cdot t\_0\\ t_2 := x \cdot t\_0\\ \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{t\_1}\right) - \frac{0.0625}{t\_2}\right) - 0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{t\_1} + \frac{0.5}{x \cdot x}\right) + \frac{-0.125}{t\_2}\right)\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (* x (* x x))) (t_1 (* t_0 t_0)) (t_2 (* x t_0)))
   (if (<= x -2.0)
     (copysign
      (log
       (/
        (- (- (+ (/ 0.125 (* x x)) (/ 0.0390625 t_1)) (/ 0.0625 t_2)) 0.5)
        x))
      x)
     (if (<= x 1.0)
       (copysign
        (+
         x
         (*
          x
          (*
           (* x x)
           (+
            (* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
            -0.16666666666666666))))
        x)
       (copysign
        (log
         (* x (+ 2.0 (+ (+ (/ 0.0625 t_1) (/ 0.5 (* x x))) (/ -0.125 t_2)))))
        x)))))
float code(float x) {
	float t_0 = x * (x * x);
	float t_1 = t_0 * t_0;
	float t_2 = x * t_0;
	float tmp;
	if (x <= -2.0f) {
		tmp = copysignf(logf((((((0.125f / (x * x)) + (0.0390625f / t_1)) - (0.0625f / t_2)) - 0.5f) / x)), x);
	} else if (x <= 1.0f) {
		tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
	} else {
		tmp = copysignf(logf((x * (2.0f + (((0.0625f / t_1) + (0.5f / (x * x))) + (-0.125f / t_2))))), x);
	}
	return tmp;
}
function code(x)
	t_0 = Float32(x * Float32(x * x))
	t_1 = Float32(t_0 * t_0)
	t_2 = Float32(x * t_0)
	tmp = Float32(0.0)
	if (x <= Float32(-2.0))
		tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) + Float32(Float32(0.0390625) / t_1)) - Float32(Float32(0.0625) / t_2)) - Float32(0.5)) / x)), x);
	elseif (x <= Float32(1.0))
		tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x);
	else
		tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(Float32(Float32(0.0625) / t_1) + Float32(Float32(0.5) / Float32(x * x))) + Float32(Float32(-0.125) / t_2))))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = x * (x * x);
	t_1 = t_0 * t_0;
	t_2 = x * t_0;
	tmp = single(0.0);
	if (x <= single(-2.0))
		tmp = sign(x) * abs(log((((((single(0.125) / (x * x)) + (single(0.0390625) / t_1)) - (single(0.0625) / t_2)) - single(0.5)) / x)));
	elseif (x <= single(1.0))
		tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666))))));
	else
		tmp = sign(x) * abs(log((x * (single(2.0) + (((single(0.0625) / t_1) + (single(0.5) / (x * x))) + (single(-0.125) / t_2))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := t\_0 \cdot t\_0\\
t_2 := x \cdot t\_0\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{t\_1}\right) - \frac{0.0625}{t\_2}\right) - 0.5}{x}\right), x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{t\_1} + \frac{0.5}{x \cdot x}\right) + \frac{-0.125}{t\_2}\right)\right)\right), x\right)\\


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-1 \cdot \frac{\left(0.5 + \frac{0.0625}{{x}^{4}}\right) - \left(0.125 \cdot \frac{1}{{x}^{2}} + 0.0390625 \cdot \frac{1}{{x}^{6}}\right)}{x}\right)}, x\right) \]
    6. Step-by-step derivation
      1. mul-1-neg99.6%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-\frac{\left(0.5 + \frac{0.0625}{{x}^{4}}\right) - \left(0.125 \cdot \frac{1}{{x}^{2}} + 0.0390625 \cdot \frac{1}{{x}^{6}}\right)}{x}\right)}, x\right) \]
      2. neg-sub099.6%

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0 - \frac{\left(0.5 + \frac{0.0625}{{x}^{4}}\right) - \left(0.125 \cdot \frac{1}{{x}^{2}} + 0.0390625 \cdot \frac{1}{{x}^{6}}\right)}{x}\right)}, x\right) \]
    7. Simplified99.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0 - \frac{0.5 + \left(\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} - \left(\frac{0.125}{x \cdot x} + \frac{0.0390625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)}\right)\right)}{x}\right)}, x\right) \]

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot \left(\left(2 + \left(0.5 \cdot \frac{1}{{x}^{2}} + 0.0625 \cdot \frac{1}{{x}^{6}}\right)\right) - \frac{0.125}{{x}^{4}}\right)\right)}, x\right) \]
    6. Step-by-step derivation
      1. associate--l+98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \color{blue}{\left(2 + \left(\left(0.5 \cdot \frac{1}{{x}^{2}} + 0.0625 \cdot \frac{1}{{x}^{6}}\right) - \frac{0.125}{{x}^{4}}\right)\right)}\right), x\right) \]
      2. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \color{blue}{\left(\left(0.5 \cdot \frac{1}{{x}^{2}} + 0.0625 \cdot \frac{1}{{x}^{6}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)}\right)\right), x\right) \]
      3. +-commutative98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\color{blue}{\left(0.0625 \cdot \frac{1}{{x}^{6}} + 0.5 \cdot \frac{1}{{x}^{2}}\right)} + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      4. associate-*r/98.5%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{{x}^{\color{blue}{\left(2 \cdot 3\right)}}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      7. pow-sqr98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\color{blue}{{x}^{3} \cdot {x}^{3}}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      8. cube-unmult98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} \cdot {x}^{3}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      9. cube-unmult98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      10. unpow298.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + 0.5 \cdot \frac{1}{\color{blue}{x \cdot x}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      11. associate-*r/98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \color{blue}{\frac{0.5 \cdot 1}{x \cdot x}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      12. metadata-eval98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{\color{blue}{0.5}}{x \cdot x}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      13. metadata-eval98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{{x}^{\color{blue}{\left(3 + 1\right)}}}\right)\right)\right)\right), x\right) \]
      14. pow-plus98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{\color{blue}{{x}^{3} \cdot x}}\right)\right)\right)\right), x\right) \]
      15. unpow398.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x}\right)\right)\right)\right), x\right) \]
      16. associate-*r*98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}}\right)\right)\right)\right), x\right) \]
    7. Simplified98.5%

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

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

Alternative 5: 99.2% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(x \cdot x\right)\\ t_1 := x \cdot t\_0\\ \mathbf{if}\;x \leq -2:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\frac{0.125}{x \cdot x} - 0.5\right) - \frac{0.0625}{t\_1}}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{t\_0 \cdot t\_0} + \frac{0.5}{x \cdot x}\right) + \frac{-0.125}{t\_1}\right)\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (* x (* x x))) (t_1 (* x t_0)))
   (if (<= x -2.0)
     (copysign (log (/ (- (- (/ 0.125 (* x x)) 0.5) (/ 0.0625 t_1)) x)) x)
     (if (<= x 1.0)
       (copysign
        (+
         x
         (*
          x
          (*
           (* x x)
           (+
            (* (* x x) (+ (* (* x x) -0.044642857142857144) 0.075))
            -0.16666666666666666))))
        x)
       (copysign
        (log
         (*
          x
          (+
           2.0
           (+ (+ (/ 0.0625 (* t_0 t_0)) (/ 0.5 (* x x))) (/ -0.125 t_1)))))
        x)))))
float code(float x) {
	float t_0 = x * (x * x);
	float t_1 = x * t_0;
	float tmp;
	if (x <= -2.0f) {
		tmp = copysignf(logf(((((0.125f / (x * x)) - 0.5f) - (0.0625f / t_1)) / x)), x);
	} else if (x <= 1.0f) {
		tmp = copysignf((x + (x * ((x * x) * (((x * x) * (((x * x) * -0.044642857142857144f) + 0.075f)) + -0.16666666666666666f)))), x);
	} else {
		tmp = copysignf(logf((x * (2.0f + (((0.0625f / (t_0 * t_0)) + (0.5f / (x * x))) + (-0.125f / t_1))))), x);
	}
	return tmp;
}
function code(x)
	t_0 = Float32(x * Float32(x * x))
	t_1 = Float32(x * t_0)
	tmp = Float32(0.0)
	if (x <= Float32(-2.0))
		tmp = copysign(log(Float32(Float32(Float32(Float32(Float32(0.125) / Float32(x * x)) - Float32(0.5)) - Float32(Float32(0.0625) / t_1)) / x)), x);
	elseif (x <= Float32(1.0))
		tmp = copysign(Float32(x + Float32(x * Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(Float32(Float32(x * x) * Float32(-0.044642857142857144)) + Float32(0.075))) + Float32(-0.16666666666666666))))), x);
	else
		tmp = copysign(log(Float32(x * Float32(Float32(2.0) + Float32(Float32(Float32(Float32(0.0625) / Float32(t_0 * t_0)) + Float32(Float32(0.5) / Float32(x * x))) + Float32(Float32(-0.125) / t_1))))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = x * (x * x);
	t_1 = x * t_0;
	tmp = single(0.0);
	if (x <= single(-2.0))
		tmp = sign(x) * abs(log(((((single(0.125) / (x * x)) - single(0.5)) - (single(0.0625) / t_1)) / x)));
	elseif (x <= single(1.0))
		tmp = sign(x) * abs((x + (x * ((x * x) * (((x * x) * (((x * x) * single(-0.044642857142857144)) + single(0.075))) + single(-0.16666666666666666))))));
	else
		tmp = sign(x) * abs(log((x * (single(2.0) + (((single(0.0625) / (t_0 * t_0)) + (single(0.5) / (x * x))) + (single(-0.125) / t_1))))));
	end
	tmp_2 = tmp;
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := x \cdot t\_0\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\frac{0.125}{x \cdot x} - 0.5\right) - \frac{0.0625}{t\_1}}{x}\right), x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{t\_0 \cdot t\_0} + \frac{0.5}{x \cdot x}\right) + \frac{-0.125}{t\_1}\right)\right)\right), x\right)\\


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\color{blue}{\left(\frac{0.0625}{{x}^{4}} + 0.5\right)} - 0.125 \cdot \frac{1}{{x}^{2}}}{x}\right), x\right) \]
      4. associate--l+99.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{{x}^{\color{blue}{\left(3 + 1\right)}}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      6. pow-plus99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{{x}^{3} \cdot x}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      7. unpow399.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      8. associate-*r*99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      9. associate-*l*99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      10. unpow299.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \left(0.5 - \color{blue}{\frac{0.125 \cdot 1}{x \cdot x}}\right)}{x}\right), x\right) \]
      12. metadata-eval99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \left(0.5 - \frac{\color{blue}{0.125}}{x \cdot x}\right)}{x}\right), x\right) \]
    7. Simplified99.4%

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(x \cdot \left(\left(2 + \left(0.5 \cdot \frac{1}{{x}^{2}} + 0.0625 \cdot \frac{1}{{x}^{6}}\right)\right) - \frac{0.125}{{x}^{4}}\right)\right)}, x\right) \]
    6. Step-by-step derivation
      1. associate--l+98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \color{blue}{\left(2 + \left(\left(0.5 \cdot \frac{1}{{x}^{2}} + 0.0625 \cdot \frac{1}{{x}^{6}}\right) - \frac{0.125}{{x}^{4}}\right)\right)}\right), x\right) \]
      2. sub-neg98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \color{blue}{\left(\left(0.5 \cdot \frac{1}{{x}^{2}} + 0.0625 \cdot \frac{1}{{x}^{6}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)}\right)\right), x\right) \]
      3. +-commutative98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\color{blue}{\left(0.0625 \cdot \frac{1}{{x}^{6}} + 0.5 \cdot \frac{1}{{x}^{2}}\right)} + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      4. associate-*r/98.5%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{{x}^{\color{blue}{\left(2 \cdot 3\right)}}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      7. pow-sqr98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\color{blue}{{x}^{3} \cdot {x}^{3}}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      8. cube-unmult98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} \cdot {x}^{3}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      9. cube-unmult98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)}} + 0.5 \cdot \frac{1}{{x}^{2}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      10. unpow298.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + 0.5 \cdot \frac{1}{\color{blue}{x \cdot x}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      11. associate-*r/98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \color{blue}{\frac{0.5 \cdot 1}{x \cdot x}}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      12. metadata-eval98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{\color{blue}{0.5}}{x \cdot x}\right) + \left(-\frac{0.125}{{x}^{4}}\right)\right)\right)\right), x\right) \]
      13. metadata-eval98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{{x}^{\color{blue}{\left(3 + 1\right)}}}\right)\right)\right)\right), x\right) \]
      14. pow-plus98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{\color{blue}{{x}^{3} \cdot x}}\right)\right)\right)\right), x\right) \]
      15. unpow398.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x}\right)\right)\right)\right), x\right) \]
      16. associate-*r*98.5%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\left(\frac{0.0625}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \frac{0.5}{x \cdot x}\right) + \left(-\frac{0.125}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}}\right)\right)\right)\right), x\right) \]
    7. Simplified98.5%

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

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

Alternative 6: 99.1% accurate, 1.7× speedup?

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

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

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

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\color{blue}{\left(\frac{0.0625}{{x}^{4}} + 0.5\right)} - 0.125 \cdot \frac{1}{{x}^{2}}}{x}\right), x\right) \]
      4. associate--l+99.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{{x}^{\color{blue}{\left(3 + 1\right)}}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      6. pow-plus99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{{x}^{3} \cdot x}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      7. unpow399.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      8. associate-*r*99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      9. associate-*l*99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      10. unpow299.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \left(0.5 - \color{blue}{\frac{0.125 \cdot 1}{x \cdot x}}\right)}{x}\right), x\right) \]
      12. metadata-eval99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \left(0.5 - \frac{\color{blue}{0.125}}{x \cdot x}\right)}{x}\right), x\right) \]
    7. Simplified99.4%

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 98.2%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\left(\left(\frac{0.5}{{x}^{2}} + \frac{\left|x\right|}{x}\right) + 1\right) - \frac{\color{blue}{0.125}}{{x}^{4}}\right)\right), x\right) \]
      4. associate--l+98.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.1% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\mathbf{if}\;x \leq -2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{\left(\frac{0.125}{x \cdot x} - 0.5\right) - \frac{0.0625}{t\_0}}{x}\right), x\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \frac{-0.125}{t\_0}\right)\right)\right), x\right)\\


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\color{blue}{\left(\frac{0.0625}{{x}^{4}} + 0.5\right)} - 0.125 \cdot \frac{1}{{x}^{2}}}{x}\right), x\right) \]
      4. associate--l+99.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{{x}^{\color{blue}{\left(3 + 1\right)}}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      6. pow-plus99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{{x}^{3} \cdot x}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      7. unpow399.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      8. associate-*r*99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      9. associate-*l*99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{\color{blue}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)}} + \left(0.5 - 0.125 \cdot \frac{1}{{x}^{2}}\right)}{x}\right), x\right) \]
      10. unpow299.4%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \left(0.5 - \color{blue}{\frac{0.125 \cdot 1}{x \cdot x}}\right)}{x}\right), x\right) \]
      12. metadata-eval99.4%

        \[\leadsto \mathsf{copysign}\left(\log \left(0 - \frac{\frac{0.0625}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)} + \left(0.5 - \frac{\color{blue}{0.125}}{x \cdot x}\right)}{x}\right), x\right) \]
    7. Simplified99.4%

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{\color{blue}{0.5}}{x \cdot x} - \frac{0.125}{{x}^{4}}\right)\right)\right), x\right) \]
      5. sub-neg98.2%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \left(-\frac{0.125}{\color{blue}{{x}^{3} \cdot x}}\right)\right)\right)\right), x\right) \]
      8. unpow398.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \left(-\frac{0.125}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x}\right)\right)\right)\right), x\right) \]
      9. associate-*r*98.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \left(-\frac{0.125}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}}\right)\right)\right)\right), x\right) \]
      10. distribute-neg-frac98.2%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \frac{\color{blue}{-0.125}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right)\right)\right), x\right) \]
      12. associate-*l*98.2%

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

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

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

Alternative 8: 99.1% accurate, 1.8× speedup?

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

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

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

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-\frac{0.5 - 0.125 \cdot \frac{1}{{x}^{2}}}{x}\right)}, x\right) \]
      2. distribute-neg-frac299.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5 - \frac{\color{blue}{0.125}}{x \cdot x}}{-x}\right), x\right) \]
      6. neg-mul-199.0%

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

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

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{\color{blue}{0.5}}{x \cdot x} - \frac{0.125}{{x}^{4}}\right)\right)\right), x\right) \]
      5. sub-neg98.2%

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \left(-\frac{0.125}{\color{blue}{{x}^{3} \cdot x}}\right)\right)\right)\right), x\right) \]
      8. unpow398.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \left(-\frac{0.125}{\color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \cdot x}\right)\right)\right)\right), x\right) \]
      9. associate-*r*98.2%

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \left(-\frac{0.125}{\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}}\right)\right)\right)\right), x\right) \]
      10. distribute-neg-frac98.2%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(2 + \left(\frac{0.5}{x \cdot x} + \frac{\color{blue}{-0.125}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right)\right)\right), x\right) \]
      12. associate-*l*98.2%

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

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

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

Alternative 9: 98.9% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(-\frac{0.5 - 0.125 \cdot \frac{1}{{x}^{2}}}{x}\right)}, x\right) \]
      2. distribute-neg-frac299.0%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\frac{0.5 - \frac{\color{blue}{0.125}}{x \cdot x}}{-x}\right), x\right) \]
      6. neg-mul-199.0%

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

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

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 97.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\frac{\color{blue}{x}}{x} + \left(1 + 0.5 \cdot \frac{1}{{x}^{2}}\right)\right)\right), x\right) \]
      10. unpow297.6%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\frac{x}{x} + \left(1 + \frac{0.5}{\color{blue}{{x}^{2}}}\right)\right)\right), x\right) \]
      14. unpow297.6%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 98.7% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 97.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\frac{\color{blue}{x}}{x} + \left(1 + 0.5 \cdot \frac{1}{{x}^{2}}\right)\right)\right), x\right) \]
      10. unpow297.6%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\frac{x}{x} + \left(1 + \frac{0.5}{\color{blue}{{x}^{2}}}\right)\right)\right), x\right) \]
      14. unpow297.6%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 98.5% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\mathsf{copysign}\left(x + x \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot -0.044642857142857144 + 0.075\right) + -0.16666666666666666\right)\right), 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 55.5%

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

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

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

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

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

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

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

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

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 97.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\frac{\color{blue}{x}}{x} + \left(1 + 0.5 \cdot \frac{1}{{x}^{2}}\right)\right)\right), x\right) \]
      10. unpow297.6%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x \cdot \left(\frac{x}{x} + \left(1 + \frac{0.5}{\color{blue}{{x}^{2}}}\right)\right)\right), x\right) \]
      14. unpow297.6%

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

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

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

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

Alternative 12: 85.2% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 43.7%

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

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

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

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

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

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

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

Alternative 13: 71.9% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 55.5%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around -inf 43.5%

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

    if -2 < x < 1

    1. Initial program 21.8%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 21.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative21.9%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} + \left(-0.125\right)\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      9. metadata-eval21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative21.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow221.9%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified21.9%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 99.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow299.6%

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \color{blue}{\left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right) \cdot \left(x \cdot x\right)}\right), x\right) \]
      3. sub-neg99.6%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified99.6%

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative99.6%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative99.6%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr99.6%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 43.7%

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

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

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

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

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

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

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

Alternative 14: 62.5% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 32.1%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 18.6%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + {x}^{2} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)}, x\right) \]
    4. Step-by-step derivation
      1. rem-square-sqrt7.0%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + {x}^{2} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      3. rem-square-sqrt18.8%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.5 + {x}^{2} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right), x\right) \]
      5. associate-*l*18.8%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(x \cdot x\right)} \cdot \left(0.0625 \cdot {x}^{2} - 0.125\right)\right)\right)\right)\right), x\right) \]
      7. *-commutative18.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(0.0625 \cdot {x}^{2} - 0.125\right) \cdot \left(x \cdot x\right)}\right)\right)\right)\right), x\right) \]
      8. sub-neg18.8%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(0.0625 \cdot {x}^{2} + \color{blue}{-0.125}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      10. +-commutative18.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \color{blue}{\left(-0.125 + 0.0625 \cdot {x}^{2}\right)} \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
      11. unpow218.8%

        \[\leadsto \mathsf{copysign}\left(\log \left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right), x\right) \]
    5. Simplified18.8%

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(x + x \cdot \left(x \cdot \left(0.5 + \left(-0.125 + 0.0625 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)\right)\right)\right)}, x\right) \]
    6. Taylor expanded in x around 0 71.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + -0.044642857142857144 \cdot {x}^{2}\right) - 0.16666666666666666\right)\right)}, x\right) \]
    7. Step-by-step derivation
      1. unpow271.4%

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) + \left(-0.16666666666666666\right)\right) \cdot \left(x \cdot x\right)\right), x\right) \]
      7. metadata-eval71.4%

        \[\leadsto \mathsf{copysign}\left(x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + \color{blue}{-0.16666666666666666}\right) \cdot \left(x \cdot x\right)\right), x\right) \]
    8. Simplified71.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x \cdot \left(1 + \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right)}, x\right) \]
    9. Step-by-step derivation
      1. distribute-rgt-in71.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{1 \cdot x + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x}, x\right) \]
      2. *-un-lft-identity71.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{x} + \left(\left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right) \cdot \left(x \cdot x\right)\right) \cdot x, x\right) \]
      3. *-commutative71.4%

        \[\leadsto \mathsf{copysign}\left(x + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(\left(0.075 + -0.044642857142857144 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right) + -0.16666666666666666\right)\right)} \cdot x, x\right) \]
      4. *-commutative71.4%

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

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(-0.044642857142857144 \cdot \left(x \cdot x\right) + 0.075\right)} + -0.16666666666666666\right)\right) \cdot x, x\right) \]
      6. *-commutative71.4%

        \[\leadsto \mathsf{copysign}\left(x + \left(\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right) \cdot -0.044642857142857144} + 0.075\right) + -0.16666666666666666\right)\right) \cdot x, x\right) \]
    10. Applied egg-rr71.4%

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

    if 1 < x

    1. Initial program 59.9%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 43.7%

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

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

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

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

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

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

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

Alternative 15: 54.2% 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 39.0%

    \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 30.4%

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

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

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

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

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

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

Developer target: 99.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{\left|x\right|}\\ \mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t\_0\right) + t\_0}\right), x\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary32
 (let* ((t_0 (/ 1.0 (fabs x))))
   (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
float code(float x) {
	float t_0 = 1.0f / fabsf(x);
	return copysignf(log1pf((fabsf(x) + (fabsf(x) / (hypotf(1.0f, t_0) + t_0)))), x);
}
function code(x)
	t_0 = Float32(Float32(1.0) / abs(x))
	return copysign(log1p(Float32(abs(x) + Float32(abs(x) / Float32(hypot(Float32(1.0), t_0) + t_0)))), x)
end
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t\_0\right) + t\_0}\right), x\right)
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024107 
(FPCore (x)
  :name "Rust f32::asinh"
  :precision binary32

  :alt
  (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)

  (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))