B
broli
Is this a part of C 99 or just an addon in some windows compilers like
pellesC ?
pellesC ?
broli said:Is this a part of C 99 or just an addon in some windows compilers like
pellesC ?
Malcolm said:Basically it's a hardware question. Whilst floating point can be emulated in
software, if you have to do this it's unlikely that you need much precision.
If the hardware supports 80 bit floats then the C compiler has to support
them, in practise, or people would complain. I think it is actually part of
C99, for what it's worth, but that standard hasn't received wide acceptance,
so it doesn't really matter whether long double is in it or not.
broli said:Is this a part of C 99 or just an addon in some windows compilers like
pellesC ?
Malcolm said:Basically it's a hardware question.
Whilst floating point can be
emulated in software, if you have to do this it's unlikely that you need
much precision. If the hardware supports 80 bit floats then the C
compiler has to support them, in practise, or people would complain.
I
think it is actually part of C99, for what it's worth, but that standard
hasn't received wide acceptance, so it doesn't really matter whether
long double is in it or not.
jacob navia said:long double is part of C99
Keith said:I don't know where this idea that long double is a C99-specific
feature came from, but it's mistaken.
broli said:Is this a part of C 99 or just an addon in some windows compilers like
pellesC ?
Eric Sosman said:This needs some explanation. There must be at least
LDBL_DIG * lg(10) bit-equivalents in the fractional part
of a long double, and since LDBL_DIG must be at least 10
this implies a fraction of at least 33.2+ bit-equivalents.
There must also be enough distinct exponent values to cover
the range LDBL_MIN_10_EXP through LDBL_MAX_10_EXP, which
must be at least the range -37 through +37; 75 or more
distinct values implies lg(75) = 6.2+ bit-equivalents.
Finally there's the sign, for one more bit-equivalent. All
in all, long double needs at least 40.4+ bit-equivalents.
Since 40.4+ is "at least 32," you're right.
Eric said:This needs some explanation. There must be at least
LDBL_DIG * lg(10) bit-equivalents in the fractional part
of a long double, and since LDBL_DIG must be at least 10
this implies a fraction of at least 33.2+ bit-equivalents.
There must also be enough distinct exponent values to cover
the range LDBL_MIN_10_EXP through LDBL_MAX_10_EXP, which
must be at least the range -37 through +37; 75 or more
distinct values implies lg(75) = 6.2+ bit-equivalents.
Finally there's the sign, for one more bit-equivalent. All
in all, long double needs at least 40.4+ bit-equivalents.
Since 40.4+ is "at least 32," you're right.
Right: the minimum requirements for long double's range
and precision are the same as those for plain double, so the
implementation is not obliged to do any better. It must not
do any worse, though.
Eric said:By writing "bit-equivalent," I was being careful not to
assume base two; in bases other than two (e.g., sixteen as
in IBM S/360), the "hidden bit" coding trick you mention is
rather difficult to employ ...
When I wrote "rather difficult" I was attempting an ironic
understatement, but perhaps the point needs more illustration.
Please assume base ten for familiarity's sake, and explain
how to avoid storing the leading digit of 3.14159E0. The fact
that the leading digit is non-zero is not sufficient for us to
determine what it actually is (as it would be in base two).
True, one could take advantage of the leading digit's non-
nullity by encoding it in the equivalent of lg(9) ~= 3.17 bits
rather than in lg(10) ~= 3.32 bits. One could even attempt a
variable-length encoding, taking advantage of the empirical
observation that the leading digit are usually small. But
super-sophisticated encoding schemes have a way of chewing up
a lot of silicon, and chip designers are already peeved at the
area devoted to the FPU, and there's also the matter of speed ...
jacob navia said:Obviously this association was suggested by the question of the
OP that said:
Is long double part of C99?
Bartc said:<snip> [long double] seems to be at least 32-bits.
This needs some explanation. There must be at least
LDBL_DIG * lg(10) bit-equivalents in the fractional part
of a long double, and since LDBL_DIG must be at least 10
this implies a fraction of at least 33.2+ bit-equivalents.
There must also be enough distinct exponent values to cover
the range LDBL_MIN_10_EXP through LDBL_MAX_10_EXP, which
must be at least the range -37 through +37; 75 or more
distinct values implies lg(75) = 6.2+ bit-equivalents.
Dann Corbit wrote:
... snip ...
And then you have to consider the added physical complexity of
building a flip-flap-flop (in place of a flip-flop), and
implementing tri-level gates, etc.
With +voltage, ground, -voltage the idea is so obvious I would guess
someone has tried it.
> Dann Corbit wrote: ....
>
> And then you have to consider the added physical complexity of
> building a flip-flap-flop (in place of a flip-flop), and
> implementing tri-level gates, etc.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.