From: Stephen Pisuk <smp@ll.mit.edu>
To: gcc-help@gcc.gnu.org
Subject: Float to Int Conversions
Date: Tue, 26 Feb 2002 08:14:00 -0000 [thread overview]
Message-ID: <Pine.GSO.4.44.0202261108080.20318-100000@lager> (raw)
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
next reply other threads:[~2002-02-26 16:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-26 8:14 Stephen Pisuk [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.44.0202261108080.20318-100000@lager \
--to=smp@ll.mit.edu \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).