Average Error: 34.8 → 5.2
Time: 14.5s
Precision: 64
Internal precision: 2688
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -9.534865642779829 \cdot 10^{+39}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b/2} - 2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 2.058853159442788 \cdot 10^{-289}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b/2 \le 8.134492970396541 \cdot 10^{+103}:\\ \;\;\;\;\frac{1}{\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - c \cdot a}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{\frac{1}{2} \cdot c}{\frac{b/2}{a}} + \left(\left(-b/2\right) - b/2\right)}\\ \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 < -9.534865642779829e+39

    1. Initial program 40.1

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied clear-num 62.0

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - c \cdot a}}{c}}}\]
    8. Applied taylor 0.0

      \[\leadsto \frac{1}{2} \cdot \frac{c}{b/2} - 2 \cdot \frac{b/2}{a}\]
    9. Taylor expanded around -inf 0.0

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

    if -9.534865642779829e+39 < b/2 < 2.058853159442788e-289

    1. Initial program 9.9

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

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

    if 2.058853159442788e-289 < b/2 < 8.134492970396541e+103

    1. Initial program 32.3

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied clear-num 15.4

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

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

    if 8.134492970396541e+103 < b/2

    1. Initial program 59.2

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied clear-num 33.9

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - c \cdot a}}{c}}}\]
    8. Applied taylor 8.7

      \[\leadsto \frac{1}{\frac{\left(-b/2\right) - \left(b/2 - \frac{1}{2} \cdot \frac{c \cdot a}{b/2}\right)}{c}}\]
    9. Taylor expanded around inf 8.7

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

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

Runtime

Time bar (total: 14.5s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1065003094 2074156664 2352254222 753858891 3745550101 3374585842)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))