\[\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: 19.5 s
Input Error: 21.7
Output Error: 5.0
Log:
Profile: 🕒
\(\begin{cases} \begin{cases} \frac{-2}{\frac{b}{c}} & \text{when } b \ge 0 \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases} & \text{when } b \le -431232863.47265303 \\ \begin{cases} \frac{-1}{b \cdot c} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - c \cdot \left(4 \cdot a\right)} + \left(-b\right)}{a \cdot 2} & \text{otherwise} \end{cases} & \text{when } b \le 1.4445095675228828 \cdot 10^{-303} \\ \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} & \text{when } b \le 7.953681720830793 \cdot 10^{+130} \\ \frac{c \cdot 2}{(\left(\frac{a}{\frac{b}{c}}\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{(\left(\frac{a}{\frac{b}{c}}\right) * 2 + \left(\left(-b\right) - b\right))_*}{2 \cdot a} & \text{otherwise} \end{cases}\)

    if b < -431232863.47265303

    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}\]
      38.5
    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.7
    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.7
    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. Applied taylor to get
      \[\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} \leadsto \begin{cases} -2 \cdot \frac{c}{b} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0
    6. Taylor expanded around inf to get
      \[\begin{cases} \color{red}{-2 \cdot \frac{c}{b}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \color{blue}{-2 \cdot \frac{c}{b}} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0
    7. Applied simplify to get
      \[\begin{cases} -2 \cdot \frac{c}{b} & \text{when } b \ge 0 \\ \frac{\frac{c}{b}}{1} - \frac{b}{a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{-2}{\frac{b}{c}} & \text{when } b \ge 0 \\ \frac{c}{b} - \frac{b}{a} & \text{otherwise} \end{cases}\]
      0.0

    8. Applied final simplification

    if -431232863.47265303 < b < 1.4445095675228828e-303

    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.7
    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}\]
      9.7
    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}\]
      9.7
    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}}\]
      9.7
    5. Using strategy rm
      9.7
    6. Applied add-cbrt-cube to get
      \[\begin{cases} \color{red}{\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} \color{blue}{\sqrt[3]{{\left(\frac{c}{\frac{c}{b} \cdot a - b}\right)}^3}} & \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}\]
      9.7
    7. Applied taylor to get
      \[\begin{cases} \sqrt[3]{{\left(\frac{c}{\frac{c}{b} \cdot a - b}\right)}^3} & \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{-1}{b \cdot c} & \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}\]
      9.0
    8. Taylor expanded around inf to get
      \[\begin{cases} \color{red}{\frac{-1}{b \cdot c}} & \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} \color{blue}{\frac{-1}{b \cdot c}} & \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}\]
      9.0
    9. Applied simplify to get
      \[\begin{cases} \frac{-1}{b \cdot c} & \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{-1}{b \cdot c} & \text{when } b \ge 0 \\ \frac{\sqrt{{b}^2 - c \cdot \left(4 \cdot a\right)} + \left(-b\right)}{a \cdot 2} & \text{otherwise} \end{cases}\]
      9.0

    10. Applied final simplification

    if 1.4445095675228828e-303 < b < 7.953681720830793e+130

    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}\]
      8.7
    2. Using strategy rm
      8.7
    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}\]
      8.7
    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}\]
      8.7

    if 7.953681720830793e+130 < 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}\]
      34.4
    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{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      34.4
    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{\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}{\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}\]
      34.4
    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(2 \cdot \frac{c \cdot a}{b} - b\right)}{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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      7.7
    5. 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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases}\]
      7.7
    6. Applied simplify to get
      \[\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) + \left(2 \cdot \frac{c \cdot a}{b} - b\right)}{2 \cdot a} & \text{otherwise} \end{cases} \leadsto \begin{cases} \frac{c \cdot 2}{(\left(\frac{a}{\frac{b}{c}}\right) * 2 + \left(\left(-b\right) - b\right))_*} & \text{when } b \ge 0 \\ \frac{(\left(\frac{a}{\frac{b}{c}}\right) * 2 + \left(\left(-b\right) - b\right))_*}{2 \cdot a} & \text{otherwise} \end{cases}\]
      1.0

    7. Applied final simplification

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