Rust f64::asinh

Percentage Accurate: 30.6% → 99.7%
Time: 8.6s
Alternatives: 12
Speedup: 2.0×

Specification

?
\[\begin{array}{l} \\ \sinh^{-1} x \end{array} \]
(FPCore (x) :precision binary64 (asinh x))
double code(double x) {
	return asinh(x);
}
def code(x):
	return math.asinh(x)
function code(x)
	return asinh(x)
end
function tmp = code(x)
	tmp = asinh(x);
end
code[x_] := N[ArcSinh[x], $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 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 12 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: 30.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 binary64
 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
double code(double x) {
	return copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
}
public static double code(double x) {
	return Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
}
def code(x):
	return math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
function code(x)
	return copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x)
end
function tmp = code(x)
	tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0)))));
end
code[x_] := N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.7% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.001:\\ \;\;\;\;\mathsf{copysign}\left(x + {x}^{3} \cdot -0.16666666666666666, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -1.25)
   (copysign (log (/ -0.5 x)) x)
   (if (<= x 0.001)
     (copysign (+ x (* (pow x 3.0) -0.16666666666666666)) x)
     (copysign (log (+ x (hypot 1.0 x))) x))))
double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = copysign(log((-0.5 / x)), x);
	} else if (x <= 0.001) {
		tmp = copysign((x + (pow(x, 3.0) * -0.16666666666666666)), x);
	} else {
		tmp = copysign(log((x + hypot(1.0, x))), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else if (x <= 0.001) {
		tmp = Math.copySign((x + (Math.pow(x, 3.0) * -0.16666666666666666)), x);
	} else {
		tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.25:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	elif x <= 0.001:
		tmp = math.copysign((x + (math.pow(x, 3.0) * -0.16666666666666666)), x)
	else:
		tmp = math.copysign(math.log((x + math.hypot(1.0, x))), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.25)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	elseif (x <= 0.001)
		tmp = copysign(Float64(x + Float64((x ^ 3.0) * -0.16666666666666666)), x);
	else
		tmp = copysign(log(Float64(x + hypot(1.0, x))), x);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -1.25)
		tmp = sign(x) * abs(log((-0.5 / x)));
	elseif (x <= 0.001)
		tmp = sign(x) * abs((x + ((x ^ 3.0) * -0.16666666666666666)));
	else
		tmp = sign(x) * abs(log((x + hypot(1.0, x))));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -1.25], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 0.001], N[With[{TMP1 = Abs[N[(x + N[(N[Power[x, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

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

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

    if -1.25 < x < 1e-3

    1. Initial program 9.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.8%

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

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

    if 1e-3 < x

    1. Initial program 38.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.5× 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 \cdot 10^{-6}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\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 binary64
 (if (<= (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x) -4e-6)
   (copysign (log (+ (fabs x) (hypot 1.0 x))) x)
   (copysign (log1p (+ x (+ (hypot 1.0 x) -1.0))) x)))
double code(double x) {
	double tmp;
	if (copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x) <= -4e-6) {
		tmp = copysign(log((fabs(x) + hypot(1.0, x))), x);
	} else {
		tmp = copysign(log1p((x + (hypot(1.0, x) + -1.0))), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x) <= -4e-6) {
		tmp = Math.copySign(Math.log((Math.abs(x) + Math.hypot(1.0, x))), x);
	} else {
		tmp = Math.copySign(Math.log1p((x + (Math.hypot(1.0, x) + -1.0))), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x) <= -4e-6:
		tmp = math.copysign(math.log((math.fabs(x) + math.hypot(1.0, x))), x)
	else:
		tmp = math.copysign(math.log1p((x + (math.hypot(1.0, x) + -1.0))), x)
	return tmp
function code(x)
	tmp = 0.0
	if (copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) <= -4e-6)
		tmp = copysign(log(Float64(abs(x) + hypot(1.0, x))), x);
	else
		tmp = copysign(log1p(Float64(x + Float64(hypot(1.0, x) + -1.0))), x);
	end
	return tmp
end
code[x_] := If[LessEqual[N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], -4e-6], N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(x + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\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 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\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.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -3.99999999999999982e-6

    1. Initial program 59.5%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\log \left(e^{\sqrt{x \cdot x + 1}}\right)}\right), x\right) \]
      2. *-un-lft-identity7.7%

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\left(\log 1 + \log \left(e^{\sqrt{x \cdot x + 1}}\right)\right)}\right), x\right) \]
      4. metadata-eval7.7%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left|x\right| + \left(\color{blue}{0} + \log \left(e^{\sqrt{x \cdot x + 1}}\right)\right)\right), x\right) \]
      5. add-log-exp59.5%

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

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

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

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

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

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

    if -3.99999999999999982e-6 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x)

    1. Initial program 18.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\left(\color{blue}{x} + \sqrt{x \cdot x + 1}\right) - 1\right), x\right) \]
      7. +-commutative18.5%

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

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

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

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

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

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

