Should rand() return a RAND_MAX value for 32 bit target?
Xi Ruoyao
xry111@mengyan1223.wang
Tue Sep 18 13:17:00 GMT 2018
On 2018-09-18 21:09 +0800, Xi Ruoyao wrote:
> > Tried them on the latest source and observed that the RAND_MAX is generated
> > when
> > the optimization is not enabled. When optimization is enabled for 32 bit
> > target RAND_MAX
> > is not being generated. However, 64 bit generates RAND_MAX with or without
> > optimization.
And I must say, in your program RAND_MAX is NOT generated with Glibc 2.26 on
Linux. You seen "True" because of floating point rounding error.
> See https://gcc.gnu.org/wiki/FAQ#PR323.
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
More information about the Gcc-help
mailing list