double code(double a, double rand) {
return ((double) (((double) (a - ((double) (1.0 / 3.0)))) * ((double) (1.0 + ((double) (((double) (1.0 / ((double) sqrt(((double) (9.0 * ((double) (a - ((double) (1.0 / 3.0)))))))))) * rand))))));
}
double code(double a, double rand) {
return ((double) (1.0 * ((double) (((double) (a - ((double) (1.0 / 3.0)))) + ((double) (((double) sqrt(((double) (a - ((double) (1.0 / 3.0)))))) * ((double) (rand / ((double) sqrt(9.0))))))))));
}



Bits error versus a



Bits error versus rand
Results
Initial program 0.1
Simplified0.1
rmApplied distribute-lft-in0.1
Simplified0.1
rmApplied sqrt-prod0.1
Applied *-un-lft-identity0.1
Applied times-frac0.1
Applied associate-*r*0.1
Simplified0.1
rmApplied *-un-lft-identity0.1
Applied sqrt-prod0.1
Applied *-un-lft-identity0.1
Applied times-frac0.1
Applied associate-*r*0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2020191
(FPCore (a rand)
:name "Octave 3.8, oct_fill_randg"
:precision binary64
(* (- a (/ 1.0 3.0)) (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 (- a (/ 1.0 3.0))))) rand))))