Rust f32::asinh

Percentage Accurate: 37.6% → 98.4%
Time: 8.6s
Alternatives: 11
Speedup: 4.0×

Specification

?
\[\begin{array}{l} \\ \sinh^{-1} x \end{array} \]
(FPCore (x) :precision binary32 (asinh x))
float code(float x) {
	return asinhf(x);
}
function code(x)
	return asinh(x)
end
function tmp = code(x)
	tmp = asinh(x);
end
\begin{array}{l}

\\
\sinh^{-1} x
\end{array}

Sampling outcomes in binary32 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 37.6% accurate, 1.0× speedup?

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

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

Alternative 1: 98.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -4:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.125}{{x}^{3}} - \frac{0.5}{x}\right), x\right)\\

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


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

    1. Initial program 46.8%

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

        \[\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. Step-by-step derivation
      1. +-lft-identity98.6%

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(0.125 \cdot \frac{1}{{x}^{3}} - 0.5 \cdot \frac{1}{x}\right)} + 0, x\right) \]
    7. Step-by-step derivation
      1. associate-*r/100.0%

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

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

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

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

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

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

    1. Initial program 32.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)} - 1\right), x\right) \]
      4. associate--l+97.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -4:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.125}{{x}^{3}} - \frac{0.5}{x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) + -1\right)\right), x\right)\\ \end{array} \]

Alternative 2: 98.2% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

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

    if -50 < x

    1. Initial program 33.2%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right)} - 1\right), x\right) \]
      4. associate--l+97.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -50:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) + -1\right)\right), x\right)\\ \end{array} \]

Alternative 3: 97.8% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 48.3%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-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. Step-by-step derivation
      1. +-lft-identity98.6%

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

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

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

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

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

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

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

    if -1 < x < 0.0500000007

    1. Initial program 22.8%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
    5. Step-by-step derivation
      1. *-un-lft-identity21.9%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right| + 0.5 \cdot {x}^{2}\right)} + 0, x\right) \]
      6. +-commutative98.6%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt48.2%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt98.4%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
    6. Applied egg-rr98.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity98.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef98.4%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + x}\right), x\right) \]
      3. *-commutative98.4%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified98.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 98.8%

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

    if 0.0500000007 < x

    1. Initial program 50.9%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.9% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 48.3%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-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. Step-by-step derivation
      1. +-lft-identity98.6%

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

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

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

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

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

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

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

    if -1 < x < 1.5

    1. Initial program 23.4%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
    5. Step-by-step derivation
      1. *-un-lft-identity22.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt48.1%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
    6. Applied egg-rr98.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity98.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + x}\right), x\right) \]
      3. *-commutative98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{{x}^{2} \cdot 0.5} + x\right), x\right) \]
      4. fma-udef98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified98.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 98.3%

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

    if 1.5 < x

    1. Initial program 50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{-x}\right|\right) + 0, x\right) \]
      12. neg-fabs96.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
      3. *-commutative96.0%

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

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

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

Alternative 5: 83.5% accurate, 2.0× speedup?

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

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

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

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


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

    1. Initial program 47.5%

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

        \[\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. Taylor expanded in x around -inf 44.8%

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

    if -2 < x < 1.5

    1. Initial program 24.0%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
    5. Step-by-step derivation
      1. *-un-lft-identity22.1%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right) + 0}, x\right) \]
      5. log1p-def97.7%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + \left|x\right|}\right) + 0, x\right) \]
      7. fma-def97.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt47.8%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt97.4%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
    6. Applied egg-rr97.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity97.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef97.4%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + x}\right), x\right) \]
      3. *-commutative97.4%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified97.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 96.8%

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

    if 1.5 < x

    1. Initial program 50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{-x}\right|\right) + 0, x\right) \]
      12. neg-fabs96.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
      3. *-commutative96.0%

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

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

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

Alternative 6: 83.5% accurate, 2.0× speedup?

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

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

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

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


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

    1. Initial program 47.5%

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

        \[\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. Taylor expanded in x around -inf 96.5%

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

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

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

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

    if -2 < x < 1.5

    1. Initial program 24.0%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
    5. Step-by-step derivation
      1. *-un-lft-identity22.1%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right) + 0}, x\right) \]
      5. log1p-def97.7%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + \left|x\right|}\right) + 0, x\right) \]
      7. fma-def97.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt47.8%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt97.4%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
    6. Applied egg-rr97.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity97.4%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef97.4%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + x}\right), x\right) \]
      3. *-commutative97.4%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified97.4%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 96.8%

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

    if 1.5 < x

    1. Initial program 50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{-x}\right|\right) + 0, x\right) \]
      12. neg-fabs96.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
      3. *-commutative96.0%

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

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

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

