Re: [HACKERS] random_fract and aix compiler bug - Mailing list pgsql-patches

From Tom Lane
Subject Re: [HACKERS] random_fract and aix compiler bug
Date
Msg-id 24808.1066411060@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] random_fract and aix compiler bug  ("Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>)
Responses Re: [HACKERS] random_fract and aix compiler bug  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-patches
"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:

!     } while (!(z > 0 && z < MAX_RANDOM_VALUE));

!     } while (z == 0 || z == MAX_RANDOM_VALUE);

This seems fairly ugly, since it eliminates the original coding's
positive guarantee that the final result is in 0 < x < 1.  Does your
compiler manage not to choke if we add a cast instead?

    } while (!(z > 0 && z < (long) MAX_RANDOM_VALUE));

            regards, tom lane

pgsql-patches by date:

Previous
From: "Zeugswetter Andreas SB SD"
Date:
Subject: [HACKERS] random_fract and aix compiler bug
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] random_fract and aix compiler bug