Decimal floating point on x86 and ARM?

By: dmcq (dmcq.delete@this.fano.co.uk), December 20, 2020 12:06 pm
Room: Moderated Discussions
Linus Torvalds (torvalds.delete@this.linux-foundation.org) on December 20, 2020 10:39 am wrote:
> Konrad Schwarz (no.spam.delete@this.no.spam) on December 20, 2020 8:47 am wrote:
> >
> > The x87 supports a decimal floating point format
>
> That's not really true.
>
> There is support for "packed BCD" load and store instructions, but they aren't
> actually floating point. They are integer values. They just get converted
> to/from the 80-bit extended FPU register format at load/store time.
>
> So there's no decimal floating point format internally. It's purely a "load an
> integer value in an odd BCD format into the 64-bit mantissa of a FP register".
>
> So it's more like a very odd in-memory integer format that can then be loaded into the FP registers. Once
> they are in the FP registers, they are regular (extended 80-bit) binary FP values - any operations you
> do on them will be the regular binary FP, there is no support for doing actual decimal operations.
>
> So you'll get all the usual binary rounding etc results if you do any actual math on these values.
>
> I have no idea if anybody ever used those instructions. They are slow iirc, and very
> seldom do anything you want to do. You could use them to do conversions to and from
> ASCII (or, obviously, BCD) decimal integer representations to binary, but I can't imagine
> that it would be faster than just doing it manually on the integer side.
>
> Linus

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.
< 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? 🍊