\[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
Test:
jeff quadratic root 1
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 10.0 s
Input Error: 30.7
Output Error: 8.8
Log:
Profile: 🕒
\(\begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \frac{c}{1} \cdot \frac{2}{\left(-b\right) + \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}} & \text{otherwise} \end{cases}\)
  1. Started with
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
    30.7
  2. Applied taylor to get
    \[\begin{cases} \frac{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
    14.5
  3. Taylor expanded around inf to get
    \[\begin{cases} \frac{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}\]
    14.5
  4. Applied simplify to get
    \[\color{red}{\begin{cases} \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{when } b \ge 0 \\ \frac{2 \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{\left(-b\right) + \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}} & \text{otherwise} \end{cases}}\]
    8.7
  5. Using strategy rm
    8.7
  6. Applied *-un-lft-identity to get
    \[\begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \color{red}{\frac{c \cdot 2}{\left(-b\right) + \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}}} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \color{blue}{\frac{c \cdot 2}{1 \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}\right)}} & \text{otherwise} \end{cases}\]
    8.7
  7. Applied times-frac to get
    \[\begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \frac{c \cdot 2}{1 \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}\right)} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{when } b \ge 0 \\ \frac{c}{1} \cdot \frac{2}{\left(-b\right) + \sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a}} & \text{otherwise} \end{cases}\]
    8.8

Original test:


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