\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}
\begin{array}{l}
\mathbf{if}\;x \leq 1.30521497135303 \cdot 10^{-310}:\\
\;\;\;\;2\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
(FPCore (x) :precision binary64 (- (/ x x) (* (/ 1.0 x) (sqrt (* x x)))))
(FPCore (x) :precision binary64 (if (<= x 1.30521497135303e-310) 2.0 0.0))
double code(double x) {
return (x / x) - ((1.0 / x) * sqrt((x * x)));
}
double code(double x) {
double tmp;
if (x <= 1.30521497135303e-310) {
tmp = 2.0;
} else {
tmp = 0.0;
}
return tmp;
}




Bits error versus x
Results
| Original | 32.1 |
|---|---|
| Target | 0 |
| Herbie | 0 |
if x < 1.305214971353029e-310Initial program 27.9
Taylor expanded in x around -inf 0
if 1.305214971353029e-310 < x Initial program 36.5
Taylor expanded in x around 0 0
Final simplification0
herbie shell --seed 2022129
(FPCore (x)
:name "sqrt sqr"
:precision binary64
:herbie-target
(if (< x 0.0) 2.0 0.0)
(- (/ x x) (* (/ 1.0 x) (sqrt (* x x)))))