Alternative 7: 97.1% accurate, 2.0× speedup?

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

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

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

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


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

    1. Initial program 48.3%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right) \]
      2. hypot-1-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. Step-by-step derivation
      1. +-lft-identity98.6%

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

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

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

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

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

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

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

    if -1 < x < 1.5

    1. Initial program 23.4%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
    5. Step-by-step derivation
      1. *-un-lft-identity22.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt48.1%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
    6. Applied egg-rr98.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity98.0%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + x}\right), x\right) \]
      3. *-commutative98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{{x}^{2} \cdot 0.5} + x\right), x\right) \]
      4. fma-udef98.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified98.0%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 97.3%

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

    if 1.5 < x

    1. Initial program 50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(x + \left|\color{blue}{-x}\right|\right) + 0, x\right) \]
      12. neg-fabs96.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(2 \cdot x\right)}, x\right) \]
      3. *-commutative96.0%

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

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

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

Alternative 8: 68.6% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 49.7%

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

        \[\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. Taylor expanded in x around -inf 44.1%

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

    if -0.5 < x

    1. Initial program 31.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right|\right)} + 0, x\right) \]
      7. add-sqr-sqrt45.7%

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right) + 0}, x\right) \]
    8. Step-by-step derivation
      1. +-rgt-identity78.1%

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

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

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

Alternative 9: 61.9% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 32.9%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right) + 0}, x\right) \]
      5. log1p-def69.7%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right| + 0.5 \cdot {x}^{2}\right)} + 0, x\right) \]
      6. +-commutative69.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + \left|x\right|}\right) + 0, x\right) \]
      7. fma-def69.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt31.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right) + 0, x\right) \]
      9. fabs-sqr31.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt69.6%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
    6. Applied egg-rr69.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity69.6%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef69.6%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + x}\right), x\right) \]
      3. *-commutative69.6%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{{x}^{2} \cdot 0.5} + x\right), x\right) \]
      4. fma-udef69.6%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified69.6%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 67.2%

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

    if 5 < x

    1. Initial program 47.5%

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

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

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

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

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

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

Alternative 10: 61.9% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 31.9%

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
    5. Step-by-step derivation
      1. *-un-lft-identity20.2%

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right| + 0.5 \cdot {x}^{2}\right)} + 0, x\right) \]
      6. +-commutative70.3%

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
      8. add-sqr-sqrt31.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right) + 0, x\right) \]
      9. fabs-sqr31.7%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
      10. add-sqr-sqrt70.1%

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
    7. Step-by-step derivation
      1. +-rgt-identity70.1%

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
      2. fma-udef70.1%

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
    8. Simplified70.1%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
    9. Taylor expanded in x around 0 67.8%

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

    if 1.5 < x

    1. Initial program 50.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right|\right)} + 0, x\right) \]
      7. add-sqr-sqrt44.1%

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(x\right) + 0}, x\right) \]
    8. Step-by-step derivation
      1. +-rgt-identity44.1%

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

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

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

Alternative 11: 53.7% accurate, 4.0× speedup?

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right)}, x\right) \]
  5. Step-by-step derivation
    1. *-un-lft-identity19.5%

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\log \left(1 + \left(\left|x\right| + 0.5 \cdot {x}^{2}\right)\right) + 0}, x\right) \]
    5. log1p-def57.8%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\left|x\right| + 0.5 \cdot {x}^{2}\right)} + 0, x\right) \]
    6. +-commutative57.8%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{0.5 \cdot {x}^{2} + \left|x\right|}\right) + 0, x\right) \]
    7. fma-def57.8%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left(0.5, {x}^{2}, \left|x\right|\right)}\right) + 0, x\right) \]
    8. add-sqr-sqrt28.3%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)\right) + 0, x\right) \]
    9. fabs-sqr28.3%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{\sqrt{x} \cdot \sqrt{x}}\right)\right) + 0, x\right) \]
    10. add-sqr-sqrt57.7%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, \color{blue}{x}\right)\right) + 0, x\right) \]
  6. Applied egg-rr57.7%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right) + 0}, x\right) \]
  7. Step-by-step derivation
    1. +-rgt-identity57.7%

      \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left(0.5, {x}^{2}, x\right)\right)}, x\right) \]
    2. fma-udef57.7%

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

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

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, 0.5, x\right)}\right), x\right) \]
  8. Simplified57.7%

    \[\leadsto \mathsf{copysign}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{fma}\left({x}^{2}, 0.5, x\right)\right)}, x\right) \]
  9. Taylor expanded in x around 0 54.6%

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

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

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 2023326 
(FPCore (x)
  :name "Rust f32::asinh"
  :precision binary32

  :herbie-target
  (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)

  (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))