\frac{x}{x} - \frac{1}{x} \cdot \sqrt{x \cdot x}\left(-1\right) \cdot \frac{\left|x\right|}{x} + 1double f(double x) {
double r199201 = x;
double r199202 = r199201 / r199201;
double r199203 = 1.0;
double r199204 = r199203 / r199201;
double r199205 = r199201 * r199201;
double r199206 = sqrt(r199205);
double r199207 = r199204 * r199206;
double r199208 = r199202 - r199207;
return r199208;
}
double f(double x) {
double r199209 = 1.0;
double r199210 = -r199209;
double r199211 = x;
double r199212 = fabs(r199211);
double r199213 = r199212 / r199211;
double r199214 = r199210 * r199213;
double r199215 = 1.0;
double r199216 = r199214 + r199215;
return r199216;
}




Bits error versus x
Results
| Original | 32.0 |
|---|---|
| Target | 0 |
| Herbie | 0 |
Initial program 32.0
Simplified30.6
rmApplied fma-udef4.5
rmApplied div-inv4.5
Applied distribute-lft-neg-in4.5
Applied associate-*l*4.5
Simplified0
Final simplification0
herbie shell --seed 2020027 +o rules:numerics
(FPCore (x)
:name "sqrt sqr"
:precision binary64
:herbie-target
(if (< x 0.0) 2 0.0)
(- (/ x x) (* (/ 1 x) (sqrt (* x x)))))