Average Error: 31.7 → 14.0
Time: 2.8s
Precision: 64
Internal Precision: 1344
\[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
\[\begin{array}{l} \mathbf{if}\;x \le 2.37804077828903 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;1 - 1\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original31.7
Target0
Herbie14.0
\[\begin{array}{l} \mathbf{if}\;x \lt 0:\\ \;\;\;\;2\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < 2.37804077828903e-310

    1. Initial program 27.9

      \[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]

    if 2.37804077828903e-310 < x

    1. Initial program 35.6

      \[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
    2. Initial simplification0

      \[\leadsto 1 - 1\]
  3. Recombined 2 regimes into one program.
  4. Final simplification14.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 2.37804077828903 \cdot 10^{-310}:\\ \;\;\;\;\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;1 - 1\\ \end{array}\]

Runtime

Time bar (total: 2.8s)Debug logProfile

herbie shell --seed 2018214 
(FPCore (x)
  :name "sqrt sqr"

  :herbie-target
  (if (< x 0) 2 0)

  (- (/ x x) (* (/ 1 x) (sqrt (* x x)))))