Average Error: 33.0 → 8.5
Time: 1.2m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le -25242.52847499894:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 2.7904117459885645 \cdot 10^{-303}:\\ \;\;\;\;\frac{c}{\frac{b/2}{\frac{-1}{2}}}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 2.7327029100648715 \cdot 10^{-83}:\\ \;\;\;\;\frac{\frac{\frac{1}{2}}{b/2}}{\frac{1}{c}} - \frac{b/2 + b/2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{\sqrt{b/2 \cdot b/2 - a \cdot c}} \cdot \sqrt{\sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if (/ -1/2 b/2) < -25242.52847499894

    1. Initial program 23.9

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv24.0

      \[\leadsto \color{blue}{\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied flip-+24.1

      \[\leadsto \color{blue}{\frac{\left(-b/2\right) \cdot \left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/24.1

      \[\leadsto \color{blue}{\frac{\left(\left(-b/2\right) \cdot \left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\]
    7. Applied simplify15.9

      \[\leadsto \frac{\color{blue}{\frac{c \cdot a}{a}}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\]

    if -25242.52847499894 < (/ -1/2 b/2) < 2.7904117459885645e-303

    1. Initial program 55.7

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 16.7

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    3. Applied simplify6.2

      \[\leadsto \color{blue}{\frac{c}{\frac{b/2}{\frac{-1}{2}}}}\]

    if 2.7904117459885645e-303 < (/ -1/2 b/2) < 2.7327029100648715e-83

    1. Initial program 40.7

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv40.8

      \[\leadsto \color{blue}{\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Taylor expanded around -inf 10.1

      \[\leadsto \left(\left(-b/2\right) + \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}\right) \cdot \frac{1}{a}\]
    5. Applied simplify4.5

      \[\leadsto \color{blue}{\frac{\frac{\frac{1}{2}}{b/2}}{\frac{1}{c}} - \frac{b/2 + b/2}{a}}\]

    if 2.7327029100648715e-83 < (/ -1/2 b/2)

    1. Initial program 7.8

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt7.8

      \[\leadsto \frac{\left(-b/2\right) + \sqrt{\color{blue}{\sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\]
    4. Applied sqrt-prod8.1

      \[\leadsto \frac{\left(-b/2\right) + \color{blue}{\sqrt{\sqrt{b/2 \cdot b/2 - a \cdot c}} \cdot \sqrt{\sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' +o rules:numerics
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))