Average Error: 31.9 → 0.0
Time: 13.2s
Precision: 64
Internal Precision: 128
\[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
\[\frac{x - \left|x\right|}{x}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 31.9

    \[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
  2. Using strategy rm
  3. Applied associate-*l/29.5

    \[\leadsto \frac{x}{x} - \color{blue}{\frac{1 \cdot \sqrt{x \cdot x}}{x}}\]
  4. Applied sub-div29.5

    \[\leadsto \color{blue}{\frac{x - 1 \cdot \sqrt{x \cdot x}}{x}}\]
  5. Simplified0.0

    \[\leadsto \frac{\color{blue}{x - \left|x\right|}}{x}\]
  6. Final simplification0.0

    \[\leadsto \frac{x - \left|x\right|}{x}\]

Runtime

Time bar (total: 13.2s)Debug logProfile

herbie shell --seed 2018348 +o rules:numerics
(FPCore (x)
  :name "sqrt sqr"

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

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