Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Joshua Cranmer Newsgroups: comp.lang.java.programmer Subject: Re: higher precision doubles Date: Tue, 09 Aug 2011 10:11:57 -0500 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 9 Aug 2011 15:12:05 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="B3q1fNdvNsCxx/IZ4idKGA"; logging-data="31117"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TnliWFHGHGDv0bnDyyxvTsVdJf4950k8=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 In-Reply-To: Cancel-Lock: sha1:4tLrRJqnOoFZgHElKh9jXXMPB0E= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6914 On 8/8/2011 11:42 PM, supercalifragilisticexpialadiamaticonormalizeringelimatisticantations wrote: > How does that interact with JIT, though? On x86, the simplest way for > JIT to make non-strictfp code use the FPU would be to just load the > initial values into the (80-bit-wide!) registers and perform FADDs, > FMULs, etc. on them. As long as the computation stayed in registers the > higher precision then ought to remain in effect -- for JITted code. > Adding extra code to mask off 16 of the register bits (or the mantissa > subset of the extra bits) after every FP op would slow things down. Is > the JLS interpreted to require the JIT do this (for non-strictfp code)? > And, if not, what does the HotSpot JIT do in actuality? All modern x86 processors sport the SSE-style instructions, which can do 32-bit and 64-bit instructions (also in a SIMD format) without touching the FPU, and I suspect that these are slightly faster than using the x87 FPU instructions. I wouldn't be surprised if the JIT emitted SSE in the vast majority of cases, so that JIT'd non-strictfp code would end up returning the same results as JIT'd strictfp code. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth