?

Average Accuracy: 29.4% → 99.7%
Time: 9.4s
Precision: binary64
Cost: 19784

?

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

\mathbf{elif}\;x \leq 0.0033:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{2 + \left(x \cdot x\right) \cdot 0.5}\right), x\right)\\

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


\end{array}

Error?

Target

Original29.4%
Target99.9%
Herbie99.7%
\[\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, \frac{1}{\left|x\right|}\right) + \frac{1}{\left|x\right|}}\right), x\right) \]

Derivation?

  1. Split input into 3 regimes
  2. if x < -1.3500000000000001

    1. Initial program 49.0%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Simplified99.9%

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

      [Start]49.0

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

      +-commutative [=>]49.0

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

      hypot-1-def [=>]99.9

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

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

      [Start]99.9

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

      log1p-expm1-u [=>]99.9

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

      expm1-udef [=>]99.9

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

      add-exp-log [<=]99.9

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

      add-sqr-sqrt [=>]0.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) - 1\right), x\right) \]

      fabs-sqr [=>]0.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) - 1\right), x\right) \]

      add-sqr-sqrt [<=]1.0

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

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

      [Start]1.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(1, x\right)\right) - 1\right), x\right) \]

      associate--l+ [=>]4.0

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

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

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

      [Start]2.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(-\left(1 + 0.5 \cdot \frac{1}{x}\right)\right), x\right) \]

      distribute-neg-in [=>]2.3

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

      metadata-eval [=>]2.3

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

      associate-*r/ [=>]2.3

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

      metadata-eval [=>]2.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(-1 + \left(-\frac{\color{blue}{0.5}}{x}\right)\right), x\right) \]

      distribute-neg-frac [=>]2.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(-1 + \color{blue}{\frac{-0.5}{x}}\right), x\right) \]

      metadata-eval [=>]2.3

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

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

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

      [Start]0.0

      \[ \mathsf{copysign}\left(\log -0.5 + -1 \cdot \log x, x\right) \]

      mul-1-neg [=>]0.0

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

      unsub-neg [=>]0.0

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

      log-div [<=]99.5

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

    if -1.3500000000000001 < x < 0.0033

    1. Initial program 8.2%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Simplified8.2%

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

      [Start]8.2

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

      +-commutative [=>]8.2

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

      hypot-1-def [=>]8.2

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

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

      [Start]8.2

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

      log1p-expm1-u [=>]8.2

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

      expm1-udef [=>]8.2

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

      add-exp-log [<=]8.2

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

      add-sqr-sqrt [=>]3.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \mathsf{hypot}\left(1, x\right)\right) - 1\right), x\right) \]

      fabs-sqr [=>]3.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right) - 1\right), x\right) \]

      add-sqr-sqrt [<=]8.3

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

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

      [Start]8.3

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(1, x\right)\right) - 1\right), x\right) \]

      associate--l+ [=>]99.0

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

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(x \cdot x + 0\right) \cdot \frac{1}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      Proof

      [Start]99.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) - 1\right)\right), x\right) \]

      flip-- [=>]99.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right) - 1 \cdot 1}{\mathsf{hypot}\left(1, x\right) + 1}}\right), x\right) \]

      div-inv [=>]99.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right) - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}}\right), x\right) \]

      hypot-udef [=>]99.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\sqrt{1 \cdot 1 + x \cdot x}} \cdot \mathsf{hypot}\left(1, x\right) - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      hypot-udef [=>]99.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\sqrt{1 \cdot 1 + x \cdot x} \cdot \color{blue}{\sqrt{1 \cdot 1 + x \cdot x}} - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      add-sqr-sqrt [<=]99.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\left(1 \cdot 1 + x \cdot x\right)} - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      metadata-eval [=>]99.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\left(\color{blue}{1} + x \cdot x\right) - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      +-commutative [=>]99.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\color{blue}{\left(x \cdot x + 1\right)} - 1 \cdot 1\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      metadata-eval [=>]99.1

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\left(x \cdot x + 1\right) - \color{blue}{1}\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      associate--l+ [=>]100.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\left(x \cdot x + \left(1 - 1\right)\right)} \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      metadata-eval [=>]100.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(x \cdot x + \color{blue}{0}\right) \cdot \frac{1}{\mathsf{hypot}\left(1, x\right) + 1}\right), x\right) \]

      +-commutative [=>]100.0

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

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{x \cdot x}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]
      Proof

      [Start]100.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(x \cdot x + 0\right) \cdot \frac{1}{1 + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]

      associate-*r/ [=>]100.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \color{blue}{\frac{\left(x \cdot x + 0\right) \cdot 1}{1 + \mathsf{hypot}\left(1, x\right)}}\right), x\right) \]

      +-rgt-identity [=>]100.0

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{\color{blue}{\left(x \cdot x\right)} \cdot 1}{1 + \mathsf{hypot}\left(1, x\right)}\right), x\right) \]

      *-rgt-identity [=>]100.0

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

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{\color{blue}{2 + 0.5 \cdot {x}^{2}}}\right), x\right) \]
    8. Simplified99.8%

      \[\leadsto \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{\color{blue}{2 + 0.5 \cdot \left(x \cdot x\right)}}\right), x\right) \]
      Proof

      [Start]99.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{2 + 0.5 \cdot {x}^{2}}\right), x\right) \]

      unpow2 [=>]99.8

      \[ \mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{2 + 0.5 \cdot \color{blue}{\left(x \cdot x\right)}}\right), x\right) \]

    if 0.0033 < x

    1. Initial program 51.7%

      \[\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \]
    2. Simplified99.7%

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

      [Start]51.7

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

      +-commutative [=>]51.7

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

      hypot-1-def [=>]99.7

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

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

      [Start]99.7

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

      *-un-lft-identity [=>]99.7

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

      log-prod [=>]99.7

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

      metadata-eval [=>]99.7

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

      add-sqr-sqrt [=>]99.7

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

      fabs-sqr [=>]99.7

      \[ \mathsf{copysign}\left(0 + \log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \mathsf{hypot}\left(1, x\right)\right), x\right) \]

      add-sqr-sqrt [<=]99.7

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

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

      [Start]99.7

      \[ \mathsf{copysign}\left(0 + \log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right) \]

      +-lft-identity [=>]99.7

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

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

