CBFalconer wrote:
: Second the following shows the correct result: : #include <stdio.h> : #include <math.h> : : int main( void ) : { : long double R; : R = sin( 1.2345); : printf( "sizeof( long double) = %d\n", sizeof( long double)); : printf( "sin( 1.2345) = %.30f = %.30f\n", (double)R, (double)R); : return 0; : }
This program is correct. However `sin' returns a `double' (this
No it isn't. sizeof returns a size_t, which is not necessarily anything like an int, and is unsigned. The result should be cast to an unsigned long (in C90) and so treated in the format specification. I believe C99 has a %zu specifier available for size_t items. Similarly %td is available for ptrdiff_t items, which are signed, and which has no bearing on the above code.
You're right, I missed this one. (At least the statement with the doubles is right. ;-) Frank -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8