Alternative 3: 99.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -300:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \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 binary64
 (if (<= x -300.0)
   (copysign (log (+ (- (fabs x) x) (/ -0.5 x))) x)
   (copysign (log1p (+ x (+ (hypot 1.0 x) -1.0))) x)))
double code(double x) {
	double tmp;
	if (x <= -300.0) {
		tmp = copysign(log(((fabs(x) - x) + (-0.5 / x))), x);
	} else {
		tmp = copysign(log1p((x + (hypot(1.0, x) + -1.0))), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -300.0) {
		tmp = Math.copySign(Math.log(((Math.abs(x) - x) + (-0.5 / x))), x);
	} else {
		tmp = Math.copySign(Math.log1p((x + (Math.hypot(1.0, x) + -1.0))), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -300.0:
		tmp = math.copysign(math.log(((math.fabs(x) - x) + (-0.5 / x))), x)
	else:
		tmp = math.copysign(math.log1p((x + (math.hypot(1.0, x) + -1.0))), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -300.0)
		tmp = copysign(log(Float64(Float64(abs(x) - x) + Float64(-0.5 / x))), x);
	else
		tmp = copysign(log1p(Float64(x + Float64(hypot(1.0, x) + -1.0))), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -300.0], N[With[{TMP1 = Abs[N[Log[N[(N[(N[Abs[x], $MachinePrecision] - x), $MachinePrecision] + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(x + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -300:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \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 < -300

    1. Initial program 58.1%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac100.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      7. metadata-eval100.0%

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

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

    if -300 < x

    1. Initial program 19.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -300:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \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} \]
  5. Add Preprocessing

Alternative 4: 99.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9000:\\ \;\;\;\;\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 binary64
 (if (<= x -9000.0)
   (copysign (log (/ -0.5 x)) x)
   (copysign (log1p (+ x (+ (hypot 1.0 x) -1.0))) x)))
double code(double x) {
	double tmp;
	if (x <= -9000.0) {
		tmp = copysign(log((-0.5 / x)), x);
	} else {
		tmp = copysign(log1p((x + (hypot(1.0, x) + -1.0))), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -9000.0) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else {
		tmp = Math.copySign(Math.log1p((x + (Math.hypot(1.0, x) + -1.0))), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -9000.0:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	else:
		tmp = math.copysign(math.log1p((x + (math.hypot(1.0, x) + -1.0))), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -9000.0)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	else
		tmp = copysign(log1p(Float64(x + Float64(hypot(1.0, x) + -1.0))), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -9000.0], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(x + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -9000:\\
\;\;\;\;\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 < -9e3

    1. Initial program 57.4%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac100.0%

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]
      7. metadata-eval100.0%

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

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

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

    if -9e3 < x

    1. Initial program 20.3%

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

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\left(\left|x\right| + \sqrt{x \cdot x + 1}\right)} - 1\right), x\right) \]
      4. add-sqr-sqrt16.2%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9000:\\ \;\;\;\;\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} \]
  5. Add Preprocessing

Alternative 5: 99.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.95:\\ \;\;\;\;\mathsf{copysign}\left(x + {x}^{3} \cdot -0.16666666666666666, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(\frac{0.5}{x} + \left(-1 + x \cdot 2\right)\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -1.25)
   (copysign (log (/ -0.5 x)) x)
   (if (<= x 0.95)
     (copysign (+ x (* (pow x 3.0) -0.16666666666666666)) x)
     (copysign (log1p (+ (/ 0.5 x) (+ -1.0 (* x 2.0)))) x))))
double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = copysign(log((-0.5 / x)), x);
	} else if (x <= 0.95) {
		tmp = copysign((x + (pow(x, 3.0) * -0.16666666666666666)), x);
	} else {
		tmp = copysign(log1p(((0.5 / x) + (-1.0 + (x * 2.0)))), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else if (x <= 0.95) {
		tmp = Math.copySign((x + (Math.pow(x, 3.0) * -0.16666666666666666)), x);
	} else {
		tmp = Math.copySign(Math.log1p(((0.5 / x) + (-1.0 + (x * 2.0)))), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.25:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	elif x <= 0.95:
		tmp = math.copysign((x + (math.pow(x, 3.0) * -0.16666666666666666)), x)
	else:
		tmp = math.copysign(math.log1p(((0.5 / x) + (-1.0 + (x * 2.0)))), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.25)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	elseif (x <= 0.95)
		tmp = copysign(Float64(x + Float64((x ^ 3.0) * -0.16666666666666666)), x);
	else
		tmp = copysign(log1p(Float64(Float64(0.5 / x) + Float64(-1.0 + Float64(x * 2.0)))), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -1.25], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 0.95], N[With[{TMP1 = Abs[N[(x + N[(N[Power[x, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(N[(0.5 / x), $MachinePrecision] + N[(-1.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

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

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

    if -1.25 < x < 0.94999999999999996

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.3%

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

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

    if 0.94999999999999996 < x

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\color{blue}{\left(0.5 \cdot \frac{1}{x} + 2 \cdot x\right) - 1}\right), x\right) \]
    8. Step-by-step derivation
      1. associate--l+100.0%

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

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

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\frac{\color{blue}{0.5}}{x} + \left(2 \cdot x - 1\right)\right), x\right) \]
      4. sub-neg100.0%

        \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(\frac{0.5}{x} + \color{blue}{\left(2 \cdot x + \left(-1\right)\right)}\right), x\right) \]
      5. *-commutative100.0%

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

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

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

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

Alternative 6: 99.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1.3:\\ \;\;\;\;\mathsf{copysign}\left(x + {x}^{3} \cdot -0.16666666666666666, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x \cdot 2 + -1\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -1.25)
   (copysign (log (/ -0.5 x)) x)
   (if (<= x 1.3)
     (copysign (+ x (* (pow x 3.0) -0.16666666666666666)) x)
     (copysign (log1p (+ (* x 2.0) -1.0)) x))))
double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = copysign(log((-0.5 / x)), x);
	} else if (x <= 1.3) {
		tmp = copysign((x + (pow(x, 3.0) * -0.16666666666666666)), x);
	} else {
		tmp = copysign(log1p(((x * 2.0) + -1.0)), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else if (x <= 1.3) {
		tmp = Math.copySign((x + (Math.pow(x, 3.0) * -0.16666666666666666)), x);
	} else {
		tmp = Math.copySign(Math.log1p(((x * 2.0) + -1.0)), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.25:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	elif x <= 1.3:
		tmp = math.copysign((x + (math.pow(x, 3.0) * -0.16666666666666666)), x)
	else:
		tmp = math.copysign(math.log1p(((x * 2.0) + -1.0)), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.25)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	elseif (x <= 1.3)
		tmp = copysign(Float64(x + Float64((x ^ 3.0) * -0.16666666666666666)), x);
	else
		tmp = copysign(log1p(Float64(Float64(x * 2.0) + -1.0)), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -1.25], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 1.3], N[With[{TMP1 = Abs[N[(x + N[(N[Power[x, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(N[(x * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

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

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

    if -1.25 < x < 1.30000000000000004

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{x + -0.16666666666666666 \cdot {x}^{3}}, x\right) \]
    8. Step-by-step derivation
      1. *-commutative99.3%

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

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

    if 1.30000000000000004 < x

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.6% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.72:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x \cdot 2 + -1\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -0.72)
   (copysign (log (/ -0.5 x)) x)
   (if (<= x 1.0)
     (copysign (log1p x) x)
     (copysign (log1p (+ (* x 2.0) -1.0)) x))))
double code(double x) {
	double tmp;
	if (x <= -0.72) {
		tmp = copysign(log((-0.5 / x)), x);
	} else if (x <= 1.0) {
		tmp = copysign(log1p(x), x);
	} else {
		tmp = copysign(log1p(((x * 2.0) + -1.0)), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -0.72) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else if (x <= 1.0) {
		tmp = Math.copySign(Math.log1p(x), x);
	} else {
		tmp = Math.copySign(Math.log1p(((x * 2.0) + -1.0)), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -0.72:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	elif x <= 1.0:
		tmp = math.copysign(math.log1p(x), x)
	else:
		tmp = math.copysign(math.log1p(((x * 2.0) + -1.0)), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -0.72)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	elseif (x <= 1.0)
		tmp = copysign(log1p(x), x);
	else
		tmp = copysign(log1p(Float64(Float64(x * 2.0) + -1.0)), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -0.72], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 1.0], N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(N[(x * 2.0), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

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

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

    if -0.71999999999999997 < x < 1

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < x

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 98.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.72:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 0.95:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -0.72)
   (copysign (log (/ -0.5 x)) x)
   (if (<= x 0.95) (copysign (log1p x) x) (copysign (log1p (+ x x)) x))))
double code(double x) {
	double tmp;
	if (x <= -0.72) {
		tmp = copysign(log((-0.5 / x)), x);
	} else if (x <= 0.95) {
		tmp = copysign(log1p(x), x);
	} else {
		tmp = copysign(log1p((x + x)), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -0.72) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else if (x <= 0.95) {
		tmp = Math.copySign(Math.log1p(x), x);
	} else {
		tmp = Math.copySign(Math.log1p((x + x)), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -0.72:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	elif x <= 0.95:
		tmp = math.copysign(math.log1p(x), x)
	else:
		tmp = math.copysign(math.log1p((x + x)), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -0.72)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	elseif (x <= 0.95)
		tmp = copysign(log1p(x), x);
	else
		tmp = copysign(log1p(Float64(x + x)), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -0.72], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 0.95], N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + N[(x + x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

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

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

    if -0.71999999999999997 < x < 0.94999999999999996

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.94999999999999996 < x

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 81.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.72:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -0.72) (copysign (log (/ -0.5 x)) x) (copysign (log1p x) x)))
double code(double x) {
	double tmp;
	if (x <= -0.72) {
		tmp = copysign(log((-0.5 / x)), x);
	} else {
		tmp = copysign(log1p(x), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -0.72) {
		tmp = Math.copySign(Math.log((-0.5 / x)), x);
	} else {
		tmp = Math.copySign(Math.log1p(x), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -0.72:
		tmp = math.copysign(math.log((-0.5 / x)), x)
	else:
		tmp = math.copysign(math.log1p(x), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -0.72)
		tmp = copysign(log(Float64(-0.5 / x)), x);
	else
		tmp = copysign(log1p(x), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -0.72], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.72:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{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.71999999999999997

    1. Initial program 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

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

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

    if -0.71999999999999997 < x

    1. Initial program 19.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0 + \mathsf{log1p}\left(x\right)}, x\right) \]
    6. Step-by-step derivation
      1. +-lft-identity74.5%

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

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

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

Alternative 10: 64.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 binary64
 (if (<= x -0.5) (copysign (log (- x)) x) (copysign (log1p x) x)))
double code(double x) {
	double tmp;
	if (x <= -0.5) {
		tmp = copysign(log(-x), x);
	} else {
		tmp = copysign(log1p(x), x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -0.5) {
		tmp = Math.copySign(Math.log(-x), x);
	} else {
		tmp = Math.copySign(Math.log1p(x), x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -0.5:
		tmp = math.copysign(math.log(-x), x)
	else:
		tmp = math.copysign(math.log1p(x), x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -0.5)
		tmp = copysign(log(Float64(-x)), x);
	else
		tmp = copysign(log1p(x), x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -0.5], N[With[{TMP1 = Abs[N[Log[(-x)], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\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 58.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{copysign}\left(\log \left(\left(\left|x\right| - x\right) + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]
      6. distribute-neg-frac99.4%

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

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

      \[\leadsto \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| - x\right) + \frac{-0.5}{x}\right)}, x\right) \]
    6. Taylor expanded in x around inf 31.0%

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

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

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

    if -0.5 < x

    1. Initial program 19.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(\color{blue}{0 + \mathsf{log1p}\left(x\right)}, x\right) \]
    6. Step-by-step derivation
      1. +-lft-identity74.5%

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

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

    \[\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} \]
  5. Add Preprocessing

Alternative 11: 9.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \mathsf{copysign}\left(\log x, x\right) \end{array} \]
(FPCore (x) :precision binary64 (copysign (log x) x))
double code(double x) {
	return copysign(log(x), x);
}
public static double code(double x) {
	return Math.copySign(Math.log(x), x);
}
def code(x):
	return math.copysign(math.log(x), x)
function code(x)
	return copysign(log(x), x)
end
function tmp = code(x)
	tmp = sign(x) * abs(log(x));
end
code[x_] := N[With[{TMP1 = Abs[N[Log[x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
\begin{array}{l}

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

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

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

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

      \[\leadsto \mathsf{copysign}\left(-\color{blue}{\left(-\log x\right)}, x\right) \]
    3. remove-double-neg9.4%

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

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

    \[\leadsto \mathsf{copysign}\left(\log x, x\right) \]
  7. Add Preprocessing

Alternative 12: 56.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right) \end{array} \]
(FPCore (x) :precision binary64 (copysign (log1p x) x))
double code(double x) {
	return copysign(log1p(x), x);
}
public static double code(double x) {
	return Math.copySign(Math.log1p(x), x);
}
def code(x):
	return math.copysign(math.log1p(x), x)
function code(x)
	return copysign(log1p(x), x)
end
code[x_] := N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right) \]
  9. Add Preprocessing

Developer target: 100.0% 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 binary64
 (let* ((t_0 (/ 1.0 (fabs x))))
   (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
double code(double x) {
	double t_0 = 1.0 / fabs(x);
	return copysign(log1p((fabs(x) + (fabs(x) / (hypot(1.0, t_0) + t_0)))), x);
}
public static double code(double x) {
	double t_0 = 1.0 / Math.abs(x);
	return Math.copySign(Math.log1p((Math.abs(x) + (Math.abs(x) / (Math.hypot(1.0, t_0) + t_0)))), x);
}
def code(x):
	t_0 = 1.0 / math.fabs(x)
	return math.copysign(math.log1p((math.fabs(x) + (math.fabs(x) / (math.hypot(1.0, t_0) + t_0)))), x)
function code(x)
	t_0 = Float64(1.0 / abs(x))
	return copysign(log1p(Float64(abs(x) + Float64(abs(x) / Float64(hypot(1.0, t_0) + t_0)))), x)
end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[With[{TMP1 = Abs[N[Log[1 + N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + t$95$0 ^ 2], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\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 2024048 
(FPCore (x)
  :name "Rust f64::asinh"
  :precision binary64

  :alt
  (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)

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