* gcc321 and doubles and c++
@ 2003-02-19 6:38 Chris Croswhite
2003-02-19 13:05 ` John Love-Jensen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chris Croswhite @ 2003-02-19 6:38 UTC (permalink / raw)
To: gcc-help
How are doubles represented in memory under c++? The reason I ask, is that
I need to get the value of a double striped of the mantissa and then split
into two 32 bit words inorder to perform bitwise operations on the
individual parts (as bitwise operations only work up to long ints). BTW, I
am tweaking for better math performance.
TIA,
Chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcc321 and doubles and c++
2003-02-19 6:38 gcc321 and doubles and c++ Chris Croswhite
@ 2003-02-19 13:05 ` John Love-Jensen
2003-02-19 13:36 ` Nathan Sidwell
2003-02-20 18:22 ` Zane Dodson
2 siblings, 0 replies; 4+ messages in thread
From: John Love-Jensen @ 2003-02-19 13:05 UTC (permalink / raw)
To: ccroswhite, gcc-help
Hi Chris,
The representation of a double varies from platform to platform. There is
no canonical (platform agnostic) format.
Some platforms (perhaps yours) represents doubles in IEEE 754 format. Which
can be affected by your platform's endian.
qv: http://grouper.ieee.org/groups/754/
qv: http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
Sincerely,
--Eljay
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcc321 and doubles and c++
2003-02-19 6:38 gcc321 and doubles and c++ Chris Croswhite
2003-02-19 13:05 ` John Love-Jensen
@ 2003-02-19 13:36 ` Nathan Sidwell
2003-02-20 18:22 ` Zane Dodson
2 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2003-02-19 13:36 UTC (permalink / raw)
To: ccroswhite; +Cc: gcc-help
Chris Croswhite wrote:
> How are doubles represented in memory under c++? The reason I ask, is that
> I need to get the value of a double striped of the mantissa and then split
> into two 32 bit words inorder to perform bitwise operations on the
> individual parts (as bitwise operations only work up to long ints). BTW, I
> am tweaking for better math performance.
It uses the underlying hardware representation.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcc321 and doubles and c++
2003-02-19 6:38 gcc321 and doubles and c++ Chris Croswhite
2003-02-19 13:05 ` John Love-Jensen
2003-02-19 13:36 ` Nathan Sidwell
@ 2003-02-20 18:22 ` Zane Dodson
2 siblings, 0 replies; 4+ messages in thread
From: Zane Dodson @ 2003-02-20 18:22 UTC (permalink / raw)
To: gcc-help
On Tue, Feb 18, 2003 at 10:35:13PM -0800, Chris Croswhite wrote:
| How are doubles represented in memory under c++? The reason I ask, is that
| I need to get the value of a double striped of the mantissa and then split
| into two 32 bit words inorder to perform bitwise operations on the
| individual parts (as bitwise operations only
frexp(3) and modf(3) may do part of what you need portably.
As has already been indicated in other replies, any bit manipulations
will require that you determine the byte ordering and alignment for your
platform. If you choose to use GNU Autoconf for your application, there
are already some builtin tests for these platform-specific issues.
Best regards,
--
Zane Dodson
zdodson@zdodson.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-02-20 18:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 6:38 gcc321 and doubles and c++ Chris Croswhite
2003-02-19 13:05 ` John Love-Jensen
2003-02-19 13:36 ` Nathan Sidwell
2003-02-20 18:22 ` Zane Dodson
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).