Re: Should rand() return a RAND_MAX value for 32 bit target?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-09-20 23:21:23 +0800, Liu Hao wrote:
> `2147483647` is an integer constant. This rule only describes floating 
> constants, so it does not apply.

Actually the fact that it is a constant doesn't matter, but...

> According to '6.3.1.8 Usual arithmetic conversions', here `2147483647` 
> is converted to a value having type `float`, which is then compared with 
> `f` using the internal `long double` type.

The conversion of the int needs to be done with the precision and
range of long double since this is neither an assignment nor a cast.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux