libc6 uses long double for math constants
This one may bite many others:
The file /usr/include/math.h defines a few math contants like
M_PI, M_E or M_LN2 to name a few.
The problem is, in libc5 those were defined as floats:
"...
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
..."
but in libc6, if using GCC (or any standard C compiler), those are defined
as long double floats:
"...
#ifdef __USE_BSD
...
#define M_PI _Mldbl(3.14159265358979323846) /* pi */
...
/* Our constants might specify more precision than `double' can represent.
Use `long double' constants in standard and GNU C, where they are
supported and the cast to `double'. */
#if __STDC__ - 0 || __GNUC__ - 0
#define _Mldbl(x) x##L
#else /* Traditional C. */
#define _Mldbl(x) x
#endif /* Standard or GNU C. */
#endif
..."
So, if you do some calculations in your function calls, like:
#include <math.h>
#include <stdio.h>
#define RADtoDEG(a) ((a) * 180.0 / M_PI)
void main(){
double a;
a=3.14159265;
printf ("%g rad = %g deg\n",a,RADtoDEG(a));
/* Look mama, no casting ----^^^^^^^^^^^ */
}
your programs, that were working fine compiled with libc5, will go
berserk as soon as you recompile them with libc6.
--
Enrique Zanardi ezanardi@noah.dfis.ull.es
Dpto. Fisica Fundamental y Experimental
Univ. de La Laguna
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: