Average Error: 7.5 → 4.3
Time: 19.6s
Precision: 64
Internal Precision: 320
\[\sqrt{x + a \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x + x \cdot a \le 8.311562281807733 \cdot 10^{+285}:\\ \;\;\;\;\sqrt{x + x \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + a} \cdot \sqrt{x}\\ \end{array}\]

Error

Bits error versus x

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (+ x (* a x)) < 8.311562281807733e+285

    1. Initial program 0.1

      \[\sqrt{x + a \cdot x}\]

    if 8.311562281807733e+285 < (+ x (* a x))

    1. Initial program 46.9

      \[\sqrt{x + a \cdot x}\]
    2. Using strategy rm
    3. Applied distribute-rgt1-in46.9

      \[\leadsto \sqrt{\color{blue}{\left(a + 1\right) \cdot x}}\]
    4. Applied sqrt-prod26.7

      \[\leadsto \color{blue}{\sqrt{a + 1} \cdot \sqrt{x}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + x \cdot a \le 8.311562281807733 \cdot 10^{+285}:\\ \;\;\;\;\sqrt{x + x \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 + a} \cdot \sqrt{x}\\ \end{array}\]

Runtime

Time bar (total: 19.6s)Debug log

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