\left(a - \left(\frac{\left(1.0\right)}{\left(3.0\right)}\right)\right) \cdot \left(\frac{\left(1\right)}{\left(\left(\frac{\left(1\right)}{\left(\sqrt{\left(\left(9\right) \cdot \left(a - \left(\frac{\left(1.0\right)}{\left(3.0\right)}\right)\right)\right)}\right)}\right) \cdot rand\right)}\right)\left(a - \frac{1.0}{3.0}\right) \cdot 1 + \frac{\left(a - \frac{1.0}{3.0}\right) \cdot 1}{\sqrt{\left(a - \frac{1.0}{3.0}\right) \cdot 9}} \cdot randdouble f(double a, double rand) {
double r1179934 = a;
double r1179935 = 1.0;
double r1179936 = /* ERROR: no posit support in C */;
double r1179937 = 3.0;
double r1179938 = /* ERROR: no posit support in C */;
double r1179939 = r1179936 / r1179938;
double r1179940 = r1179934 - r1179939;
double r1179941 = 1.0;
double r1179942 = /* ERROR: no posit support in C */;
double r1179943 = 9.0;
double r1179944 = /* ERROR: no posit support in C */;
double r1179945 = r1179944 * r1179940;
double r1179946 = sqrt(r1179945);
double r1179947 = r1179942 / r1179946;
double r1179948 = rand;
double r1179949 = r1179947 * r1179948;
double r1179950 = r1179942 + r1179949;
double r1179951 = r1179940 * r1179950;
return r1179951;
}
double f(double a, double rand) {
double r1179952 = a;
double r1179953 = 1.0;
double r1179954 = 3.0;
double r1179955 = r1179953 / r1179954;
double r1179956 = r1179952 - r1179955;
double r1179957 = 1.0;
double r1179958 = r1179956 * r1179957;
double r1179959 = 9.0;
double r1179960 = r1179956 * r1179959;
double r1179961 = sqrt(r1179960);
double r1179962 = r1179958 / r1179961;
double r1179963 = rand;
double r1179964 = r1179962 * r1179963;
double r1179965 = r1179958 + r1179964;
return r1179965;
}



Bits error versus a



Bits error versus rand
Initial program 0.2
rmApplied distribute-lft-in0.2
rmApplied sub-neg0.2
Applied distribute-lft-in0.2
rmApplied associate-*r*0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019154 +o rules:numerics
(FPCore (a rand)
:name "Octave 3.8, oct_fill_randg"
(*.p16 (-.p16 a (/.p16 (real->posit16 1.0) (real->posit16 3.0))) (+.p16 (real->posit16 1) (*.p16 (/.p16 (real->posit16 1) (sqrt.p16 (*.p16 (real->posit16 9) (-.p16 a (/.p16 (real->posit16 1.0) (real->posit16 3.0)))))) rand))))