From owner-freebsd-questions Sat Apr 6 4:52:56 2002 Delivered-To: freebsd-questions@freebsd.org Received: from ariane.ens-cachan.fr (ariane.ens-cachan.fr [138.231.176.4]) by hub.freebsd.org (Postfix) with ESMTP id 93B1337B41D for ; Sat, 6 Apr 2002 04:52:49 -0800 (PST) Received: from piano.dptmaths.ens-cachan.fr (piano.dptmaths.ens-cachan.fr [138.231.32.2]) by ariane.ens-cachan.fr (8.12.0.Beta19/jtpda-5.3.3) with ESMTP id g36CqgSA003047 for ; Sat, 6 Apr 2002 14:52:43 +0200 Received: from piano.dptmaths.ens-cachan.fr (piano.dptmaths.ens-cachan.fr [138.231.32.2]) by piano.dptmaths.ens-cachan.fr (8.9.1a/jtpda-5.3.2) with ESMTP id OAA18315 for ; Sat, 6 Apr 2002 14:52:38 +0200 (MET DST) Date: Sat, 6 Apr 2002 14:52:38 +0200 (MET DST) From: Kevin Santugini To: freebsd-questions@FreeBSD.ORG Subject: double having the same precision as long double (C questions) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 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