* Disadvantage of using long long int
@ 2006-02-22 17:35 Reuben D. Budiardja
2006-02-22 17:46 ` Glynn Clements
2006-02-22 17:54 ` Steve Graegert
0 siblings, 2 replies; 5+ messages in thread
From: Reuben D. Budiardja @ 2006-02-22 17:35 UTC (permalink / raw)
To: linux-c-programming
Hello,
In terms of performance and raw speed, is there any disadvantage of using
"long long int" instead of "long int", "long double" instead of "double" on
32-bit machine ? Are there any other disadvantage that I should consider?
Thank you.
RDB
--
Reuben D. Budiardja
Dept. Physics and Astronomy
University of Tennessee, Knoxville, TN
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Disadvantage of using long long int
2006-02-22 17:35 Disadvantage of using long long int Reuben D. Budiardja
@ 2006-02-22 17:46 ` Glynn Clements
2006-02-22 17:54 ` Steve Graegert
1 sibling, 0 replies; 5+ messages in thread
From: Glynn Clements @ 2006-02-22 17:46 UTC (permalink / raw)
To: Reuben D. Budiardja; +Cc: linux-c-programming
Reuben D. Budiardja wrote:
> In terms of performance and raw speed, is there any disadvantage of using
> "long long int" instead of "long int", "long double" instead of "double" on
> 32-bit machine ?
Yes. The longer version will typically be slower.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Disadvantage of using long long int
2006-02-22 17:35 Disadvantage of using long long int Reuben D. Budiardja
2006-02-22 17:46 ` Glynn Clements
@ 2006-02-22 17:54 ` Steve Graegert
2006-02-22 18:55 ` Glynn Clements
1 sibling, 1 reply; 5+ messages in thread
From: Steve Graegert @ 2006-02-22 17:54 UTC (permalink / raw)
To: linux-c-programming
On 2/22/06, Reuben D. Budiardja <techlist@pathfinder.phys.utk.edu> wrote:
>
> Hello,
> In terms of performance and raw speed, is there any disadvantage of using
> "long long int" instead of "long int", "long double" instead of "double" on
> 32-bit machine ? Are there any other disadvantage that I should consider?
On 32-bit Intel machines a long long int (64 bits) is usually not the
same as a long int (32 bits), the same is true for double (64 bits,
IEEE754) and long double (96 bits, IEEE845). BTW long long int is a
GNU extension and subject to portability. The situation is completely
different for 64-bit systems.
Conclusion: using the larger versions will result in loss of performance.
\Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Disadvantage of using long long int
2006-02-22 17:54 ` Steve Graegert
@ 2006-02-22 18:55 ` Glynn Clements
2006-02-22 19:09 ` Steve Graegert
0 siblings, 1 reply; 5+ messages in thread
From: Glynn Clements @ 2006-02-22 18:55 UTC (permalink / raw)
To: Steve Graegert; +Cc: linux-c-programming
Steve Graegert wrote:
> > In terms of performance and raw speed, is there any disadvantage of using
> > "long long int" instead of "long int", "long double" instead of "double" on
> > 32-bit machine ? Are there any other disadvantage that I should consider?
>
> On 32-bit Intel machines a long long int (64 bits) is usually not the
> same as a long int (32 bits), the same is true for double (64 bits,
> IEEE754) and long double (96 bits, IEEE845).
In C99 (ISO-IEC 9899:1999), long double is supposed to be one of the
two ISO-IEC 60559 extended formats, which are 80 or 128 bits. On x86,
it's usually 80 bits.
> BTW long long int is a GNU extension and subject to portability.
long long int is part of the C99 standard.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Disadvantage of using long long int
2006-02-22 18:55 ` Glynn Clements
@ 2006-02-22 19:09 ` Steve Graegert
0 siblings, 0 replies; 5+ messages in thread
From: Steve Graegert @ 2006-02-22 19:09 UTC (permalink / raw)
To: linux-c-programming
On 2/22/06, Glynn Clements <glynn@gclements.plus.com> wrote:
>
> Steve Graegert wrote:
>
> > > In terms of performance and raw speed, is there any disadvantage of using
> > > "long long int" instead of "long int", "long double" instead of "double" on
> > > 32-bit machine ? Are there any other disadvantage that I should consider?
> >
> > On 32-bit Intel machines a long long int (64 bits) is usually not the
> > same as a long int (32 bits), the same is true for double (64 bits,
> > IEEE754) and long double (96 bits, IEEE845).
>
> In C99 (ISO-IEC 9899:1999), long double is supposed to be one of the
> two ISO-IEC 60559 extended formats, which are 80 or 128 bits. On x86,
> it's usually 80 bits.
x86 ABI defines long double 12 Bytes of size (96 bits) on x86. 80
bits for precision, 12 bits is padding, totalling for 96 bits of size.
It _can_ be put in a 128 bit container to preserve alignment. The
compilers default to 96-bit but gcc has an option to pad out to 128bit
(-m128bit-long-double) resulting in a gain of performance with IA64
but slower speed on x86 due to software emulation.
> > BTW long long int is a GNU extension and subject to portability.
>
> long long int is part of the C99 standard.
Ok, thanks.
\Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-02-22 19:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-22 17:35 Disadvantage of using long long int Reuben D. Budiardja
2006-02-22 17:46 ` Glynn Clements
2006-02-22 17:54 ` Steve Graegert
2006-02-22 18:55 ` Glynn Clements
2006-02-22 19:09 ` Steve Graegert
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 NNTP newsgroup(s).