jeff quadratic root 2

Percentage Accurate: 73.0% → 90.8%
Time: 18.1s
Alternatives: 5
Speedup: 13.0×

Specification

?
\[\begin{array}{l} t_0 := -b\\ t_1 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{t_0 - t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 + t_1}{2 \cdot a}\\ \end{array} \]

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Alternative 1: 90.8% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ \mathbf{if}\;b \leq -1.22 \cdot 10^{+112}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{+104}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b + b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if b < -1.22e112

    1. Initial program 50.3%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Step-by-step derivation
      1. Simplified50.2%

        \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
      2. Taylor expanded in b around inf 50.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
      3. Step-by-step derivation
        1. fma-def50.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        2. associate-/l*50.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        3. *-commutative50.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
      4. Simplified50.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
      5. Taylor expanded in b around -inf 95.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
      6. Step-by-step derivation
        1. associate-*r/95.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b - -1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
        2. cancel-sign-sub-inv95.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + \left(--1\right) \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
        3. metadata-eval95.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + 1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
        4. *-un-lft-identity95.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
      7. Applied egg-rr95.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
      8. Taylor expanded in c around inf 95.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]

      if -1.22e112 < b < 1e104

      1. Initial program 85.3%

        \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]

      if 1e104 < b

      1. Initial program 60.5%

        \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      2. Step-by-step derivation
        1. Simplified60.5%

          \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
        2. Taylor expanded in b around inf 90.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        3. Step-by-step derivation
          1. fma-def90.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          2. associate-/l*98.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          3. *-commutative98.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        4. Simplified98.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        5. Taylor expanded in b around -inf 98.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        6. Step-by-step derivation
          1. div-inv98.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{c \cdot \frac{1}{\frac{b}{a}}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          2. clear-num98.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \color{blue}{\frac{a}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
        7. Applied egg-rr98.4%

          \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{c \cdot \frac{a}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification90.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.22 \cdot 10^{+112}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{+104}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b + b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]

      Alternative 2: 84.7% accurate, 1.0× speedup?

      \[\begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ \mathbf{if}\;b \leq -1 \cdot 10^{+114}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.36 \cdot 10^{-150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{2}{b - t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b + b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
      Derivation
      1. Split input into 3 regimes
      2. if b < -1e114

        1. Initial program 50.3%

          \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
        2. Step-by-step derivation
          1. Simplified50.2%

            \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
          2. Taylor expanded in b around inf 50.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          3. Step-by-step derivation
            1. fma-def50.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            2. associate-/l*50.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            3. *-commutative50.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          4. Simplified50.2%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          5. Taylor expanded in b around -inf 95.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          6. Step-by-step derivation
            1. associate-*r/95.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b - -1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
            2. cancel-sign-sub-inv95.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + \left(--1\right) \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
            3. metadata-eval95.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + 1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
            4. *-un-lft-identity95.4%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
          7. Applied egg-rr95.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
          8. Taylor expanded in c around inf 95.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]

          if -1e114 < b < 1.3600000000000001e-150

          1. Initial program 84.8%

            \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
          2. Step-by-step derivation
            1. expm1-log1p-u78.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            2. expm1-udef69.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{e^{\mathsf{log1p}\left(\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            3. *-commutative69.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{\color{blue}{c \cdot 2}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            4. add-sqr-sqrt65.6%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            5. sqrt-unprod69.8%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            6. sqr-neg69.8%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\sqrt{\color{blue}{b \cdot b}} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            7. sqrt-prod69.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\color{blue}{\sqrt{b} \cdot \sqrt{b}} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            8. add-sqr-sqrt69.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\color{blue}{b} - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            9. *-commutative69.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{b - \sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            10. *-commutative69.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{b - \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}}}\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
          3. Applied egg-rr69.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{e^{\mathsf{log1p}\left(\frac{c \cdot 2}{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\right)} - 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
          4. Step-by-step derivation
            1. expm1-def77.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c \cdot 2}{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            2. expm1-log1p84.5%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{c \cdot 2}{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            3. associate-*r/84.5%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{c \cdot \frac{2}{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
          5. Simplified84.5%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{c \cdot \frac{2}{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]

          if 1.3600000000000001e-150 < b

          1. Initial program 71.5%

            \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
          2. Step-by-step derivation
            1. Simplified71.5%

              \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
            2. Taylor expanded in b around inf 81.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            3. Step-by-step derivation
              1. fma-def81.2%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              2. associate-/l*86.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              3. *-commutative86.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            4. Simplified86.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            5. Taylor expanded in b around -inf 86.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            6. Step-by-step derivation
              1. div-inv86.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{c \cdot \frac{1}{\frac{b}{a}}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              2. clear-num86.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \color{blue}{\frac{a}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            7. Applied egg-rr86.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{c \cdot \frac{a}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification87.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+114}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.36 \cdot 10^{-150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{2}{b - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b + b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]

          Alternative 3: 68.0% accurate, 1.0× speedup?

          \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
          Derivation
          1. Initial program 71.5%

            \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
          2. Step-by-step derivation
            1. Simplified71.4%

              \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
            2. Taylor expanded in b around inf 68.8%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            3. Step-by-step derivation
              1. fma-def68.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              2. associate-/l*70.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              3. *-commutative70.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            4. Simplified70.7%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            5. Taylor expanded in b around -inf 72.9%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            6. Step-by-step derivation
              1. associate-*r/73.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b - -1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
              2. cancel-sign-sub-inv73.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + \left(--1\right) \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
              3. metadata-eval73.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + 1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
              4. *-un-lft-identity73.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
            7. Applied egg-rr73.1%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
            8. Step-by-step derivation
              1. div-inv72.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{c \cdot \frac{1}{\frac{b}{a}}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              2. clear-num72.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \color{blue}{\frac{a}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
            9. Applied egg-rr73.1%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{c \cdot \frac{a}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
            10. Final simplification73.1%

              \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]

            Alternative 4: 36.2% accurate, 13.0× speedup?

            \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
            Derivation
            1. Initial program 71.5%

              \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
            2. Step-by-step derivation
              1. Simplified71.4%

                \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
              2. Taylor expanded in b around inf 68.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              3. Step-by-step derivation
                1. fma-def68.8%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                2. associate-/l*70.7%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                3. *-commutative70.7%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              4. Simplified70.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              5. Taylor expanded in b around -inf 72.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
              6. Step-by-step derivation
                1. associate-*r/73.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b - -1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
                2. cancel-sign-sub-inv73.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + \left(--1\right) \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
                3. metadata-eval73.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + 1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
                4. *-un-lft-identity73.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
              7. Applied egg-rr73.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
              8. Taylor expanded in c around inf 40.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
              9. Final simplification40.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]

              Alternative 5: 67.8% accurate, 13.0× speedup?

              \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
              Derivation
              1. Initial program 71.5%

                \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
              2. Step-by-step derivation
                1. Simplified71.4%

                  \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ } \end{array}} \]
                2. Taylor expanded in b around inf 68.8%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{c \cdot a}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                3. Step-by-step derivation
                  1. fma-def68.8%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c \cdot a}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                  2. associate-/l*70.7%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \color{blue}{\frac{c}{\frac{b}{a}}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                  3. *-commutative70.7%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                4. Simplified70.7%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                5. Taylor expanded in b around -inf 72.9%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(b - -1 \cdot b\right) \cdot \frac{-0.5}{a}\\ \end{array} \]
                6. Step-by-step derivation
                  1. associate-*r/73.1%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b - -1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
                  2. cancel-sign-sub-inv73.1%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + \left(--1\right) \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
                  3. metadata-eval73.1%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + 1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
                  4. *-un-lft-identity73.1%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
                7. Applied egg-rr73.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
                8. Taylor expanded in c around 0 73.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{-1 \cdot \frac{c}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
                9. Step-by-step derivation
                  1. associate-*r/73.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-1 \cdot c}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
                  2. neg-mul-173.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\color{blue}{-c}}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
                10. Simplified73.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-c}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]
                11. Final simplification73.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + b\right) \cdot -0.5}{a}\\ \end{array} \]

                Reproduce

                ?
                herbie shell --seed 2023167 
                (FPCore (a b c)
                  :name "jeff quadratic root 2"
                  :precision binary64
                  (if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))