JB>> There's nothing in the C++ Standard to say that it shouldn't (in
JB>> fact there is no no concept of "warnings" in the C++ Standard
JB>> at all), and portability enthusiasts would argue that a good
JB>> quality implementation *should* give such warnings. After all,
JB>> it is not guaranteed that values of integral type can be
JB>> converted to values of floating-point type without loss of
JB>> precision and silent conversion to the next higher or
JB>> lower floating-point value that can represented.
TM> I agree with you but I can't remember having met such a situation.
TM> Have you?
You mean aside from the code that you originally posted, which did indeed
produce such warnings, as Jan Bijsterbosch pointed out ? (-:
Try converting from a 32-bit integer type to a single-precision floating
point type on Intel x86 architectures. See what happens, in terms of loss of
precision, when the integer is greater than 2 to the 24.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|