jacob navia said:
Keith said:
Do you discuss the rules imposed by the standard, for example, that
int is at least 16 bits?
Correct. I will add that.
Great.
p54:
"1.13.10 union.
You can store several values in a single memory location or a group
of memory locations with the proviso that they can't be accessed at
the same time of course. This allows you to reduce the memory
requirements of a structure, or to interpret a sequence of bits in a
different fashion.
For a detailed discussion see "Unions" on page 107."
This isn't very clear. It sounds like I can store multiple variables
in a union simultaneously, provided I don't access them
simultaneously.
Well... that's a union dear.
Storing a value in one member of a union, result of accessing a
different member is unspecified except in some very narrow
circumstances. (Consider that when you're wrong about something, and
somebody points it out, that's not a good time to be condescending,
"dear".)
[...]
Why did you quote all that if you're not going to respond to it?
I think that implementations without floating point are disappearing
quite fast. Actually, the only one I used was in a DSP some years ago,
where we did not bother with that since the circuit did not support it
and we had like 40-50K of RAM.
But those are extreme environments.
You've missed the point.
The standard requires floating point; types float, double, and long
double are not optional. (But a non-conforming implementation that
doesn't support floating-point might be quite useful.)
IEEE 754 (more precisely IEC 60559, but most people just think of it
as "IEEE floating-point") is a specification for an implementation of
floating-point numbers. A conforming C implementation can provide
floating-point support in a form other than what IEEE 754 specifies.
Floating-point formats other than IEEE 754 are becoming rarer (that's
the point of having a standard, after all), but I've worked on systems
with a number of other formats (VAX, IBM mainframe, Cray, PDP-11). I
think, but I'm not certain, that it's not uncommon even for modern
implementations to use the IEEE 754 *format* without providing all the
bells and whistles specified by the IEE 754 standard.
A C tutorial certainly needs to discuss floating-point, but it needn't
(and shouldn't) go into the details of IEEE 754. Issues of roundoff
errors, inexact representations, and so forth, apply to any
floating-point format, not just IEEE 754.