Average Error: 39.5 → 24.9
Time: 47.7s
Precision: 64
Internal Precision: 1344
\[\frac{\left(1.0 - alphaD\right) - \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}{2.0 \cdot \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}\]
\[\begin{array}{l} \mathbf{if}\;alphaD \le -4306.665027935117:\\ \;\;\;\;\frac{2.0 \cdot \left(\frac{\frac{Kp}{alphaD}}{alphaD} + \left(\frac{Kp}{alphaD} + Kp\right)\right)}{\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} \cdot 2.0}\\ \mathbf{elif}\;alphaD \le 1.8883287608511567 \cdot 10^{-223}:\\ \;\;\;\;\frac{\left(\left(1.0 - alphaD\right) \cdot \left(1.0 - alphaD\right) - 1.0\right) - alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right)}{\left(\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} \cdot 2.0\right) \cdot \left(\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} + \left(1.0 - alphaD\right)\right)}\\ \mathbf{elif}\;alphaD \le 2.0614873315665608 \cdot 10^{+99}:\\ \;\;\;\;\frac{1.0 - \left(\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} + alphaD\right)}{\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} \cdot 2.0}\\ \mathbf{else}:\\ \;\;\;\;-1.0\\ \end{array}\]

Error

Bits error versus alphaD

Bits error versus Kp

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if alphaD < -4306.665027935117

    1. Initial program 54.2

      \[\frac{\left(1.0 - alphaD\right) - \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}{2.0 \cdot \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}\]
    2. Initial simplification54.2

      \[\leadsto \frac{\left(1.0 - alphaD\right) - \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]
    3. Taylor expanded around -inf 25.2

      \[\leadsto \frac{\color{blue}{2.0 \cdot \frac{Kp}{{alphaD}^{2}} + \left(2.0 \cdot Kp + 2.0 \cdot \frac{Kp}{alphaD}\right)}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]
    4. Simplified25.2

      \[\leadsto \frac{\color{blue}{\left(\frac{\frac{Kp}{alphaD}}{alphaD} + \left(Kp + \frac{Kp}{alphaD}\right)\right) \cdot 2.0}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]

    if -4306.665027935117 < alphaD < 1.8883287608511567e-223

    1. Initial program 32.4

      \[\frac{\left(1.0 - alphaD\right) - \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}{2.0 \cdot \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}\]
    2. Initial simplification32.4

      \[\leadsto \frac{\left(1.0 - alphaD\right) - \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]
    3. Using strategy rm
    4. Applied flip--32.4

      \[\leadsto \frac{\color{blue}{\frac{\left(1.0 - alphaD\right) \cdot \left(1.0 - alphaD\right) - \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)} \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}{\left(1.0 - alphaD\right) + \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]
    5. Applied associate-/l/32.4

      \[\leadsto \color{blue}{\frac{\left(1.0 - alphaD\right) \cdot \left(1.0 - alphaD\right) - \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)} \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}{\left(2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}\right) \cdot \left(\left(1.0 - alphaD\right) + \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}\right)}}\]
    6. Simplified34.5

      \[\leadsto \frac{\color{blue}{\left(\left(1.0 - alphaD\right) \cdot \left(1.0 - alphaD\right) - 1.0\right) - \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right) \cdot alphaD}}{\left(2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}\right) \cdot \left(\left(1.0 - alphaD\right) + \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}\right)}\]

    if 1.8883287608511567e-223 < alphaD < 2.0614873315665608e+99

    1. Initial program 25.7

      \[\frac{\left(1.0 - alphaD\right) - \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}{2.0 \cdot \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}\]
    2. Initial simplification25.7

      \[\leadsto \frac{\left(1.0 - alphaD\right) - \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]
    3. Using strategy rm
    4. Applied associate--l-25.7

      \[\leadsto \frac{\color{blue}{1.0 - \left(alphaD + \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}\right)}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]

    if 2.0614873315665608e+99 < alphaD

    1. Initial program 50.5

      \[\frac{\left(1.0 - alphaD\right) - \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}{2.0 \cdot \sqrt{\left(\left(1.0 - 2.0 \cdot alphaD\right) + \left(4.0 \cdot Kp\right) \cdot alphaD\right) + alphaD \cdot alphaD}}\]
    2. Initial simplification50.5

      \[\leadsto \frac{\left(1.0 - alphaD\right) - \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}{2.0 \cdot \sqrt{1.0 + alphaD \cdot \left(4.0 \cdot Kp + \left(alphaD - 2.0\right)\right)}}\]
    3. Taylor expanded around inf 5.6

      \[\leadsto \color{blue}{-1.0}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification24.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;alphaD \le -4306.665027935117:\\ \;\;\;\;\frac{2.0 \cdot \left(\frac{\frac{Kp}{alphaD}}{alphaD} + \left(\frac{Kp}{alphaD} + Kp\right)\right)}{\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} \cdot 2.0}\\ \mathbf{elif}\;alphaD \le 1.8883287608511567 \cdot 10^{-223}:\\ \;\;\;\;\frac{\left(\left(1.0 - alphaD\right) \cdot \left(1.0 - alphaD\right) - 1.0\right) - alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right)}{\left(\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} \cdot 2.0\right) \cdot \left(\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} + \left(1.0 - alphaD\right)\right)}\\ \mathbf{elif}\;alphaD \le 2.0614873315665608 \cdot 10^{+99}:\\ \;\;\;\;\frac{1.0 - \left(\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} + alphaD\right)}{\sqrt{alphaD \cdot \left(Kp \cdot 4.0 + \left(alphaD - 2.0\right)\right) + 1.0} \cdot 2.0}\\ \mathbf{else}:\\ \;\;\;\;-1.0\\ \end{array}\]

Runtime

Time bar (total: 47.7s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (alphaD Kp)
  :name "(1.0 - alphaD - sqrt(1.0 - 2.0*alphaD + 4.0*Kp*alphaD + alphaD*alphaD))/(2.0*sqrt(1.0 - 2.0*alphaD + 4.0*Kp*alphaD + alphaD*alphaD))"
  (/ (- (- 1.0 alphaD) (sqrt (+ (+ (- 1.0 (* 2.0 alphaD)) (* (* 4.0 Kp) alphaD)) (* alphaD alphaD)))) (* 2.0 (sqrt (+ (+ (- 1.0 (* 2.0 alphaD)) (* (* 4.0 Kp) alphaD)) (* alphaD alphaD))))))