Average Error: 34.0 → 7.0
Time: 26.8s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6.807794752624979 \cdot 10^{+136}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le -3.580120797356845 \cdot 10^{-148}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\ \mathbf{elif}\;b_2 \le 3.4582550014055822 \cdot 10^{+128}:\\ \;\;\;\;\frac{-c}{\sqrt{{b_2}^{2} - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{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 < -6.807794752624979e+136

    1. Initial program 55.0

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification55.0

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 55.0

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Using strategy rm
    5. Applied div-inv55.0

      \[\leadsto \color{blue}{\left(\sqrt{{b_2}^{2} - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    6. Taylor expanded around -inf 2.4

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    7. Simplified2.4

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

    if -6.807794752624979e+136 < b_2 < -3.580120797356845e-148

    1. Initial program 6.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification6.6

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied clear-num6.7

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]

    if -3.580120797356845e-148 < b_2 < 3.4582550014055822e+128

    1. Initial program 29.7

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification29.7

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 29.7

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Using strategy rm
    5. Applied div-inv29.8

      \[\leadsto \color{blue}{\left(\sqrt{{b_2}^{2} - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    6. Using strategy rm
    7. Applied flip--30.3

      \[\leadsto \color{blue}{\frac{\sqrt{{b_2}^{2} - a \cdot c} \cdot \sqrt{{b_2}^{2} - a \cdot c} - b_2 \cdot b_2}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}} \cdot \frac{1}{a}\]
    8. Applied associate-*l/30.3

      \[\leadsto \color{blue}{\frac{\left(\sqrt{{b_2}^{2} - a \cdot c} \cdot \sqrt{{b_2}^{2} - a \cdot c} - b_2 \cdot b_2\right) \cdot \frac{1}{a}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}}\]
    9. Simplified15.5

      \[\leadsto \frac{\color{blue}{\frac{(c \cdot \left(-a\right) + 0)_*}{a}}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}\]
    10. Taylor expanded around -inf 10.6

      \[\leadsto \frac{\color{blue}{-1 \cdot c}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}\]
    11. Simplified10.6

      \[\leadsto \frac{\color{blue}{-c}}{\sqrt{{b_2}^{2} - a \cdot c} + b_2}\]

    if 3.4582550014055822e+128 < b_2

    1. Initial program 60.9

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification60.9

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 60.9

      \[\leadsto \frac{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}{a}\]
    4. Using strategy rm
    5. Applied div-inv60.9

      \[\leadsto \color{blue}{\left(\sqrt{{b_2}^{2} - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    6. Taylor expanded around inf 2.0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.807794752624979 \cdot 10^{+136}:\\ \;\;\;\;(-2 \cdot \left(\frac{b_2}{a}\right) + \left(\frac{c}{\frac{b_2}{\frac{1}{2}}}\right))_*\\ \mathbf{elif}\;b_2 \le -3.580120797356845 \cdot 10^{-148}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\ \mathbf{elif}\;b_2 \le 3.4582550014055822 \cdot 10^{+128}:\\ \;\;\;\;\frac{-c}{\sqrt{{b_2}^{2} - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Runtime

Time bar (total: 26.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes29.17.05.923.295.3%
herbie shell --seed 2018351 +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))