\[\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: 20.3 s
Input Error: 10.4
Output Error: 3.3
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \left(\sqrt{{b}^2 - \left(c \cdot a\right) \cdot 4} + \left(-b\right)\right) \cdot \frac{2}{a \cdot 4} & \text{when } b \ge 0 \\ \frac{\frac{c \cdot 2}{\frac{b}{a}} - \left(b - \left(-b\right)\right)}{2 \cdot a} & \text{otherwise} \end{cases} & \text{when } b \le -1922689.9f0 \\ \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{e^{\log \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} & \text{otherwise} \end{cases} & \text{when } b \le 1.1520318f+11 \\ \frac{c}{\frac{a}{\frac{b}{c}} - b} & \text{when } b \ge 0 \\ \frac{c}{b} \cdot \frac{-2}{2} & \text{otherwise} \end{cases}\)

    if b < -1922689.9f0

    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}\]
      19.0
    2. Using strategy rm
      19.0
    3. Applied flip-- 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}{\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}}}} & \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}\]
      19.0
    4. Applied simplify to get
      \[\begin{cases} \frac{2 \cdot c}{\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}}} & \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}{\frac{\color{blue}{\left(4 \cdot a\right) \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}\]
      19.0
    5. Applied taylor to get
      \[\begin{cases} \frac{2 \cdot c}{\frac{\left(4 \cdot a\right) \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}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      5.3
    6. Taylor expanded around -inf to get
      \[\begin{cases} \frac{2 \cdot c}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{2 \cdot c}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      5.3
    7. Applied simplify to get
      \[\begin{cases} \frac{2 \cdot c}{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}} & \text{when } b \ge 0 \\ \frac{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \left(\frac{2}{4} \cdot \frac{c}{a \cdot c}\right) \cdot \left(\sqrt{{b}^2 - \left(c \cdot 4\right) \cdot a} + \left(-b\right)\right) & \text{when } b \ge 0 \\ \frac{\frac{c \cdot 2}{\frac{b}{a}} - \left(b - \left(-b\right)\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      1.5

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

    if -1922689.9f0 < b < 1.1520318f+11

    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}\]
      4.6
    2. Using strategy rm
      4.6
    3. Applied add-exp-log 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{e^{\log \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} & \text{otherwise} \end{cases}\]
      5.2

    if 1.1520318f+11 < b

    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}\]
      15.3
    2. 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{\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}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b} & \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}\]
      3.9
    3. Taylor expanded around inf to get
      \[\begin{cases} \frac{2 \cdot c}{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}} & \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}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}} & \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}\]
      3.9
    4. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{2 \cdot c}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b} & \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{c}{b} \cdot a - b} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(c \cdot a\right) \cdot 4} + \left(-b\right)}{a \cdot 2} & \text{otherwise} \end{cases}}\]
      0.7
    5. Applied taylor to get
      \[\begin{cases} \frac{c}{\frac{c}{b} \cdot a - b} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(c \cdot a\right) \cdot 4} + \left(-b\right)}{a \cdot 2} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{\frac{c}{b} \cdot a - b} & \text{when } b \ge 0 \\ \frac{-2 \cdot \frac{c \cdot a}{b}}{a \cdot 2} & \text{otherwise} \end{cases}\]
      0.7
    6. Taylor expanded around inf to get
      \[\begin{cases} \frac{c}{\frac{c}{b} \cdot a - b} & \text{when } b \ge 0 \\ \frac{-2 \cdot \frac{c \cdot a}{b}}{a \cdot 2} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c}{\frac{c}{b} \cdot a - b} & \text{when } b \ge 0 \\ \frac{-2 \cdot \frac{c \cdot a}{b}}{a \cdot 2} & \text{otherwise} \end{cases}\]
      0.7
    7. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{c}{\frac{c}{b} \cdot a - b} & \text{when } b \ge 0 \\ \frac{-2 \cdot \frac{c \cdot a}{b}}{a \cdot 2} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{c}{\frac{a}{\frac{b}{c}} - b} & \text{when } b \ge 0 \\ \frac{c}{b} \cdot \frac{-2}{2} & \text{otherwise} \end{cases}}\]
      0.7

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