Date: Sat, 6 Apr 2002 14:52:38 +0200 (MET DST) From: Kevin Santugini <Kevin.Santugini@dptmaths.ens-cachan.fr> To: freebsd-questions@FreeBSD.ORG Subject: double having the same precision as long double (C questions) Message-ID: <Pine.SOL.4.40.0204051624080.14469-100000@piano.dptmaths.ens-cachan.fr>
next in thread | raw e-mail | index | archive | help
but not the same size.. Hello, I'm not sure if it should be posted on freebsd-questions or in bugs or to gcc-mailing lists. But I have heard that the limits.h and float.h headers are supplied by the system and not by the compiler. I'm running Freebsd 4.5 Release and I use the gcc supplied with the base system (gcc 2.95.3). We have: sizeof(double)=8 sizeof(long double)=12 So a long double use 4 more bytes than a double to store its data. However <float.h> states that double and long double have the same properties (epsilon, min, max, digits in mantisse and digits in double). A small test program show that the header is right about the precision and the properties of double and long double. And pointer's arithmetic show that sizeof is right too. So a long double uses four more bytes than a double for no extra precision. This seems a little odd to mee. Why use four more bytes if we don't achieve better precision? Kevin Santugini PS:I have also noted that the C++ header <limits> defining the template numeric_limits doesn't exist either. However, it is easy to build one from the C headers.. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.40.0204051624080.14469-100000>