Re: Sine code for ANSI C
In <slrnca75nr.5gr .sam@ID-227112.user.uni-berlin.de> Sam Dennis <sam@malfunctio n.screaming.net > writes:
[color=blue]
>P.J. Plauger wrote:[color=green]
>> [Trigonometry on angles that make ordinary libraries dizzy and such]
>> Until the C Standard lets us off the hook beyond some given argument
>> magnitude, however, we have no excuse not to try.[/color]
>
>I think that the Standard lets implementors off the hook at any and all
>magnitudes, signs and, generally, values, actually, and not even _just_
>for the library... from the outset! C99, 5.2.4.2.2p4:
>
>`The accuracy of the floating-point operations (+, -, *, /) and of the
>library functions in <math.h> and <complex.h> that return floating-point
>results is implementation-defined. The implementation may state that
>the accuracy is unknown.'
>
>So if I write my implementation to always produce 42. for an expression
>involving floating-point mathematics (except in the very few situations
>where there are absolute requirements imposed) and document this, it is
>not disqualified from full conforming hosted implementation status (not
>through another (?) loophole).[/color]
True and irrelevant, as we're discussing about what a high quality
implementation should do.
If you're looking for loopholes in the C standard, it contains one so
large as to make even a *completely* useless implementation (a two line
shell script) fully conforming.
1 The implementation shall be able to translate and execute at
^^
least one program that contains at least one instance of every
^^^^^^^^^^^^^^^ ^^
one of the following limits:
Other, strictly conforming programs, must be merely accepted (whatever
that means, the standard provides no further clues).
So consider the following "implementation " for Unix systems:
echo "Program accepted."
cp /bin/true a.out
combined with an implementation of /bin/true that exercises all the
translation limits enumerated in 5.2.4.1 and the documentation required
by the standard.
Now, every translation unit, either correct or not, will receive the one
diagnostic required by the standard, all strictly conforming programs are
"accepted" (as well as all other programs ;-) and the *one* C program
mentioned above is translated and executed.
The real question is: how many users is my implementation going to have?
Answer: as many as yours ;-) This illustrates the importance of a factor
that is not even mentioned in the C standard: the quality of
implementation.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
In <slrnca75nr.5gr .sam@ID-227112.user.uni-berlin.de> Sam Dennis <sam@malfunctio n.screaming.net > writes:
[color=blue]
>P.J. Plauger wrote:[color=green]
>> [Trigonometry on angles that make ordinary libraries dizzy and such]
>> Until the C Standard lets us off the hook beyond some given argument
>> magnitude, however, we have no excuse not to try.[/color]
>
>I think that the Standard lets implementors off the hook at any and all
>magnitudes, signs and, generally, values, actually, and not even _just_
>for the library... from the outset! C99, 5.2.4.2.2p4:
>
>`The accuracy of the floating-point operations (+, -, *, /) and of the
>library functions in <math.h> and <complex.h> that return floating-point
>results is implementation-defined. The implementation may state that
>the accuracy is unknown.'
>
>So if I write my implementation to always produce 42. for an expression
>involving floating-point mathematics (except in the very few situations
>where there are absolute requirements imposed) and document this, it is
>not disqualified from full conforming hosted implementation status (not
>through another (?) loophole).[/color]
True and irrelevant, as we're discussing about what a high quality
implementation should do.
If you're looking for loopholes in the C standard, it contains one so
large as to make even a *completely* useless implementation (a two line
shell script) fully conforming.
1 The implementation shall be able to translate and execute at
^^
least one program that contains at least one instance of every
^^^^^^^^^^^^^^^ ^^
one of the following limits:
Other, strictly conforming programs, must be merely accepted (whatever
that means, the standard provides no further clues).
So consider the following "implementation " for Unix systems:
echo "Program accepted."
cp /bin/true a.out
combined with an implementation of /bin/true that exercises all the
translation limits enumerated in 5.2.4.1 and the documentation required
by the standard.
Now, every translation unit, either correct or not, will receive the one
diagnostic required by the standard, all strictly conforming programs are
"accepted" (as well as all other programs ;-) and the *one* C program
mentioned above is translated and executed.
The real question is: how many users is my implementation going to have?
Answer: as many as yours ;-) This illustrates the importance of a factor
that is not even mentioned in the C standard: the quality of
implementation.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
Comment