Re: Sine code for ANSI C
"Dan Pop" <Dan.Pop@cern.c h> wrote in message
news:c8fkhr$7u4 $9@sunnews.cern .ch...
[color=blue]
> In <V2tqc.138401$G _.102626@nwrddc 02.gnilink.net> "P.J. Plauger"[/color]
<pjp@dinkumware .com> writes:[color=blue]
>[color=green]
> >"Dan Pop" <Dan.Pop@cern.c h> wrote in message
> >news:c8dd2g$6d g$15@sunnews.ce rn.ch...
> >[color=darkred]
> >> In <40A8F445.DBE0F 395@yahoo.com> CBFalconer <cbfalconer@yah oo.com>[/color][/color][/color]
writes:[color=blue][color=green][color=darkred]
> >>
> >> >Dan Pop wrote:
> >> >>
> >> >... snip ...
> >> >>
> >> >> The point is not whether it can be calculated, but rather how much
> >> >> precision should the calculation produce? Does it makes sense to
> >> >> compute sin(DBL_MAX) with 53-bit precision, ignoring the fact that
> >> >> DBL_MAX stands for an interval so large as to make this function
> >> >> call completely devoid of any meaning?
> >> >
> >> >PJPs point is that that interval is the range of values specified,
> >> >with the actual value being the most likely value in the range.
> >> >The shape of the probability curve in the interval is known only
> >> >to the end user. It may be an impulse function precisely at the
> >> >specified value.
> >>
> >> Or it may not. If I deserve 5 digits of precision, why should the
> >> implementation waste precious CPU resources to give me 16 digits of
> >> *bogus* precision?[/color]
> >
> >Because it doesn't know that it shouldn't? You could supply a useful
> >hint by calling sinf, in this particular case at least.[/color]
>
> sinf is useless in portable C code.[/color]
But wait a minute. You've just outlined a "concrete example" where
you know you deserve only 5 digits of precision. sinf will meet
your needs *portably*. And it won't waste your precious CPU resources
to give you 16 digits of *bogus* precison. How can you call that
useless when you just outlined a concrete use case where it portably
meets your needs exactly?
[color=blue][color=green][color=darkred]
> >> To deserve 16 digits of precision, it is *my* job to call sin() with
> >> an argument of the right magnitude. It's as simple as that.[/color]
> >
> >Simple for you, perhaps, but the interface for sin currently fails
> >to provide any information about how many of the bits you're supplying
> >should be taken seriously.[/color]
>
> ALL of them, as I have already explained you. It's the magnitude of the
> value that decides how many digits of precision I deserve in the result.[/color]
But you've yet to commit to any *concrete* rule for deciding how many
digits you deserve given the magnitude of the argument value. And you
say we're at fault if a library takes more time than it should. We're
looking to you for guidance in this area, particularly since you seem
to have such a clear vision of the right way to do things. Please provide
wording for a correction to the C Standard so we can all critique it and
then adopt it. We're counting on you for leadership.
P.J. Plauger
Dinkumware, Ltd.
							
						
					"Dan Pop" <Dan.Pop@cern.c h> wrote in message
news:c8fkhr$7u4 $9@sunnews.cern .ch...
[color=blue]
> In <V2tqc.138401$G _.102626@nwrddc 02.gnilink.net> "P.J. Plauger"[/color]
<pjp@dinkumware .com> writes:[color=blue]
>[color=green]
> >"Dan Pop" <Dan.Pop@cern.c h> wrote in message
> >news:c8dd2g$6d g$15@sunnews.ce rn.ch...
> >[color=darkred]
> >> In <40A8F445.DBE0F 395@yahoo.com> CBFalconer <cbfalconer@yah oo.com>[/color][/color][/color]
writes:[color=blue][color=green][color=darkred]
> >>
> >> >Dan Pop wrote:
> >> >>
> >> >... snip ...
> >> >>
> >> >> The point is not whether it can be calculated, but rather how much
> >> >> precision should the calculation produce? Does it makes sense to
> >> >> compute sin(DBL_MAX) with 53-bit precision, ignoring the fact that
> >> >> DBL_MAX stands for an interval so large as to make this function
> >> >> call completely devoid of any meaning?
> >> >
> >> >PJPs point is that that interval is the range of values specified,
> >> >with the actual value being the most likely value in the range.
> >> >The shape of the probability curve in the interval is known only
> >> >to the end user. It may be an impulse function precisely at the
> >> >specified value.
> >>
> >> Or it may not. If I deserve 5 digits of precision, why should the
> >> implementation waste precious CPU resources to give me 16 digits of
> >> *bogus* precision?[/color]
> >
> >Because it doesn't know that it shouldn't? You could supply a useful
> >hint by calling sinf, in this particular case at least.[/color]
>
> sinf is useless in portable C code.[/color]
But wait a minute. You've just outlined a "concrete example" where
you know you deserve only 5 digits of precision. sinf will meet
your needs *portably*. And it won't waste your precious CPU resources
to give you 16 digits of *bogus* precison. How can you call that
useless when you just outlined a concrete use case where it portably
meets your needs exactly?
[color=blue][color=green][color=darkred]
> >> To deserve 16 digits of precision, it is *my* job to call sin() with
> >> an argument of the right magnitude. It's as simple as that.[/color]
> >
> >Simple for you, perhaps, but the interface for sin currently fails
> >to provide any information about how many of the bits you're supplying
> >should be taken seriously.[/color]
>
> ALL of them, as I have already explained you. It's the magnitude of the
> value that decides how many digits of precision I deserve in the result.[/color]
But you've yet to commit to any *concrete* rule for deciding how many
digits you deserve given the magnitude of the argument value. And you
say we're at fault if a library takes more time than it should. We're
looking to you for guidance in this area, particularly since you seem
to have such a clear vision of the right way to do things. Please provide
wording for a correction to the C Standard so we can all critique it and
then adopt it. We're counting on you for leadership.
P.J. Plauger
Dinkumware, Ltd.
 
	
Comment