Average Error: 33.0 → 7.4
Time: 35.8s
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -7.728783917565007 \cdot 10^{+67}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b/2} - \frac{b/2 + b/2}{a}\\ \mathbf{if}\;b/2 \le 8.216438213253527 \cdot 10^{-127}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 1.4432083932442931 \cdot 10^{+47}:\\ \;\;\;\;\frac{c}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b/2\right) + b/2}{a} - c \cdot \frac{\frac{1}{2}}{b/2}\\ \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 b/2 < -7.728783917565007e+67

    1. Initial program 40.0

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

      \[\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.4

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

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

    if -7.728783917565007e+67 < b/2 < 8.216438213253527e-127

    1. Initial program 11.4

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

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

    if 8.216438213253527e-127 < b/2 < 1.4432083932442931e+47

    1. Initial program 37.4

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

      \[\leadsto \frac{\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}}}}{a}\]
    4. Applied simplify16.0

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

    if 1.4432083932442931e+47 < b/2

    1. Initial program 55.9

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

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

      \[\leadsto \color{blue}{\frac{\left(-b/2\right) + b/2}{a} - \frac{c}{b/2} \cdot \frac{1}{2}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions.
  5. Applied simplify7.4

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b/2 \le -7.728783917565007 \cdot 10^{+67}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b/2} - \frac{b/2 + b/2}{a}\\ \mathbf{if}\;b/2 \le 8.216438213253527 \cdot 10^{-127}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 1.4432083932442931 \cdot 10^{+47}:\\ \;\;\;\;\frac{c}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b/2\right) + b/2}{a} - c \cdot \frac{\frac{1}{2}}{b/2}\\ \end{array}}\]

Runtime

Time bar (total: 35.8s)Debug log

herbie shell --seed '#(633950927 2092594946 1442981 2827247922 2812758452 390991499)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))