public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Float to Int Conversions
@ 2002-02-26  8:14 Stephen Pisuk
  2002-02-26  8:38 ` John Love-Jensen
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Pisuk @ 2002-02-26  8:14 UTC (permalink / raw)
  To: gcc-help

Hello,

I have a question regarding the conversion of floats
to integers. The problem is that GCC (version 2.95
3.0.2)  produce different results than Microsoft's Visual Studio
6.0.  First of all, its a matter of who is right, and then
second can they be made consistent.


For example
double x = pow(2,32) + 10;
unsigned int    y = ((unsigned int) x);

Under MS VS y = 10
however under linux with GCC y=2^31 or 0x80000000

I assume the difference is in how the FPU control
word is set with the various error masks.

Is there any way so alter the functionality of GCC
to produce the first result?

Any help would be greatly appreciated. We write code
under both platforms, and its less of an issue of who
is right or wrong, but rather consistency.

Thanks
__________________________________________________
Stephen Pisuk
MIT Lincoln Laboratory, Room C-472
244 Wood St., Lexington, MA   02420-9108
voice: (781)-981-3682   fax: (781)-981-4583
e-mail:   smp@ll.mit.edu


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-02-26 17:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-26  8:14 Float to Int Conversions Stephen Pisuk
2002-02-26  8:38 ` John Love-Jensen
2002-02-26  8:42   ` Stephen Pisuk
2002-02-26 11:11     ` John Love-Jensen
2002-02-26  9:35   ` building on MacOS 10.1.3? sbloch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).