\[\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.7 s
Input Error: 20.8
Output Error: 6.1
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \left(\frac{2}{4} \cdot \frac{c}{a \cdot c}\right) \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right) & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} & \text{when } b \le -1.4230559129753548 \cdot 10^{+111} \\ \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) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} & \text{otherwise} \end{cases} & \text{when } b \le 4.161458774616805 \cdot 10^{+86} \\ \frac{c}{c \cdot \frac{a}{b} - 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}\)

    if b < -1.4230559129753548e+111

    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}\]
      49.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}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}} & \text{when } b \ge 0 \\ \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases}\]
      10.9
    3. 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{2 \cdot \frac{c \cdot a}{b} - 2 \cdot 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{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases}\]
      10.9
    4. Applied simplify to get
      \[\color{red}{\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{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{c \cdot 2}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}}\]
      0.0
    5. Using strategy rm
      0.0
    6. Applied flip-- to get
      \[\begin{cases} \frac{c \cdot 2}{\color{red}{\left(-b\right) - \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c \cdot 2}{\color{blue}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right)}^2}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}}}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0
    7. Applied associate-/r/ to get
      \[\begin{cases} \color{red}{\frac{c \cdot 2}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right)}^2}{\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}}}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \color{blue}{\frac{c \cdot 2}{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right)}^2} \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right)} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0
    8. Applied simplify to get
      \[\begin{cases} \color{red}{\frac{c \cdot 2}{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right)}^2}} \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right) & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \color{blue}{\left(\frac{2}{4} \cdot \frac{c}{a \cdot c}\right)} \cdot \left(\left(-b\right) + \sqrt{{b}^2 - \left(4 \cdot c\right) \cdot a}\right) & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0

    if -1.4230559129753548e+111 < b < 4.161458774616805e+86

    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}\]
      9.3
    2. Using strategy rm
      9.3
    3. Applied add-cube-cbrt 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{\left(-b\right) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} & \text{otherwise} \end{cases}\]
      9.7

    if 4.161458774616805e+86 < 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}\]
      30.7
    2. Using strategy rm
      30.7
    3. Applied add-cube-cbrt 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{\left(-b\right) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} & \text{otherwise} \end{cases}\]
      30.7
    4. 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) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{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) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} & \text{otherwise} \end{cases}\]
      7.3
    5. 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) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{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) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} & \text{otherwise} \end{cases}\]
      7.3
    6. 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) + {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}{2 \cdot a} & \text{otherwise} \end{cases}} \leadsto \color{blue}{\begin{cases} \frac{c}{c \cdot \frac{a}{b} - 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.2

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