\[\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: 10.3 s
Input Error: 16.2
Output Error: 3.9
Log:
Profile: 🕒
\(\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4}} & \text{when } b \ge 0 \\ \frac{4}{-2} \cdot \frac{\frac{b}{a}}{2} & \text{otherwise} \end{cases}\)
  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}\]
    16.2
  2. Using strategy rm
    16.2
  3. Applied flip-+ to get
    \[\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} \leadsto \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{\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} & \text{otherwise} \end{cases}\]
    19.8
  4. Applied simplify to get
    \[\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{\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} & \text{otherwise} \end{cases} \leadsto \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{\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{otherwise} \end{cases}\]
    19.8
  5. Applied taylor to get
    \[\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{\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{otherwise} \end{cases} \leadsto \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{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} & \text{otherwise} \end{cases}\]
    9.0
  6. Taylor expanded around -inf to get
    \[\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{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \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{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} & \text{otherwise} \end{cases}\]
    9.0
  7. Applied simplify to get
    \[\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{\frac{\left(4 \cdot a\right) \cdot c}{-2 \cdot \frac{c \cdot a}{b}}}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}} & \text{when } b \ge 0 \\ \frac{4 \cdot a}{2 \cdot -2} \cdot \frac{\frac{1}{a}}{\frac{a}{b}} & \text{otherwise} \end{cases}\]
    8.2

  8. Applied final simplification
  9. Applied simplify to get
    \[\color{red}{\begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}} & \text{when } b \ge 0 \\ \frac{4 \cdot a}{2 \cdot -2} \cdot \frac{\frac{1}{a}}{\frac{a}{b}} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4}} & \text{when } b \ge 0 \\ \frac{4}{-2} \cdot \frac{\frac{b}{a}}{2} & \text{otherwise} \end{cases}}\]
    3.9

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))))