\[\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
Test:
NMSE p42, positive
Bits:
128 bits
Bits error versus a
Bits error versus b
Bits error versus c
Time: 1.0 m
Input Error: 17.0
Output Error: 4.1
Log:
Profile: 🕒
\(\begin{cases} \frac{c}{b} - \frac{b}{a} & \text{when } b \le -7.1884515f+13 \\ \frac{\frac{1}{2}}{a} \cdot \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right) & \text{when } b \le 3.5037975f0 \\ \frac{\frac{c}{\frac{2}{4}}}{\frac{c}{b} \cdot a - b} \cdot \frac{1}{2} & \text{otherwise} \end{cases}\)

    if b < -7.1884515f+13

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      23.2
    2. Applied taylor to get
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \leadsto \frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a}\]
      6.1
    3. Taylor expanded around -inf to get
      \[\frac{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a} \leadsto \frac{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a}\]
      6.1
    4. Applied simplify to get
      \[\color{red}{\frac{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}{2 \cdot a}} \leadsto \color{blue}{\frac{\frac{c}{b}}{1} - \frac{b}{a}}\]
      0.0
    5. Applied simplify to get
      \[\color{red}{\frac{\frac{c}{b}}{1}} - \frac{b}{a} \leadsto \color{blue}{\frac{c}{b}} - \frac{b}{a}\]
      0.0

    if -7.1884515f+13 < b < 3.5037975f0

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      7.1
    2. Using strategy rm
      7.1
    3. Applied add-cube-cbrt to get
      \[\color{red}{\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}} \leadsto \color{blue}{{\left(\sqrt[3]{\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}}\right)}^3}\]
      7.5
    4. Applied taylor to get
      \[{\left(\sqrt[3]{\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}}\right)}^3 \leadsto {\left(\sqrt[3]{\frac{1}{2} \cdot \frac{\sqrt{{b}^2 - 4 \cdot \left(c \cdot a\right)} - b}{a}}\right)}^3\]
      7.5
    5. Taylor expanded around 0 to get
      \[{\color{red}{\left(\sqrt[3]{\frac{1}{2} \cdot \frac{\sqrt{{b}^2 - 4 \cdot \left(c \cdot a\right)} - b}{a}}\right)}}^3 \leadsto {\color{blue}{\left(\sqrt[3]{\frac{1}{2} \cdot \frac{\sqrt{{b}^2 - 4 \cdot \left(c \cdot a\right)} - b}{a}}\right)}}^3\]
      7.5
    6. Applied simplify to get
      \[{\left(\sqrt[3]{\frac{1}{2} \cdot \frac{\sqrt{{b}^2 - 4 \cdot \left(c \cdot a\right)} - b}{a}}\right)}^3 \leadsto \frac{\frac{1}{2}}{a} \cdot \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right)\]
      7.2

    7. Applied final simplification

    if 3.5037975f0 < b

    1. Started with
      \[\frac{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
      28.2
    2. Using strategy rm
      28.2
    3. Applied flip-+ to get
      \[\frac{\color{red}{\left(-b\right) + \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a} \leadsto \frac{\color{blue}{\frac{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}\right)}^2}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}}{2 \cdot a}\]
      29.9
    4. Applied simplify to get
      \[\frac{\frac{\color{red}{{\left(-b\right)}^2 - {\left(\sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}\right)}^2}}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a} \leadsto \frac{\frac{\color{blue}{c \cdot \left(4 \cdot a\right)}}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a}\]
      15.2
    5. Applied taylor to get
      \[\frac{\frac{c \cdot \left(4 \cdot a\right)}{\left(-b\right) - \sqrt{{b}^2 - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a} \leadsto \frac{\frac{c \cdot \left(4 \cdot a\right)}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a}\]
      7.6
    6. Taylor expanded around inf to get
      \[\frac{\frac{c \cdot \left(4 \cdot a\right)}{\color{red}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}}{2 \cdot a} \leadsto \frac{\frac{c \cdot \left(4 \cdot a\right)}{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}}{2 \cdot a}\]
      7.6
    7. Applied simplify to get
      \[\color{red}{\frac{\frac{c \cdot \left(4 \cdot a\right)}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{2 \cdot a}} \leadsto \color{blue}{\frac{\frac{c}{\frac{2}{4}}}{\frac{c}{b} \cdot a - b} \cdot \frac{1}{2}}\]
      1.5

  1. Removed slow pow expressions

Original test:


(lambda ((a default) (b default) (c default))
  #:name "NMSE p42, positive"
  (/ (+ (- b) (sqrt (- (sqr b) (* 4 (* a c))))) (* 2 a))
  #:target
  (if (< b 0) (/ (+ (- b) (sqrt (- (sqr b) (* 4 (* a c))))) (* 2 a)) (/ c (* a (/ (- (- b) (sqrt (- (sqr b) (* 4 (* a c))))) (* 2 a))))))