Decimal floating point on x86 and ARM?

By: dmcq (dmcq.delete@this.fano.co.uk), December 21, 2020 7:59 am
Room: Moderated Discussions
Brendan (btrotter.delete@this.gmail.com) on December 21, 2020 4:49 am wrote:
> Konrad Schwarz (no.spam.delete@this.no.spam) on December 21, 2020 2:31 am wrote:
> > dmcq (dmcq.delete@this.fano.co.uk) on December 20, 2020 11:06 am wrote:
> > > The x87 instructions that weren't frequently used were terrible. I had a look once at the FSCALE
> > > instruction as a way of fixing the Java double rounding problem and it was just horrible. why
> > > on earth should binary scaling of a floating point number be twenty times as slow as a multiply?
> > > Well yes of course I know why. It just wasn't an important enough operation.
> >
> > My understanding of the Java floating-point problematic on x87 was that if the JIT spilled
> > registers, precision was lost because they spilled double and not extended (80-bit) format.
> > Numerical results then depended on the compiler's optimization. But couldn't this have
> > been avoided if spilling/context switches etc. all used the extended format?
> >
> > Calculation in extended precision seems a surefire & simple way to avoid
> > numerical problems, why was it abandoned? Was this because of Java?
>
> My understanding is:
>
> a) x87 FPU has a "rounding control" field (bits 10 to 11 of FPU Control Word) that can be set to "round
> all values in registers to 64-bit double precision and do not use 80-bit extended double precision".
>
> b) Compilers for languages like C and C++ tend to like giving people the ability to use extended double, and
> changing the FPU Control Word is "somewhat expensive", so C and C++ compilers tend to leave the FPU configured
> as "use 80-bit precision", and end up have problems with unintended additional precision as a consequence.
>
> c) People writing JVMs tend to write them in language like C and C++ without bothering to read CPU
> manuals and without realizing that the FPU Control Word has been configured in an "inappropriate
> for Java" way (rather than re-configuring FPU as "round all values in registers to 64-bit double
> precious" to better suit Java that doesn't provide any support for extended double in the first place);
> and end up having problems with unintended additional precision for no reason whatsoever.

Java was defind to use IEEE double and a major aim was to give the same result on all machines, it was supposd to be used on set top boxes and mobile phones for instance so x87 extended precision was out.

The x87 flag to set it to work in double precision solved a lot of problems but unfortunately there was an oversight on the part of Intel. This limited the mantissa fine - but the exponent still had the extended precision range. Therefore the value could still have a full mantissa rather than being denormalised or go to infinity or zero. The amittedly rare case of still having a full mantissa gave rise to the double rounding. The problem went away with SSE thankfully.

< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Decimal floating point on x86 and ARM?anon2020/12/18 09:29 AM
  Decimal floating point on x86 and ARM?Per Hesselgren2020/12/18 10:16 AM
    Decimal floating point on x86 and ARM?anon2020/12/18 12:23 PM
      Decimal floating point on x86 and ARM?dmcq2020/12/18 06:18 PM
  Decimal floating point on x86 and ARM?rwessel2020/12/18 07:57 PM
    Decimal floating point on x86 and ARM?dmcq2020/12/19 04:41 AM
      Decimal floating point on x86 and ARM?rwessel2020/12/19 08:54 AM
        Decimal floating point on x86 and ARM?Michael S2020/12/19 10:48 AM
          Decimal floating point on x86 and ARM?rwessel2020/12/20 09:25 AM
            Decimal floating point on x86 and ARM?blaine2020/12/20 11:52 AM
              Decimal floating point on x86 and ARM?rwessel2020/12/20 01:44 PM
                Decimal floating point on x86 and ARM?blaine2020/12/20 05:29 PM
              Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/21 04:17 AM
            Decimal floating point on x86 and ARM?Adrian2020/12/21 10:05 AM
  Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/20 09:47 AM
    Decimal floating point on x86 and ARM?rwessel2020/12/20 11:28 AM
    Decimal floating point on x86 and ARM?Linus Torvalds2020/12/20 11:39 AM
      Decimal floating point on x86 and ARM?dmcq2020/12/20 12:06 PM
        Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/21 03:31 AM
          Decimal floating point on x86 and ARM?Brendan2020/12/21 05:49 AM
            Decimal floating point on x86 and ARM?dmcq2020/12/21 07:59 AM
      Decimal floating point on x86 and ARM?Adrian2020/12/21 09:51 AM
        Decimal floating point on x86 and ARM?Linus Torvalds2020/12/21 12:12 PM
          Decimal floating point on x86 and ARM?Adrian2020/12/21 01:29 PM
          Decimal floating point on x86 and ARM?dmcq2020/12/21 04:13 PM
      Decimal floating point on x86 and ARM?David Hess2020/12/21 07:15 PM
        Decimal floating point on x86 and ARM?Konrad Schwarz2020/12/22 01:04 AM
          Decimal floating point on x86 and ARM?David Hess2020/12/22 01:05 PM
    Decimal floating point on x86 and ARM?blaine2020/12/20 12:40 PM
      Decimal floating point on x86 and ARM?Per Hesselgren2020/12/21 04:33 AM
        Decimal floating point on x86 and ARM?rwessel2020/12/21 06:17 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell tangerine? 🍊