\[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
Test:
jeff quadratic root 2
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 16.0 s
Input Error: 8.9
Output Error: 1.2
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{2 \cdot c}{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} & \text{when } {b}^2 - \left(4 \cdot a\right) \cdot c \le 2.680275f+38 \\ \frac{c}{c \cdot \frac{a}{b} - b} & \text{when } b \ge 0 \\ \frac{-b}{a} & \text{otherwise} \end{cases}\)

    if (- (sqr b) (* (* 4 a) c)) < 2.680275f+38

    1. Started with
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      1.0
    2. Using strategy rm
      1.0
    3. Applied pow1 to get
      \[\begin{cases} \frac{2 \cdot c}{\color{red}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\color{blue}{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      1.0

    if 2.680275f+38 < (- (sqr b) (* (* 4 a) c))

    1. Started with
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      22.9
    2. Using strategy rm
      22.9
    3. Applied pow1 to get
      \[\begin{cases} \frac{2 \cdot c}{\color{red}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\color{blue}{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      22.9
    4. Applied taylor to get
      \[\begin{cases} \frac{2 \cdot c}{{\left(\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}^{1}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{{\left(2 \cdot \frac{c \cdot a}{b} - 2 \cdot b\right)}^{1}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      15.5
    5. Taylor expanded around inf to get
      \[\begin{cases} \frac{2 \cdot c}{{\color{red}{\left(2 \cdot \frac{c \cdot a}{b} - 2 \cdot b\right)}}^{1}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{{\color{blue}{\left(2 \cdot \frac{c \cdot a}{b} - 2 \cdot b\right)}}^{1}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      15.5
    6. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{2 \cdot c}{{\left(2 \cdot \frac{c \cdot a}{b} - 2 \cdot b\right)}^{1}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{c}{\frac{a}{b} \cdot c - b} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - a \cdot \left(4 \cdot c\right)} + \left(-b\right)}{a \cdot 2} & \text{otherwise} \end{cases}}\]
      13.2
    7. Applied taylor to get
      \[\begin{cases} \frac{c}{\frac{a}{b} \cdot c - b} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - a \cdot \left(4 \cdot c\right)} + \left(-b\right)}{a \cdot 2} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{\frac{a}{b} \cdot c - b} & \text{when } b \ge 0 \\ -1 \cdot \frac{b}{a} & \text{otherwise} \end{cases}\]
      1.5
    8. Taylor expanded around -inf to get
      \[\begin{cases} \frac{c}{\frac{a}{b} \cdot c - b} & \text{when } b \ge 0 \\ -1 \cdot \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{\frac{a}{b} \cdot c - b} & \text{when } b \ge 0 \\ -1 \cdot \frac{b}{a} & \text{otherwise} \end{cases}\]
      1.5
    9. Applied simplify to get
      \[\begin{cases} \frac{c}{\frac{a}{b} \cdot c - b} & \text{when } b \ge 0 \\ -1 \cdot \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{c \cdot \frac{a}{b} - b} & \text{when } b \ge 0 \\ \frac{-b}{a} & \text{otherwise} \end{cases}\]
      1.5

    10. Applied final simplification

  1. Removed slow pow expressions

Original test:


(lambda ((a default) (b default) (c default))
  #:name "jeff quadratic root 2"
  (if (>= b 0) (/ (* 2 c) (- (- b) (sqrt (- (sqr b) (* (* 4 a) c))))) (/ (+ (- b) (sqrt (- (sqr b) (* (* 4 a) c)))) (* 2 a))))