\[\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: 21.3 s
Input Error: 20.7
Output Error: 5.9
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{c}{1} \cdot \frac{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} & \text{when } b \le -5.8926960145992884 \cdot 10^{+113} \\ \begin{cases} \frac{2 \cdot c}{\left(-b\right) - {\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3} & \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} & \text{when } b \le 8.164018341878614 \cdot 10^{+86} \\ \frac{c \cdot 2}{(\left(\frac{c}{\frac{b}{a}}\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4} + \left(-b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\)

    if b < -5.8926960145992884e+113

    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}\]
      51.0
    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}\]
      13.8
    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}\]
      13.8
    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 *-un-lft-identity 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}{1 \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
    7. Applied times-frac to get
      \[\begin{cases} \color{red}{\frac{c \cdot 2}{1 \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}{\frac{c}{1} \cdot \frac{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

    if -5.8926960145992884e+113 < b < 8.164018341878614e+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.0
    2. Using strategy rm
      9.0
    3. Applied add-cube-cbrt to get
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \color{red}{\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) - \color{blue}{{\left(\sqrt[3]{\sqrt{{b}^2 - \left(4 \cdot a\right) \cdot c}}\right)}^3}} & \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.4

    if 8.164018341878614e+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.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}{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)} & \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}\]
      8.2
    3. Taylor expanded around inf to get
      \[\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \color{red}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}} & \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) - \color{blue}{\left(b - 2 \cdot \frac{c \cdot a}{b}\right)}} & \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}\]
      8.2
    4. Applied simplify to get
      \[\color{red}{\begin{cases} \frac{2 \cdot c}{\left(-b\right) - \left(b - 2 \cdot \frac{c \cdot a}{b}\right)} & \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 \cdot 2}{(\left(\frac{c}{\frac{b}{a}}\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - \left(a \cdot c\right) \cdot 4} + \left(-b\right)}{2 \cdot a} & \text{otherwise} \end{cases}}\]
      1.1

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