Average Error: 14.5 → 7.4
Time: 13.5s
Precision: 64
Internal Precision: 576
\[\sqrt{x \cdot \left(expt \cdot 2\right) + y \cdot \left(expt \cdot 2\right)}\]
\[\begin{array}{l} \mathbf{if}\;expt \le 8.6675727301626 \cdot 10^{-302}:\\ \;\;\;\;\sqrt{\left(expt \cdot 2\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{y + x} \cdot \sqrt{expt \cdot 2}\\ \end{array}\]

Error

Bits error versus x

Bits error versus expt

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if expt < 8.6675727301626e-302

    1. Initial program 14.2

      \[\sqrt{x \cdot \left(expt \cdot 2\right) + y \cdot \left(expt \cdot 2\right)}\]
    2. Initial simplification14.2

      \[\leadsto \sqrt{\left(x + y\right) \cdot \left(expt \cdot 2\right)}\]

    if 8.6675727301626e-302 < expt

    1. Initial program 14.8

      \[\sqrt{x \cdot \left(expt \cdot 2\right) + y \cdot \left(expt \cdot 2\right)}\]
    2. Using strategy rm
    3. Applied distribute-rgt-out14.8

      \[\leadsto \sqrt{\color{blue}{\left(expt \cdot 2\right) \cdot \left(x + y\right)}}\]
    4. Applied sqrt-prod0.4

      \[\leadsto \color{blue}{\sqrt{expt \cdot 2} \cdot \sqrt{x + y}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification7.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;expt \le 8.6675727301626 \cdot 10^{-302}:\\ \;\;\;\;\sqrt{\left(expt \cdot 2\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{y + x} \cdot \sqrt{expt \cdot 2}\\ \end{array}\]

Runtime

Time bar (total: 13.5s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x expt y)
  :name "sqrt(x expt 2 + y expt 2)"
  (sqrt (+ (* x (* expt 2)) (* y (* expt 2)))))