\[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
Test:
The quadratic formula (r1)
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 21.6 s
Input Error: 16.2
Output Error: 3.8
Log:
Profile: 🕒
\(\begin{cases} \frac{c}{b} - \frac{b}{a} & \text{when } b \le -1.6844219f+10 \\ \frac{1}{2} \cdot \frac{\left(-b\right) + \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{a} & \text{when } b \le 3.426723f-06 \\ \frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} & \text{when } b \le 2.2299319f+17 \\ \frac{c}{b} \cdot \frac{-2}{2} & \text{otherwise} \end{cases}\)

    if b < -1.6844219f+10

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      21.2
    2. Applied taylor to get
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leadsto \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a}\]
      6.1
    3. Taylor expanded around -inf to get
      \[\frac{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a} \leadsto \frac{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a}\]
      6.1
    4. Applied simplify to get
      \[\color{red}{\frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a}} \leadsto \color{blue}{\frac{\frac{c}{b}}{1} - \frac{b}{a}}\]
      0.0
    5. Applied simplify to get
      \[\color{red}{\frac{\frac{c}{b}}{1}} - \frac{b}{a} \leadsto \color{blue}{\frac{c}{b}} - \frac{b}{a}\]
      0.0

    if -1.6844219f+10 < b < 3.426723f-06

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      6.5
    2. Using strategy rm
      6.5
    3. Applied pow1 to get
      \[\frac{\color{red}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\color{blue}{{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}}{2 \cdot a}\]
      6.5
    4. Using strategy rm
      6.5
    5. Applied *-un-lft-identity to get
      \[\frac{{\color{red}{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}}^{1}}{2 \cdot a} \leadsto \frac{{\color{blue}{\left(1 \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)\right)}}^{1}}{2 \cdot a}\]
      6.5
    6. Applied unpow-prod-down to get
      \[\frac{\color{red}{{\left(1 \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)\right)}^{1}}}{2 \cdot a} \leadsto \frac{\color{blue}{{1}^{1} \cdot {\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}}{2 \cdot a}\]
      6.5
    7. Applied times-frac to get
      \[\color{red}{\frac{{1}^{1} \cdot {\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{2 \cdot a}} \leadsto \color{blue}{\frac{{1}^{1}}{2} \cdot \frac{{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{a}}\]
      6.5
    8. Applied simplify to get
      \[\color{red}{\frac{{1}^{1}}{2}} \cdot \frac{{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{a} \leadsto \color{blue}{\frac{1}{2}} \cdot \frac{{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{a}\]
      6.5
    9. Applied simplify to get
      \[\frac{1}{2} \cdot \color{red}{\frac{{\left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}{a}} \leadsto \frac{1}{2} \cdot \color{blue}{\frac{\left(-b\right) + \sqrt{{b}^2 - a \cdot \left(c \cdot 4\right)}}{a}}\]
      6.6

    if 3.426723f-06 < b < 2.2299319f+17

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      20.6
    2. Using strategy rm
      20.6
    3. Applied flip-+ to get
      \[\frac{\color{red}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
      23.4
    4. Applied simplify to get
      \[\frac{\frac{\color{red}{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^2}}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a} \leadsto \frac{\frac{\color{blue}{\left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
      4.9

    if 2.2299319f+17 < b

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
      30.2
    2. Applied taylor to get
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leadsto \frac{-2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}\]
      7.3
    3. Taylor expanded around inf to get
      \[\frac{\color{red}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} \leadsto \frac{\color{blue}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a}\]
      7.3
    4. Applied simplify to get
      \[\color{red}{\frac{-2 \cdot \frac{c \cdot a}{b}}{2 \cdot a}} \leadsto \color{blue}{\frac{c}{b} \cdot \frac{-2}{2}}\]
      0

  1. Removed slow pow expressions

Original test:


(lambda ((a default) (b default) (c default))
  #:name "The quadratic formula (r1)"
  (/ (+ (- b) (sqrt (- (sqr b) (* (* 4 a) c)))) (* 2 a))
  #:target
  (if (< b 0) (/ (+ (- b) (sqrt (- (sqr b) (* (* 4 a) c)))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (sqr b) (* (* 4 a) c)))) (* 2 a))))))