Average Error: 22.4 → 15.8
Time: 49.5s
Precision: 64
Internal Precision: 1344
\[\frac{\left(1 - 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 \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 32524.336403369205:\\ \;\;\;\;\frac{\left(1 - alphaD\right) + \sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD}}{2 \cdot \sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2.0 \cdot \left(\frac{\frac{Kp}{alphaD}}{alphaD} + \left(\frac{Kp}{alphaD} + Kp\right)\right)}{2 \cdot \sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD}}\\ \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 2 regimes
  2. if alphaD < 32524.336403369205

    1. Initial program 12.3

      \[\frac{\left(1 - 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 \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 simplification12.3

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

    if 32524.336403369205 < alphaD

    1. Initial program 53.3

      \[\frac{\left(1 - 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 \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 simplification53.3

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

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

      \[\leadsto \frac{\color{blue}{\left(\frac{\frac{Kp}{alphaD}}{alphaD} + \left(Kp + \frac{Kp}{alphaD}\right)\right) \cdot 2.0}}{\sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD} \cdot 2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification15.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;alphaD \le 32524.336403369205:\\ \;\;\;\;\frac{\left(1 - alphaD\right) + \sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD}}{2 \cdot \sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2.0 \cdot \left(\frac{\frac{Kp}{alphaD}}{alphaD} + \left(\frac{Kp}{alphaD} + Kp\right)\right)}{2 \cdot \sqrt{1.0 - \left(\left(2.0 - alphaD\right) - Kp \cdot 4.0\right) \cdot alphaD}}\\ \end{array}\]

Runtime

Time bar (total: 49.5s)Debug log

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