Re: C performance
From: Jack Klein (jackklein_at_spamcop.net)
Date: 05/18/04
- Next message: those who know me have no need of my name: "Re: Immediate data"
- Previous message: Tim Prince: "Re: C performance"
- In reply to: Tim Prince: "Re: C performance"
- Next in thread: Tim Prince: "Re: C performance"
- Reply: Tim Prince: "Re: C performance"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 May 2004 00:36:53 -0500
On Tue, 18 May 2004 05:10:46 GMT, "Tim Prince" <tprince@computer.org>
wrote in comp.lang.c:
>
> "Stephen Sprunk" <stephen@sprunk.org> wrote in message
> news:160cd1ac7038464cae4be2010b9ab537@news.teranews.com...
> > "Chris Torek" <nospam@torek.net> wrote in message
> > news:c8ar0u12ddv@news3.newsguy.com...
> > > It its probably worth noting that the hardware architecture with
> > > which most people are familiar -- the Intel IA32 -- is one of
> > > these. All of its calculations use "long double" internally
> > > (assuming, of course, that your C compiler maps "long double"
> > > onto this 80-bit internal format!).
> > >
> > > The IA32 does have a "precision" field in its FPU control word,
> > > but this does not work in quite the same way as actually converting
> > > the final result down to the 32 or 64 bit "memory format" for float
> > > and double. In particular, setting the precision to "float" causes
> > > mantissa rounding, but leaves the exponent range +/- 16383 instead
> > > of +/- 127. In other words, the internal format is as if you had
> > > 39 bits to work with, instead of the "expected" 32. This means
> > > that infinities and NaNs do not occur when one might expect them.
> >
> > These "problems" go away when switching to SSE[12] for FP, right?
> >
> > My understanding is that the SSE unit only has 32-bit floats and 64-bit
> > doubles, and the x87 unit is still used for long doubles (but nothing
> else).
> > This is why I was curious about promotion of floats to doubles and back to
> > floats -- that seems like it would seriously mess up the SSE registers.
> >
> In SSE/SSE2 code, there's no implicit promotion of float to double.
> "Vector" parallel code requires going through memory to cast between float
> and double. In Windows, there's no support for long double wider than
> double. The Windows-64 ABI doesn't even support use of the x87
> instructions, although the influence of Kahan may live on in the linux ABI.
It is quite inaccurate to say that there is no support in Windows for
long double wider than double. Microsoft made a marketing decision to
deprive programmers using their compiler of the full potential of the
x86 coprocessor/FPU. This has the effect of seriously reducing the
accuracy of many types of scientific and engineering programs
developed with their compiler.
On the other hand, GCC, lcc-win32, Borland, and probably others,
support 80 bit long doubles very will in Windows.
-- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
- Next message: those who know me have no need of my name: "Re: Immediate data"
- Previous message: Tim Prince: "Re: C performance"
- In reply to: Tim Prince: "Re: C performance"
- Next in thread: Tim Prince: "Re: C performance"
- Reply: Tim Prince: "Re: C performance"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|