Average Error: 27.9 → 15.9
Time: 32.5s
Precision: 64
Internal Precision: 576
\[\frac{p}{\sqrt{0.5 \cdot \left(\left(\left(4 \cdot p\right) \cdot p + \left(q - r\right) \cdot \left(q - r\right)\right) + \left(q - r\right) \cdot q\right)}}\]
\[\begin{array}{l} \mathbf{if}\;p \le -6.098028580324901 \cdot 10^{+106}:\\ \;\;\;\;\frac{p}{0.75 \cdot \frac{r \cdot q}{p \cdot \sqrt{2.0}} - p \cdot \sqrt{2.0}}\\ \mathbf{elif}\;p \le 1.106817396820396 \cdot 10^{+152}:\\ \;\;\;\;\frac{p}{\sqrt{\left(p \cdot 4\right) \cdot \left(p \cdot 0.5\right) + \left(\left(q - r\right) \cdot 0.5\right) \cdot \left(q - \left(r - q\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;p \cdot \frac{1}{p \cdot \sqrt{2.0} - 0.75 \cdot \frac{r \cdot q}{p \cdot \sqrt{2.0}}}\\ \end{array}\]

Error

Bits error versus p

Bits error versus q

Bits error versus r

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if p < -6.098028580324901e+106

    1. Initial program 53.9

      \[\frac{p}{\sqrt{0.5 \cdot \left(\left(\left(4 \cdot p\right) \cdot p + \left(q - r\right) \cdot \left(q - r\right)\right) + \left(q - r\right) \cdot q\right)}}\]
    2. Initial simplification53.8

      \[\leadsto \frac{p}{\sqrt{\left(p \cdot 4\right) \cdot \left(p \cdot 0.5\right) + \left(0.5 \cdot \left(q - r\right)\right) \cdot \left(q - \left(r - q\right)\right)}}\]
    3. Taylor expanded around -inf 20.2

      \[\leadsto \frac{p}{\color{blue}{0.75 \cdot \frac{r \cdot q}{p \cdot \sqrt{2.0}} - p \cdot \sqrt{2.0}}}\]

    if -6.098028580324901e+106 < p < 1.106817396820396e+152

    1. Initial program 15.9

      \[\frac{p}{\sqrt{0.5 \cdot \left(\left(\left(4 \cdot p\right) \cdot p + \left(q - r\right) \cdot \left(q - r\right)\right) + \left(q - r\right) \cdot q\right)}}\]
    2. Initial simplification14.7

      \[\leadsto \frac{p}{\sqrt{\left(p \cdot 4\right) \cdot \left(p \cdot 0.5\right) + \left(0.5 \cdot \left(q - r\right)\right) \cdot \left(q - \left(r - q\right)\right)}}\]

    if 1.106817396820396e+152 < p

    1. Initial program 61.3

      \[\frac{p}{\sqrt{0.5 \cdot \left(\left(\left(4 \cdot p\right) \cdot p + \left(q - r\right) \cdot \left(q - r\right)\right) + \left(q - r\right) \cdot q\right)}}\]
    2. Initial simplification61.2

      \[\leadsto \frac{p}{\sqrt{\left(p \cdot 4\right) \cdot \left(p \cdot 0.5\right) + \left(0.5 \cdot \left(q - r\right)\right) \cdot \left(q - \left(r - q\right)\right)}}\]
    3. Using strategy rm
    4. Applied div-inv61.2

      \[\leadsto \color{blue}{p \cdot \frac{1}{\sqrt{\left(p \cdot 4\right) \cdot \left(p \cdot 0.5\right) + \left(0.5 \cdot \left(q - r\right)\right) \cdot \left(q - \left(r - q\right)\right)}}}\]
    5. Taylor expanded around inf 17.0

      \[\leadsto p \cdot \frac{1}{\color{blue}{p \cdot \sqrt{2.0} - 0.75 \cdot \frac{r \cdot q}{p \cdot \sqrt{2.0}}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification15.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;p \le -6.098028580324901 \cdot 10^{+106}:\\ \;\;\;\;\frac{p}{0.75 \cdot \frac{r \cdot q}{p \cdot \sqrt{2.0}} - p \cdot \sqrt{2.0}}\\ \mathbf{elif}\;p \le 1.106817396820396 \cdot 10^{+152}:\\ \;\;\;\;\frac{p}{\sqrt{\left(p \cdot 4\right) \cdot \left(p \cdot 0.5\right) + \left(\left(q - r\right) \cdot 0.5\right) \cdot \left(q - \left(r - q\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;p \cdot \frac{1}{p \cdot \sqrt{2.0} - 0.75 \cdot \frac{r \cdot q}{p \cdot \sqrt{2.0}}}\\ \end{array}\]

Runtime

Time bar (total: 32.5s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (p q r)
  :name "p/sqrt(0.5*(4*p*p + (q-r)*(q-r) + (q-r)*q))"
  (/ p (sqrt (* 0.5 (+ (+ (* (* 4 p) p) (* (- q r) (- q r))) (* (- q r) q))))))