\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -2.716741353213512542561167857708974654712 \cdot 10^{196}:\\
\;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\
\mathbf{elif}\;x \le 5.61926533510320507337176445760607473729 \cdot 10^{-243}:\\
\;\;\;\;\left(1 \cdot \frac{x}{z} + \frac{x \cdot y}{z}\right) - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + y\right) - x\\
\end{array}double f(double x, double y, double z) {
double r767238 = x;
double r767239 = y;
double r767240 = z;
double r767241 = r767239 - r767240;
double r767242 = 1.0;
double r767243 = r767241 + r767242;
double r767244 = r767238 * r767243;
double r767245 = r767244 / r767240;
return r767245;
}
double f(double x, double y, double z) {
double r767246 = x;
double r767247 = -2.7167413532135125e+196;
bool r767248 = r767246 <= r767247;
double r767249 = z;
double r767250 = y;
double r767251 = r767250 - r767249;
double r767252 = 1.0;
double r767253 = r767251 + r767252;
double r767254 = r767249 / r767253;
double r767255 = r767246 / r767254;
double r767256 = 5.619265335103205e-243;
bool r767257 = r767246 <= r767256;
double r767258 = r767246 / r767249;
double r767259 = r767252 * r767258;
double r767260 = r767246 * r767250;
double r767261 = r767260 / r767249;
double r767262 = r767259 + r767261;
double r767263 = r767262 - r767246;
double r767264 = r767252 + r767250;
double r767265 = r767258 * r767264;
double r767266 = r767265 - r767246;
double r767267 = r767257 ? r767263 : r767266;
double r767268 = r767248 ? r767255 : r767267;
return r767268;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 9.9 |
|---|---|
| Target | 0.4 |
| Herbie | 1.2 |
if x < -2.7167413532135125e+196Initial program 49.8
rmApplied associate-/l*0.1
if -2.7167413532135125e+196 < x < 5.619265335103205e-243Initial program 4.4
Taylor expanded around 0 1.5
Simplified2.1
rmApplied *-un-lft-identity2.1
Applied add-cube-cbrt2.8
Applied times-frac2.8
Applied associate-*l*3.2
rmApplied distribute-lft-in3.2
Applied distribute-lft-in3.2
Simplified2.9
Simplified1.5
if 5.619265335103205e-243 < x Initial program 11.6
Taylor expanded around 0 4.0
Simplified0.8
Final simplification1.2
herbie shell --seed 2019350
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1)) z))