\left(a - \frac{1}{3}\right) \cdot \left(1 + \frac{1}{\sqrt{9 \cdot \left(a - \frac{1}{3}\right)}} \cdot rand\right)-0.3333333333333333 + \left(a + \frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}} \cdot \left(\frac{rand}{\sqrt[3]{3}} \cdot \sqrt{-0.3333333333333333 + a}\right)\right)(FPCore (a rand) :precision binary64 (* (- a (/ 1.0 3.0)) (+ 1.0 (* (/ 1.0 (sqrt (* 9.0 (- a (/ 1.0 3.0))))) rand))))
(FPCore (a rand)
:precision binary64
(+
-0.3333333333333333
(+
a
(*
(/ 1.0 (* (cbrt 3.0) (cbrt 3.0)))
(* (/ rand (cbrt 3.0)) (sqrt (+ -0.3333333333333333 a)))))))double code(double a, double rand) {
return (a - (1.0 / 3.0)) * (1.0 + ((1.0 / sqrt(9.0 * (a - (1.0 / 3.0)))) * rand));
}
double code(double a, double rand) {
return -0.3333333333333333 + (a + ((1.0 / (cbrt(3.0) * cbrt(3.0))) * ((rand / cbrt(3.0)) * sqrt(-0.3333333333333333 + a))));
}



Bits error versus a



Bits error versus rand
Results
Initial program 0.1
Simplified0.1
rmApplied add-sqr-sqrt_binary640.1
Applied associate-*r*_binary640.1
Simplified0.1
rmApplied sqrt-prod_binary640.2
Simplified0.2
Simplified0.2
Taylor expanded around 0 0.3
Simplified0.1
rmApplied add-cube-cbrt_binary640.1
Applied *-un-lft-identity_binary640.1
Applied times-frac_binary640.1
Applied associate-*l*_binary640.2
Final simplification0.2
herbie shell --seed 2021118
(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))))