Average Error: 38.8 → 0.2
Time: 9.1s
Precision: 64
Internal Precision: 1344
\[\left(-1\right) + \sqrt{1 - x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.00013815257582370472:\\ \;\;\;\;\sqrt{1 - x} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-x\right) \cdot \left(\left(\frac{1}{16} \cdot \left(x \cdot x\right)\right) \cdot \left(\frac{1}{16} \cdot \left(x \cdot x\right)\right) - \left(x \cdot \frac{1}{8} + \frac{1}{2}\right) \cdot \left(x \cdot \frac{1}{8} + \frac{1}{2}\right)\right)}{\frac{1}{16} \cdot \left(x \cdot x\right) - \left(x \cdot \frac{1}{8} + \frac{1}{2}\right)}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -0.00013815257582370472

    1. Initial program 0.1

      \[\left(-1\right) + \sqrt{1 - x}\]
    2. Initial simplification0.1

      \[\leadsto \sqrt{1 - x} - 1\]

    if -0.00013815257582370472 < x

    1. Initial program 58.8

      \[\left(-1\right) + \sqrt{1 - x}\]
    2. Initial simplification58.8

      \[\leadsto \sqrt{1 - x} - 1\]
    3. Taylor expanded around 0 0.2

      \[\leadsto \color{blue}{-\left(\frac{1}{16} \cdot {x}^{3} + \left(\frac{1}{8} \cdot {x}^{2} + \frac{1}{2} \cdot x\right)\right)}\]
    4. Simplified0.2

      \[\leadsto \color{blue}{\left(-x\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{16} + \left(\frac{1}{2} + \frac{1}{8} \cdot x\right)\right)}\]
    5. Using strategy rm
    6. Applied flip-+0.2

      \[\leadsto \left(-x\right) \cdot \color{blue}{\frac{\left(\left(x \cdot x\right) \cdot \frac{1}{16}\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{16}\right) - \left(\frac{1}{2} + \frac{1}{8} \cdot x\right) \cdot \left(\frac{1}{2} + \frac{1}{8} \cdot x\right)}{\left(x \cdot x\right) \cdot \frac{1}{16} - \left(\frac{1}{2} + \frac{1}{8} \cdot x\right)}}\]
    7. Applied associate-*r/0.2

      \[\leadsto \color{blue}{\frac{\left(-x\right) \cdot \left(\left(\left(x \cdot x\right) \cdot \frac{1}{16}\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{16}\right) - \left(\frac{1}{2} + \frac{1}{8} \cdot x\right) \cdot \left(\frac{1}{2} + \frac{1}{8} \cdot x\right)\right)}{\left(x \cdot x\right) \cdot \frac{1}{16} - \left(\frac{1}{2} + \frac{1}{8} \cdot x\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.00013815257582370472:\\ \;\;\;\;\sqrt{1 - x} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-x\right) \cdot \left(\left(\frac{1}{16} \cdot \left(x \cdot x\right)\right) \cdot \left(\frac{1}{16} \cdot \left(x \cdot x\right)\right) - \left(x \cdot \frac{1}{8} + \frac{1}{2}\right) \cdot \left(x \cdot \frac{1}{8} + \frac{1}{2}\right)\right)}{\frac{1}{16} \cdot \left(x \cdot x\right) - \left(x \cdot \frac{1}{8} + \frac{1}{2}\right)}\\ \end{array}\]

Runtime

Time bar (total: 9.1s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x)
  :name "-1 + sqrt(1-x)"
  (+ (- 1) (sqrt (- 1 x))))