Alternatives

Alternative 1
Accuracy99.3%
Cost45828
\[\begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right) \leq -20:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(1, x\right) + -1\right)\right), x\right)\\ \end{array} \]
Alternative 2
Accuracy99.5%
Cost13960
\[\begin{array}{l} \mathbf{if}\;x \leq -1.35:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\ \mathbf{elif}\;x \leq 1.3:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \frac{x \cdot x}{2 + \left(x \cdot x\right) \cdot 0.5}\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\frac{0.5}{x} + \left(x + -1\right)\right)\right), x\right)\\ \end{array} \]
Alternative 3
Accuracy99.4%
Cost13704
\[\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 + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x + \left(\frac{0.5}{x} + \left(x + -1\right)\right)\right), x\right)\\ \end{array} \]
Alternative 4
Accuracy99.3%
Cost13512
\[\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.25:\\ \;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\ \end{array} \]
Alternative 5
Accuracy99.0%
Cost13320
\[\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.25:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\ \end{array} \]
Alternative 6
Accuracy76.0%
Cost13188
\[\begin{array}{l} \mathbf{if}\;x \leq 1.25:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\ \end{array} \]
Alternative 7
Accuracy58.7%
Cost13060
\[\begin{array}{l} \mathbf{if}\;x \leq 1.6:\\ \;\;\;\;\mathsf{copysign}\left(x, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\ \end{array} \]
Alternative 8
Accuracy52.1%
Cost6528
\[\mathsf{copysign}\left(x, x\right) \]

Error

Reproduce?

herbie shell --seed 2023143 
(FPCore (x)
  :name "Rust f64::asinh"
  :precision binary64

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

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