Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: BGB Newsgroups: comp.lang.java.programmer Subject: Re: higher precision doubles Date: Sat, 06 Aug 2011 12:20:09 -0700 Organization: albasani.net Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net CBAvVT1poDRG0wYKz26QZObuf3EeIZIB5ZidKONgUsTYddFwEWj1U4yohpHN7RS19M448S/i/NjjE/HafVGFAA== NNTP-Posting-Date: Sat, 6 Aug 2011 19:24:54 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="a1vnvgBVnyMsj19oZzN5JZzq0R+WpSw/G8JJmgHxWiC4fgGSGI51zgaMS9XmFY9fyhx/lInhLwGdkMugmQgYX2SU1z6r9uioV0akpWH6MGI8xgthlS9kaClEyRD1CUiE"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: Cancel-Lock: sha1:LEc6Ayc6levwU90F08jAgOCQLTc= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6829 On 8/6/2011 4:03 AM, Jan Burse wrote: > Patricia Shanahan schrieb: >> to do so. Even without strictfp, the mantissa sizes and therefore the >> precision are fixed. >> > I was thinking about double extended, where the precision does > not stay fixed but is increased. > > http://de.wikipedia.org/wiki/IEEE_754#Zahlenformate_und_andere_Festlegungen_des_IEEE-754-Standards > > > Double extended has in minimum 79 bit whereby 63 bit are mantissa > and 15 bit are exponent. > > I was wondering whether I can take advantage of an AMD64. Since > it has 80bit IEEE floating point registers: > > http://people.freebsd.org/~lstewart/references/amd64.pdf > Paragraph 1.2 note: all major x86 chips have 80 bit FPU registers (this is not new). however, no, one can't directly use them from Java AFAIK, but would instead likely need to use JNI calls into C land or similar, even then, it would depend some on the C compiler (many C compilers use an 80-bit "long double" type, whereas MSVC treats "long double" as an alias for "double"). also possible is, of course, to use BigDecimal or similar (as others have noted), or implement ones' own higher-precision floating point numbers in-software (say, implementing 128 bit or more floating-point numbers). or implement a float256 format, with a 31-bit exponent and 224 bit mantissa. yes, granted, implementing larger floating-point values is kind of a pain, and performance would be worse than with any natively-supported formats. or such...