\[\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: 11.0 s
Input Error: 15.6
Output Error: 5.5
Log:
Profile: 🕒
\(\begin{cases} \frac{c}{{\left(\sqrt[3]{\frac{c}{b}} \cdot \sqrt[3]{a}\right)}^3 - 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}\)
  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.6
  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}\]
    6.6
  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}\]
    6.6
  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}}\]
    6.2
  5. Using strategy rm
    6.2
  6. Applied add-cube-cbrt to get
    \[\begin{cases} \frac{c}{\color{red}{\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}{\color{blue}{{\left(\sqrt[3]{\frac{c}{b} \cdot a}\right)}^3} - 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}\]
    6.2
  7. Using strategy rm
    6.2
  8. Applied cbrt-prod to get
    \[\begin{cases} \frac{c}{{\color{red}{\left(\sqrt[3]{\frac{c}{b} \cdot a}\right)}}^3 - 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}{{\color{blue}{\left(\sqrt[3]{\frac{c}{b}} \cdot \sqrt[3]{a}\right)}}^3 - 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}\]
    5.5

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