On Sun, 29 Jun 2003 01:47:42 +0100, Mark McIntyre
<> wrote:
>On Fri, 27 Jun 2003 17:44:05 GMT, in comp.lang.c , "Carsten Hansen"
><> wrote:
>
>>
>>"Dan Pop" <> wrote in message
>>> As the man page goes on to say, this is a non-issue for most programs,
>>> but there are rare cases when the exact semantics of f.p. arithmetic,
>>> as defined by the standard, are desired.
>>>
>>
>>If you don't specify it, what part of the C standard is it violating. Do you
>>have an example?
>
>Yes, I'd be interested too. AFAIR the standard defines minimum
>precisions for types, not maximum.
>
>(And please, lets have a refefence, not ad hominem attacks. )
>
>--
>Mark McIntyre
Some relevant sections in the standard are here (from N869).
5.1.2.3 Program execution
....
[#13] EXAMPLE 4 Implementations employing wide registers have
to take care to honor appropriate semantics. Values are
independent of whether they are represented in a register
or in memory. For example, an implicit spilling of a register
is not permitted to alter the value. Also, an explicit store
and load is required to round to the precision of the
storage type. In particular, casts and assignments are
required to perform their specified conversion. For the
fragment
double d1, d2;
float f;
d1 = f = expression;
d2 = (float) expressions;
the values assigned to d1 and d2 are required to have been
converted to float.
6.3.1.5 Real floating types
[#2] When a double is demoted to float or a long double to
double or float, if the value being converted is outside the
range of values that can be represented, the behavior is
undefined. If the value being converted is in the range of
values that can be represented but cannot be represented
exactly, the result is either the nearest higher or nearest
lower value, chosen in an implementation-defined manner.
and footnote 77 in N869 (which is footnote 86 in the Standard).
77)If the value of the expression is represented with
greater precision or range than required by the type
named by the cast (6.3.1.

, then the cast specifies a
conversion even if the type of the expression is the same
as the named type.
There were a few threads in comp.std.c on this topic last year.
Clive Feather pointed out the above in the thread 'Floating-point
semantics in C' on 4/16/2002.
Regards,
Bruce Wheeler