View Single Post
  #11 (permalink)  
Old 02-13-2012, 01:22 PM
Noob
Guest
 
Posts: n/a
Default Re: C/C++ pitfalls related to 64-bits (unsigned long & double)

Alex Vinokur wrote:

> Hi,
>
> unsigned long a = -1;
> double b = a;
> unsigned long c = b;
>
> Model 32-bits: a == c
> Model 64-bits: a != c
>
>
> It is not a compiler bug for 64-bits.
>
> Is it a design bug of C/C++ languge for 64-bits?


Nicely done. You've hit all the right nails.

Remaining conspicuously vague, conflating C and C++ while cross-posting
to both groups, claiming a defect in the language, conjuring the ever
so misunderstood floating-point format, ...

You would make Kenny so proud!

If you're bored, you could read Goldberg's paper (all of it!)
http://docs.oracle.com/cd/E19957-01/..._goldberg.html
Reply With Quote