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.

If I ask for the value of sin(12345678*PI ) I can confidently

assert that the value is 0. Using that value will never cause an

unexplained fault. The following illustrates the problem:

[1] c:\c\junk>a

1 3.1415926535897 931 0.0000000000000 001

2 6.2831853071795 862 -0.0000000000000 002

4 12.566370614359 1725 -0.0000000000000 005

8 25.132741228718 3449 -0.0000000000000 010

16 50.265482457436 6899 -0.0000000000000 020

32 100.53096491487 33797 -0.0000000000000 039

64 201.06192982974 67594 -0.0000000000000 078

128 402.12385965949 35188 -0.0000000000000 157

256 804.24771931898 70377 -0.0000000000000 313

512 1608.4954386379 740754 -0.0000000000000 627

1024 3216.9908772759 481508 -0.0000000000001 254

2048 6433.9817545518 963016 -0.0000000000002 508

4096 12867.963509103 7926031 -0.0000000000005 016

8192 25735.927018207 5852063 -0.0000000000010 032

16384 51471.854036415 1704125 -0.0000000000020 064

32768 102943.70807283 03408250 -0.0000000000040 128

65536 205887.41614566 06816500 -0.0000000000080 256

131072 411774.83229132 13633001 -0.0000000000160 512

262144 823549.66458264 27266002 -0.0000000000321 023

524288 1647099.3291652 854532003 -0.0000000000642 046

1048576 3294198.6583305 709064007 -0.0000000001284 093

2097152 6588397.3166611 418128014 -0.0000000002568 186

4194304 13176794.633322 2836256027 -0.0000000005136 371

8388608 26353589.266644 5672512054 -0.0000000010272 743

16777216 52707178.533289 1345024109 -0.0000000020545 485

33554432 105414357.06657 82690048218 -0.0000000041090 971

67108864 210828714.13315 65380096436 -0.0000000082181 941

134217728 421657428.26631 30760192871 -0.0000000164363 883

268435456 843314856.53262 61520385742 -0.0000000328727 765

536870912 1686629713.0652 523040771484 -0.0000000657455 530

1073741824 3373259426.1305 046081542969 -0.0000001314911 060

[1] c:\c\junk>cat sines.c

#include <stdio.h>

#include <limits.h>

#include <math.h>

int main(void)

{

double PI = 4.0 * atan(1.0);

unsigned int i;

for (i = 1; i < INT_MAX; i += i) {

printf("%11d %28.16f %20.16f\n", i, PI * i, sin(PI * i));

}

return 0;

}

--

Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)

Available for consulting/temporary embedded and systems.

<http://cbfalconer.home .att.net> USE worldnet address!