Hyperbolic arcsine

Percentage Accurate: 17.7% → 99.9%
Time: 8.5s
Alternatives: 12
Speedup: 18.8×

Specification

?
\[\begin{array}{l} \\ \log \left(x + \sqrt{x \cdot x + 1}\right) \end{array} \]
(FPCore (x) :precision binary64 (log (+ x (sqrt (+ (* x x) 1.0)))))
double code(double x) {
	return log((x + sqrt(((x * x) + 1.0))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = log((x + sqrt(((x * x) + 1.0d0))))
end function
public static double code(double x) {
	return Math.log((x + Math.sqrt(((x * x) + 1.0))));
}
def code(x):
	return math.log((x + math.sqrt(((x * x) + 1.0))))
function code(x)
	return log(Float64(x + sqrt(Float64(Float64(x * x) + 1.0))))
end
function tmp = code(x)
	tmp = log((x + sqrt(((x * x) + 1.0))));
end
code[x_] := N[Log[N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\log \left(x + \sqrt{x \cdot x + 1}\right)
\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: 17.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \log \left(x + \sqrt{x \cdot x + 1}\right) \end{array} \]
(FPCore (x) :precision binary64 (log (+ x (sqrt (+ (* x x) 1.0)))))
double code(double x) {
	return log((x + sqrt(((x * x) + 1.0))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = log((x + sqrt(((x * x) + 1.0d0))))
end function
public static double code(double x) {
	return Math.log((x + Math.sqrt(((x * x) + 1.0))));
}
def code(x):
	return math.log((x + math.sqrt(((x * x) + 1.0))))
function code(x)
	return log(Float64(x + sqrt(Float64(Float64(x * x) + 1.0))))
end
function tmp = code(x)
	tmp = log((x + sqrt(((x * x) + 1.0))));
end
code[x_] := N[Log[N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\log \left(x + \sqrt{x \cdot x + 1}\right)
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 0.001:\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\

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


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.80000000000000031e-4 < x < 1e-3

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in100.0%

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

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

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

        \[\leadsto x + -0.16666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right) \]
      5. unpow3100.0%

        \[\leadsto x + -0.16666666666666666 \cdot \color{blue}{{x}^{3}} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{x + -0.16666666666666666 \cdot {x}^{3}} \]

    if 1e-3 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

Alternative 2: 99.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \leq 0.001:\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\

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


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

    if -1.25 < x < 1e-3

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in100.0%

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

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

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

        \[\leadsto x + -0.16666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right) \]
      5. unpow3100.0%

        \[\leadsto x + -0.16666666666666666 \cdot \color{blue}{{x}^{3}} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{x + -0.16666666666666666 \cdot {x}^{3}} \]

    if 1e-3 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

Alternative 3: 99.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\log \left(\frac{-0.5}{x}\right)\\ \mathbf{elif}\;x \leq 1.26:\\ \;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;-\log \left(\frac{0.5}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -1.25)
   (log (/ -0.5 x))
   (if (<= x 1.26)
     (+ x (* -0.16666666666666666 (pow x 3.0)))
     (- (log (/ 0.5 x))))))
double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = log((-0.5 / x));
	} else if (x <= 1.26) {
		tmp = x + (-0.16666666666666666 * pow(x, 3.0));
	} else {
		tmp = -log((0.5 / x));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-1.25d0)) then
        tmp = log(((-0.5d0) / x))
    else if (x <= 1.26d0) then
        tmp = x + ((-0.16666666666666666d0) * (x ** 3.0d0))
    else
        tmp = -log((0.5d0 / x))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = Math.log((-0.5 / x));
	} else if (x <= 1.26) {
		tmp = x + (-0.16666666666666666 * Math.pow(x, 3.0));
	} else {
		tmp = -Math.log((0.5 / x));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.25:
		tmp = math.log((-0.5 / x))
	elif x <= 1.26:
		tmp = x + (-0.16666666666666666 * math.pow(x, 3.0))
	else:
		tmp = -math.log((0.5 / x))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.25)
		tmp = log(Float64(-0.5 / x));
	elseif (x <= 1.26)
		tmp = Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0)));
	else
		tmp = Float64(-log(Float64(0.5 / x)));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -1.25)
		tmp = log((-0.5 / x));
	elseif (x <= 1.26)
		tmp = x + (-0.16666666666666666 * (x ^ 3.0));
	else
		tmp = -log((0.5 / x));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -1.25], N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.26], N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[Log[N[(0.5 / x), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.26:\\
\;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\

\mathbf{else}:\\
\;\;\;\;-\log \left(\frac{0.5}{x}\right)\\


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

    if -1.25 < x < 1.26000000000000001

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)} \]
    6. Step-by-step derivation
      1. distribute-rgt-in100.0%

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

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

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

        \[\leadsto x + -0.16666666666666666 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right) \]
      5. unpow3100.0%

        \[\leadsto x + -0.16666666666666666 \cdot \color{blue}{{x}^{3}} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{x + -0.16666666666666666 \cdot {x}^{3}} \]

    if 1.26000000000000001 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

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

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

        \[\leadsto \color{blue}{\log \left(-\left(x \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      4. pow22.6%

        \[\leadsto \log \left(-\left(\color{blue}{{x}^{2}} - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      5. hypot-1-def2.6%

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

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

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

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

        \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    6. Applied egg-rr2.6%

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      7. metadata-eval5.6%

        \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      8. neg-sub05.6%

        \[\leadsto \color{blue}{-\log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      9. neg-sub05.6%

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

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

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

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

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

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

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

Alternative 4: 99.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\log \left(\frac{-0.5}{x}\right)\\ \mathbf{elif}\;x \leq 1.26:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;-\log \left(\frac{0.5}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -1.25) (log (/ -0.5 x)) (if (<= x 1.26) x (- (log (/ 0.5 x))))))
double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = log((-0.5 / x));
	} else if (x <= 1.26) {
		tmp = x;
	} else {
		tmp = -log((0.5 / x));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-1.25d0)) then
        tmp = log(((-0.5d0) / x))
    else if (x <= 1.26d0) then
        tmp = x
    else
        tmp = -log((0.5d0 / x))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = Math.log((-0.5 / x));
	} else if (x <= 1.26) {
		tmp = x;
	} else {
		tmp = -Math.log((0.5 / x));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.25:
		tmp = math.log((-0.5 / x))
	elif x <= 1.26:
		tmp = x
	else:
		tmp = -math.log((0.5 / x))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.25)
		tmp = log(Float64(-0.5 / x));
	elseif (x <= 1.26)
		tmp = x;
	else
		tmp = Float64(-log(Float64(0.5 / x)));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -1.25)
		tmp = log((-0.5 / x));
	elseif (x <= 1.26)
		tmp = x;
	else
		tmp = -log((0.5 / x));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -1.25], N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.26], x, (-N[Log[N[(0.5 / x), $MachinePrecision]], $MachinePrecision])]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.26:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;-\log \left(\frac{0.5}{x}\right)\\


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

    if -1.25 < x < 1.26000000000000001

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x} \]

    if 1.26000000000000001 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

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

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

        \[\leadsto \color{blue}{\log \left(-\left(x \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      4. pow22.6%

        \[\leadsto \log \left(-\left(\color{blue}{{x}^{2}} - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      5. hypot-1-def2.6%

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

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

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

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

        \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    6. Applied egg-rr2.6%

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      7. metadata-eval5.6%

        \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      8. neg-sub05.6%

        \[\leadsto \color{blue}{-\log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      9. neg-sub05.6%

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

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

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

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

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

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

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

Alternative 5: 99.0% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.25:\\ \;\;\;\;\log \left(\frac{-0.5}{x}\right)\\ \mathbf{elif}\;x \leq 1.26:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\log \left(x \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -1.25) (log (/ -0.5 x)) (if (<= x 1.26) x (log (* x 2.0)))))
double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = log((-0.5 / x));
	} else if (x <= 1.26) {
		tmp = x;
	} else {
		tmp = log((x * 2.0));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-1.25d0)) then
        tmp = log(((-0.5d0) / x))
    else if (x <= 1.26d0) then
        tmp = x
    else
        tmp = log((x * 2.0d0))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -1.25) {
		tmp = Math.log((-0.5 / x));
	} else if (x <= 1.26) {
		tmp = x;
	} else {
		tmp = Math.log((x * 2.0));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.25:
		tmp = math.log((-0.5 / x))
	elif x <= 1.26:
		tmp = x
	else:
		tmp = math.log((x * 2.0))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.25)
		tmp = log(Float64(-0.5 / x));
	elseif (x <= 1.26)
		tmp = x;
	else
		tmp = log(Float64(x * 2.0));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -1.25)
		tmp = log((-0.5 / x));
	elseif (x <= 1.26)
		tmp = x;
	else
		tmp = log((x * 2.0));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -1.25], N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.26], x, N[Log[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.26:\\
\;\;\;\;x\\

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


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

    if -1.25 < x < 1.26000000000000001

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x} \]

    if 1.26000000000000001 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

      \[\leadsto \log \color{blue}{\left(2 \cdot x\right)} \]
    6. Step-by-step derivation
      1. *-commutative96.9%

        \[\leadsto \log \color{blue}{\left(x \cdot 2\right)} \]
    7. Simplified96.9%

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

Alternative 6: 78.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8:\\ \;\;\;\;-8\\ \mathbf{elif}\;x \leq 1.26:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\log \left(x \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= x -8.0) -8.0 (if (<= x 1.26) x (log (* x 2.0)))))
double code(double x) {
	double tmp;
	if (x <= -8.0) {
		tmp = -8.0;
	} else if (x <= 1.26) {
		tmp = x;
	} else {
		tmp = log((x * 2.0));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-8.0d0)) then
        tmp = -8.0d0
    else if (x <= 1.26d0) then
        tmp = x
    else
        tmp = log((x * 2.0d0))
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -8.0) {
		tmp = -8.0;
	} else if (x <= 1.26) {
		tmp = x;
	} else {
		tmp = Math.log((x * 2.0));
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -8.0:
		tmp = -8.0
	elif x <= 1.26:
		tmp = x
	else:
		tmp = math.log((x * 2.0))
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -8.0)
		tmp = -8.0;
	elseif (x <= 1.26)
		tmp = x;
	else
		tmp = log(Float64(x * 2.0));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -8.0)
		tmp = -8.0;
	elseif (x <= 1.26)
		tmp = x;
	else
		tmp = log((x * 2.0));
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -8.0], -8.0, If[LessEqual[x, 1.26], x, N[Log[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8:\\
\;\;\;\;-8\\

\mathbf{elif}\;x \leq 1.26:\\
\;\;\;\;x\\

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


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr15.4%

      \[\leadsto \color{blue}{-8} \]

    if -8 < x < 1.26000000000000001

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x} \]

    if 1.26000000000000001 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

      \[\leadsto \log \color{blue}{\left(2 \cdot x\right)} \]
    6. Step-by-step derivation
      1. *-commutative96.9%

        \[\leadsto \log \color{blue}{\left(x \cdot 2\right)} \]
    7. Simplified96.9%

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

Alternative 7: 61.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;-8\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(x\right)\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x -1.0) -8.0 (log1p x)))
double code(double x) {
	double tmp;
	if (x <= -1.0) {
		tmp = -8.0;
	} else {
		tmp = log1p(x);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if (x <= -1.0) {
		tmp = -8.0;
	} else {
		tmp = Math.log1p(x);
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.0:
		tmp = -8.0
	else:
		tmp = math.log1p(x)
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.0)
		tmp = -8.0;
	else
		tmp = log1p(x);
	end
	return tmp
end
code[x_] := If[LessEqual[x, -1.0], -8.0, N[Log[1 + x], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;-8\\

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


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr15.4%

      \[\leadsto \color{blue}{-8} \]

    if -1 < x

    1. Initial program 22.4%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg22.4%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative22.4%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg22.4%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def41.4%

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

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

      \[\leadsto \log \color{blue}{\left(1 + x\right)} \]
    6. Step-by-step derivation
      1. +-commutative16.3%

        \[\leadsto \log \color{blue}{\left(x + 1\right)} \]
    7. Simplified16.3%

      \[\leadsto \log \color{blue}{\left(x + 1\right)} \]
    8. Step-by-step derivation
      1. *-un-lft-identity16.3%

        \[\leadsto \log \color{blue}{\left(1 \cdot \left(x + 1\right)\right)} \]
      2. log-prod16.3%

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

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

        \[\leadsto 0 + \log \color{blue}{\left(1 + x\right)} \]
      5. log1p-define73.7%

        \[\leadsto 0 + \color{blue}{\mathsf{log1p}\left(x\right)} \]
    9. Applied egg-rr73.7%

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(x\right)} \]
    11. Simplified73.7%

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

Alternative 8: 57.8% accurate, 18.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8:\\ \;\;\;\;-8\\ \mathbf{elif}\;x \leq 9:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;9\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x -8.0) -8.0 (if (<= x 9.0) x 9.0)))
double code(double x) {
	double tmp;
	if (x <= -8.0) {
		tmp = -8.0;
	} else if (x <= 9.0) {
		tmp = x;
	} else {
		tmp = 9.0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-8.0d0)) then
        tmp = -8.0d0
    else if (x <= 9.0d0) then
        tmp = x
    else
        tmp = 9.0d0
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -8.0) {
		tmp = -8.0;
	} else if (x <= 9.0) {
		tmp = x;
	} else {
		tmp = 9.0;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -8.0:
		tmp = -8.0
	elif x <= 9.0:
		tmp = x
	else:
		tmp = 9.0
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -8.0)
		tmp = -8.0;
	elseif (x <= 9.0)
		tmp = x;
	else
		tmp = 9.0;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -8.0)
		tmp = -8.0;
	elseif (x <= 9.0)
		tmp = x;
	else
		tmp = 9.0;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -8.0], -8.0, If[LessEqual[x, 9.0], x, 9.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8:\\
\;\;\;\;-8\\

\mathbf{elif}\;x \leq 9:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;9\\


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

    1. Initial program 4.8%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative4.8%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg4.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr15.4%

      \[\leadsto \color{blue}{-8} \]

    if -8 < x < 9

    1. Initial program 7.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative7.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg7.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def7.6%

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

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

      \[\leadsto \color{blue}{x} \]

    if 9 < x

    1. Initial program 47.5%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative47.5%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg47.5%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def98.7%

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

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

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

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

        \[\leadsto \color{blue}{\log \left(-\left(x \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      4. pow22.6%

        \[\leadsto \log \left(-\left(\color{blue}{{x}^{2}} - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      5. hypot-1-def2.6%

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

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

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

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

        \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    6. Applied egg-rr2.6%

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

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

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

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

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

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

        \[\leadsto \log \color{blue}{1} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      7. metadata-eval5.6%

        \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      8. neg-sub05.6%

        \[\leadsto \color{blue}{-\log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      9. neg-sub05.6%

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr15.2%

      \[\leadsto \color{blue}{9} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 9: 10.2% accurate, 34.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 10^{-309}:\\ \;\;\;\;-8\\ \mathbf{else}:\\ \;\;\;\;9\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x 1e-309) -8.0 9.0))
double code(double x) {
	double tmp;
	if (x <= 1e-309) {
		tmp = -8.0;
	} else {
		tmp = 9.0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 1d-309) then
        tmp = -8.0d0
    else
        tmp = 9.0d0
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 1e-309) {
		tmp = -8.0;
	} else {
		tmp = 9.0;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 1e-309:
		tmp = -8.0
	else:
		tmp = 9.0
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 1e-309)
		tmp = -8.0;
	else
		tmp = 9.0;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 1e-309)
		tmp = -8.0;
	else
		tmp = 9.0;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 1e-309], -8.0, 9.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-309}:\\
\;\;\;\;-8\\

\mathbf{else}:\\
\;\;\;\;9\\


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

    1. Initial program 6.2%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg6.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative6.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg6.2%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def6.8%

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

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

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

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

        \[\leadsto \color{blue}{\log \left(-\left(x \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      4. pow27.0%

        \[\leadsto \log \left(-\left(\color{blue}{{x}^{2}} - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      5. hypot-1-def7.0%

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

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

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

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

        \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    6. Applied egg-rr7.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr10.2%

      \[\leadsto \color{blue}{-8} \]

    if 1.000000000000002e-309 < x

    1. Initial program 30.2%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg30.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative30.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg30.2%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      8. neg-sub06.4%

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

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

        \[\leadsto -\log \color{blue}{\left(\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)\right)} \]
      11. neg-sub06.4%

        \[\leadsto -\log \left(\color{blue}{\left(-x\right)} + \mathsf{hypot}\left(1, x\right)\right) \]
      12. +-commutative6.4%

        \[\leadsto -\log \color{blue}{\left(\mathsf{hypot}\left(1, x\right) + \left(-x\right)\right)} \]
      13. sub-neg6.4%

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr11.0%

      \[\leadsto \color{blue}{9} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 10.1% accurate, 34.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{-308}:\\ \;\;\;\;-8\\ \mathbf{else}:\\ \;\;\;\;4\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x -1.2e-308) -8.0 4.0))
double code(double x) {
	double tmp;
	if (x <= -1.2e-308) {
		tmp = -8.0;
	} else {
		tmp = 4.0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-1.2d-308)) then
        tmp = -8.0d0
    else
        tmp = 4.0d0
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -1.2e-308) {
		tmp = -8.0;
	} else {
		tmp = 4.0;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.2e-308:
		tmp = -8.0
	else:
		tmp = 4.0
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.2e-308)
		tmp = -8.0;
	else
		tmp = 4.0;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -1.2e-308)
		tmp = -8.0;
	else
		tmp = 4.0;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -1.2e-308], -8.0, 4.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-308}:\\
\;\;\;\;-8\\

\mathbf{else}:\\
\;\;\;\;4\\


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

    1. Initial program 6.2%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg6.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative6.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg6.2%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def6.8%

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

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

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

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

        \[\leadsto \color{blue}{\log \left(-\left(x \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      4. pow27.0%

        \[\leadsto \log \left(-\left(\color{blue}{{x}^{2}} - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      5. hypot-1-def7.0%

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

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

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

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

        \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    6. Applied egg-rr7.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr10.2%

      \[\leadsto \color{blue}{-8} \]

    if -1.1999999999999998e-308 < x

    1. Initial program 30.2%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg30.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative30.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg30.2%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      8. neg-sub06.4%

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

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

        \[\leadsto -\log \color{blue}{\left(\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)\right)} \]
      11. neg-sub06.4%

        \[\leadsto -\log \left(\color{blue}{\left(-x\right)} + \mathsf{hypot}\left(1, x\right)\right) \]
      12. +-commutative6.4%

        \[\leadsto -\log \color{blue}{\left(\mathsf{hypot}\left(1, x\right) + \left(-x\right)\right)} \]
      13. sub-neg6.4%

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr10.8%

      \[\leadsto \color{blue}{4} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 10.1% accurate, 34.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{-308}:\\ \;\;\;\;-8\\ \mathbf{else}:\\ \;\;\;\;3\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x -1.6e-308) -8.0 3.0))
double code(double x) {
	double tmp;
	if (x <= -1.6e-308) {
		tmp = -8.0;
	} else {
		tmp = 3.0;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= (-1.6d-308)) then
        tmp = -8.0d0
    else
        tmp = 3.0d0
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= -1.6e-308) {
		tmp = -8.0;
	} else {
		tmp = 3.0;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= -1.6e-308:
		tmp = -8.0
	else:
		tmp = 3.0
	return tmp
function code(x)
	tmp = 0.0
	if (x <= -1.6e-308)
		tmp = -8.0;
	else
		tmp = 3.0;
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= -1.6e-308)
		tmp = -8.0;
	else
		tmp = 3.0;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, -1.6e-308], -8.0, 3.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-308}:\\
\;\;\;\;-8\\

\mathbf{else}:\\
\;\;\;\;3\\


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

    1. Initial program 6.2%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg6.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative6.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg6.2%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def6.8%

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

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

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

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

        \[\leadsto \color{blue}{\log \left(-\left(x \cdot x - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right)} \]
      4. pow27.0%

        \[\leadsto \log \left(-\left(\color{blue}{{x}^{2}} - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      5. hypot-1-def7.0%

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

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

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

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

        \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    6. Applied egg-rr7.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr10.2%

      \[\leadsto \color{blue}{-8} \]

    if -1.6000000000000001e-308 < x

    1. Initial program 30.2%

      \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
    2. Step-by-step derivation
      1. sqr-neg30.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
      2. +-commutative30.2%

        \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
      3. sqr-neg30.2%

        \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
      4. hypot-1-def59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
      8. neg-sub06.4%

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

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

        \[\leadsto -\log \color{blue}{\left(\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)\right)} \]
      11. neg-sub06.4%

        \[\leadsto -\log \left(\color{blue}{\left(-x\right)} + \mathsf{hypot}\left(1, x\right)\right) \]
      12. +-commutative6.4%

        \[\leadsto -\log \color{blue}{\left(\mathsf{hypot}\left(1, x\right) + \left(-x\right)\right)} \]
      13. sub-neg6.4%

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

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

      \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
    10. Applied egg-rr10.7%

      \[\leadsto \color{blue}{3} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 6.0% accurate, 207.0× speedup?

\[\begin{array}{l} \\ -8 \end{array} \]
(FPCore (x) :precision binary64 -8.0)
double code(double x) {
	return -8.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = -8.0d0
end function
public static double code(double x) {
	return -8.0;
}
def code(x):
	return -8.0
function code(x)
	return -8.0
end
function tmp = code(x)
	tmp = -8.0;
end
code[x_] := -8.0
\begin{array}{l}

\\
-8
\end{array}
Derivation
  1. Initial program 18.1%

    \[\log \left(x + \sqrt{x \cdot x + 1}\right) \]
  2. Step-by-step derivation
    1. sqr-neg18.1%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(-x\right) \cdot \left(-x\right)} + 1}\right) \]
    2. +-commutative18.1%

      \[\leadsto \log \left(x + \sqrt{\color{blue}{1 + \left(-x\right) \cdot \left(-x\right)}}\right) \]
    3. sqr-neg18.1%

      \[\leadsto \log \left(x + \sqrt{1 + \color{blue}{x \cdot x}}\right) \]
    4. hypot-1-def32.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(-\left({x}^{2} - \color{blue}{\mathsf{fma}\left(x, x, 1\right)}\right)\right) - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
  6. Applied egg-rr5.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} - \log \left(-\left(x - \mathsf{hypot}\left(1, x\right)\right)\right) \]
    8. neg-sub029.4%

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

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

      \[\leadsto -\log \color{blue}{\left(\left(0 - x\right) + \mathsf{hypot}\left(1, x\right)\right)} \]
    11. neg-sub029.4%

      \[\leadsto -\log \left(\color{blue}{\left(-x\right)} + \mathsf{hypot}\left(1, x\right)\right) \]
    12. +-commutative29.4%

      \[\leadsto -\log \color{blue}{\left(\mathsf{hypot}\left(1, x\right) + \left(-x\right)\right)} \]
    13. sub-neg29.4%

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

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

    \[\leadsto -\log \color{blue}{\left(\frac{0.5}{x}\right)} \]
  10. Applied egg-rr6.1%

    \[\leadsto \color{blue}{-8} \]
  11. Add Preprocessing

Developer Target 1: 29.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x \cdot x + 1}\\ \mathbf{if}\;x < 0:\\ \;\;\;\;\log \left(\frac{-1}{x - t\_0}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + t\_0\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (+ (* x x) 1.0))))
   (if (< x 0.0) (log (/ -1.0 (- x t_0))) (log (+ x t_0)))))
double code(double x) {
	double t_0 = sqrt(((x * x) + 1.0));
	double tmp;
	if (x < 0.0) {
		tmp = log((-1.0 / (x - t_0)));
	} else {
		tmp = log((x + t_0));
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((x * x) + 1.0d0))
    if (x < 0.0d0) then
        tmp = log(((-1.0d0) / (x - t_0)))
    else
        tmp = log((x + t_0))
    end if
    code = tmp
end function
public static double code(double x) {
	double t_0 = Math.sqrt(((x * x) + 1.0));
	double tmp;
	if (x < 0.0) {
		tmp = Math.log((-1.0 / (x - t_0)));
	} else {
		tmp = Math.log((x + t_0));
	}
	return tmp;
}
def code(x):
	t_0 = math.sqrt(((x * x) + 1.0))
	tmp = 0
	if x < 0.0:
		tmp = math.log((-1.0 / (x - t_0)))
	else:
		tmp = math.log((x + t_0))
	return tmp
function code(x)
	t_0 = sqrt(Float64(Float64(x * x) + 1.0))
	tmp = 0.0
	if (x < 0.0)
		tmp = log(Float64(-1.0 / Float64(x - t_0)));
	else
		tmp = log(Float64(x + t_0));
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = sqrt(((x * x) + 1.0));
	tmp = 0.0;
	if (x < 0.0)
		tmp = log((-1.0 / (x - t_0)));
	else
		tmp = log((x + t_0));
	end
	tmp_2 = tmp;
end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, If[Less[x, 0.0], N[Log[N[(-1.0 / N[(x - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Log[N[(x + t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{x \cdot x + 1}\\
\mathbf{if}\;x < 0:\\
\;\;\;\;\log \left(\frac{-1}{x - t\_0}\right)\\

\mathbf{else}:\\
\;\;\;\;\log \left(x + t\_0\right)\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024150 
(FPCore (x)
  :name "Hyperbolic arcsine"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< x 0) (log (/ -1 (- x (sqrt (+ (* x x) 1))))) (log (+ x (sqrt (+ (* x x) 1))))))

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