Average Error: 33.6 → 6.9
Time: 1.7m
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 -5.192554123360955 \cdot 10^{+141}:\\ \;\;\;\;\frac{\frac{-1}{2}}{\frac{b/2}{c}}\\ \mathbf{if}\;b/2 \le 9.071309416413795 \cdot 10^{-293}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}}{\frac{1}{c}}\\ \mathbf{if}\;b/2 \le 1.3863910504551248 \cdot 10^{+84}:\\ \;\;\;\;\left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b/2} - \frac{b/2 + b/2}{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 b/2 < -5.192554123360955e+141

    1. Initial program 61.4

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

      \[\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 simplify34.8

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}{c}}}\]
    8. Using strategy rm
    9. Applied div-inv34.3

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)\right) \cdot \frac{1}{c}}}\]
    10. Applied associate-/r*34.3

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{-1}{2}}{b/2}}}{\frac{1}{c}}\]
    12. Applied simplify2.6

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

    if -5.192554123360955e+141 < b/2 < 9.071309416413795e-293

    1. Initial program 33.4

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--33.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 simplify15.7

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}{c}}}\]
    8. Using strategy rm
    9. Applied div-inv8.9

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)\right) \cdot \frac{1}{c}}}\]
    10. Applied associate-/r*8.5

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

    if 9.071309416413795e-293 < b/2 < 1.3863910504551248e+84

    1. Initial program 9.1

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

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

    if 1.3863910504551248e+84 < b/2

    1. Initial program 42.8

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)}{c}}}\]
    8. Using strategy rm
    9. Applied div-inv61.3

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{b/2 \cdot b/2 - c \cdot a} + \left(-b/2\right)\right) \cdot \frac{1}{c}}}\]
    10. Applied associate-/r*61.3

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

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

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

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

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1063313015 2771194459 1594909340 1344785158 2223560818 546365448)' 
(FPCore (a b/2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))