Average Error: 32.5 → 0
Time: 2.6s
Precision: 64
Internal Precision: 1344
\[\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\]
\[\frac{x}{x} - \frac{\left|x\right|}{x}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 32.5

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

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

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

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

Runtime

Time bar (total: 2.6s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes0000100%
herbie shell --seed 2018297 +o rules:numerics
(FPCore (x)
  :name "sqrt sqr"

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

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