From owner-freebsd-current Thu Oct 31 14:19:53 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBB7E37B401 for ; Thu, 31 Oct 2002 14:19:51 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 28B9443E4A for ; Thu, 31 Oct 2002 14:19:51 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id g9VMJnpk055909; Thu, 31 Oct 2002 15:19:49 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 31 Oct 2002 15:18:47 -0700 (MST) Message-Id: <20021031.151847.03097281.imp@bsdimp.com> To: tlambert2@mindspring.com Cc: bde@zeta.org.au, rittle@labs.mot.com, rittle@latour.rsch.comm.mot.com, current@FreeBSD.ORG, dschultz@uclink.Berkeley.EDU Subject: Re: Lack of real long double support From: "M. Warner Losh" In-Reply-To: <3DC17FC5.AF56552E@mindspring.com> References: <3DC0E0A7.290A57CA@mindspring.com> <20021031.013338.106483974.imp@bsdimp.com> <3DC17FC5.AF56552E@mindspring.com> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message: <3DC17FC5.AF56552E@mindspring.com> Terry Lambert writes: : "M. Warner Losh" wrote: : > : I await an explanation of how you can fit 2*DBL_MAX into a double, : > : which has a range of DBL_MIN..DBL_MAX. : > : > Look at the code. : > : > long double a = DBL_MAX; : > long double b = DBL_MAX * 2; : > : > The original posting said that b would be +Inf at this point, which is : > not correct. I think that Bruce was confused there. The more correct : > example to look at was the one that rittle@ posted which was 1 + : > LDBL_EPSILON. : : I guess I must not be understanding. What will b be, at this point, : then? How can it have a value larger than DBL_MAX that's not +Inf? : : If it's possible to represent a value larger than DBL_MAX in a double, : then the value of DBL_MAX is wrong, right? Maximum means maximum, : doesn't it? *LONG*DOUBLE* is not *DOUBLE*. long double has extended precision and a range compared to double. That's how. : > : I think that a number that's a 64 bit mantissa reaised to an exponent : > : N takes a larger N if you have only 53 bits of mantissa, if you want : > : to represent the same value. : > : > Nope. The only difference between 53 bits and 64 bits of precision is : > just that: precision. The number of bits for expoentent is : > independent of this. : : .125 ^ 2 = 0.015625 : .25 ^ 3 = 0.015625 : : So if I go from 3 digits of precision to 2 digits of precision for : my mantissa, in order to represent the same number, I need a larger : exponent. That's not how it works. The exponent is more like .1250000 * 2^3 vs .1249999 * 2^3 Both have exponent 3, but the differ by a bit or two in the mantissa. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message