On Mon, Dec 17, 2018 at 10:56:43 +0000, Alex Bennée wrote:
> From: "Emilio G. Cota" <c...@braap.org>
> +static void update_random_ops(int n_ops, enum precision prec)
> +{
> +    int i;
> +
> +    for (i = 0; i < n_ops; i++) {
> +        uint64_t r = random_ops[i];
> +
> +        if (prec == PREC_SINGLE || PREC_FLOAT32) {
> +            do {
> +                r = xorshift64star(r);
> +            } while (!float32_is_normal(r));
> +        } else if (prec == PREC_DOUBLE || PREC_FLOAT64) {

I just noticed that there's a bug here (I was seeing non-normals
where I didn't expect any):

     for (i = 0; i < n_ops; i++) {
         uint64_t r = random_ops[i];
 
-        if (prec == PREC_SINGLE || PREC_FLOAT32) {
+        if (prec == PREC_SINGLE || prec == PREC_FLOAT32) {
             do {
                 r = xorshift64star(r);
             } while (!float32_is_normal(r));
-        } else if (prec == PREC_DOUBLE || PREC_FLOAT64) {
+        } else if (prec == PREC_DOUBLE || prec == PREC_FLOAT64) {
             do {
                 r = xorshift64star(r);
             } while (!float64_is_normal(r));

Let me know if you want me to send a proper patch (this is non-critical
so it's OK to fix after merging) or you'd rather fix it up directly.

Thanks,

                E.

Reply via email to