Average Error: 45.4 → 0
Time: 10.0s
Precision: 64
$\sqrt{\left(x - 1\right) \cdot \left(x + 1\right) + 1}$
$\begin{array}{l} \mathbf{if}\;x \le 6.006836929901048229584203904238188713098 \cdot 10^{-310}:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}$
\sqrt{\left(x - 1\right) \cdot \left(x + 1\right) + 1}
\begin{array}{l}
\mathbf{if}\;x \le 6.006836929901048229584203904238188713098 \cdot 10^{-310}:\\
\;\;\;\;-x\\

\mathbf{else}:\\
\;\;\;\;x\\

\end{array}
double f(double x) {
double r54884532 = x;
double r54884533 = 1.0;
double r54884534 = r54884532 - r54884533;
double r54884535 = r54884532 + r54884533;
double r54884536 = r54884534 * r54884535;
double r54884537 = r54884536 + r54884533;
double r54884538 = sqrt(r54884537);
return r54884538;
}


double f(double x) {
double r54884539 = x;
double r54884540 = 6.00683692990105e-310;
bool r54884541 = r54884539 <= r54884540;
double r54884542 = -r54884539;
double r54884543 = r54884541 ? r54884542 : r54884539;
return r54884543;
}



# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < 6.00683692990105e-310

1. Initial program 45.6

$\sqrt{\left(x - 1\right) \cdot \left(x + 1\right) + 1}$
2. Taylor expanded around -inf 0

$\leadsto \color{blue}{-1 \cdot x}$
3. Simplified0

$\leadsto \color{blue}{-x}$

## if 6.00683692990105e-310 < x

1. Initial program 45.3

$\sqrt{\left(x - 1\right) \cdot \left(x + 1\right) + 1}$
2. Taylor expanded around 0 0

$\leadsto \color{blue}{x}$
3. Recombined 2 regimes into one program.
4. Final simplification0

$\leadsto \begin{array}{l} \mathbf{if}\;x \le 6.006836929901048229584203904238188713098 \cdot 10^{-310}:\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "sqrt((x-1)*(x+1)+1)"
(sqrt (+ (* (- x 1.0) (+ x 1.0)) 1.0)))