Date: Thu, 31 Oct 2002 15:18:47 -0700 (MST) From: "M. Warner Losh" <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 Message-ID: <20021031.151847.03097281.imp@bsdimp.com> In-Reply-To: <3DC17FC5.AF56552E@mindspring.com> References: <3DC0E0A7.290A57CA@mindspring.com> <20021031.013338.106483974.imp@bsdimp.com> <3DC17FC5.AF56552E@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <3DC17FC5.AF56552E@mindspring.com> Terry Lambert <tlambert2@mindspring.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021031.151847.03097281.imp>