Average Error: 25.2 → 7.8
Time: 17.2s
Precision: 64
Internal Precision: 576
\[\sqrt{d \cdot d - \left(2 \cdot e\right) \cdot dd}\]
\[\begin{array}{l} \mathbf{if}\;d \le -6.826205091476792 \cdot 10^{+149}:\\ \;\;\;\;\frac{e \cdot dd}{d} - d\\ \mathbf{elif}\;d \le 4.379229710681729 \cdot 10^{+106}:\\ \;\;\;\;\sqrt{d \cdot d - e \cdot \left(2 \cdot dd\right)}\\ \mathbf{else}:\\ \;\;\;\;d - \frac{e \cdot dd}{d}\\ \end{array}\]

Error

Bits error versus d

Bits error versus e

Bits error versus dd

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if d < -6.826205091476792e+149

    1. Initial program 57.9

      \[\sqrt{d \cdot d - \left(2 \cdot e\right) \cdot dd}\]
    2. Initial simplification57.9

      \[\leadsto \sqrt{d \cdot d - \left(2 \cdot dd\right) \cdot e}\]
    3. Taylor expanded around -inf 6.4

      \[\leadsto \color{blue}{\frac{e \cdot dd}{d} - d}\]

    if -6.826205091476792e+149 < d < 4.379229710681729e+106

    1. Initial program 8.6

      \[\sqrt{d \cdot d - \left(2 \cdot e\right) \cdot dd}\]
    2. Initial simplification8.6

      \[\leadsto \sqrt{d \cdot d - \left(2 \cdot dd\right) \cdot e}\]

    if 4.379229710681729e+106 < d

    1. Initial program 46.9

      \[\sqrt{d \cdot d - \left(2 \cdot e\right) \cdot dd}\]
    2. Initial simplification46.9

      \[\leadsto \sqrt{d \cdot d - \left(2 \cdot dd\right) \cdot e}\]
    3. Taylor expanded around inf 6.4

      \[\leadsto \color{blue}{d - \frac{e \cdot dd}{d}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \le -6.826205091476792 \cdot 10^{+149}:\\ \;\;\;\;\frac{e \cdot dd}{d} - d\\ \mathbf{elif}\;d \le 4.379229710681729 \cdot 10^{+106}:\\ \;\;\;\;\sqrt{d \cdot d - e \cdot \left(2 \cdot dd\right)}\\ \mathbf{else}:\\ \;\;\;\;d - \frac{e \cdot dd}{d}\\ \end{array}\]

Runtime

Time bar (total: 17.2s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (d e dd)
  :name "sqrt(d*d - 2*e*dd)"
  (sqrt (- (* d d) (* (* 2 e) dd))))