By: Linus Torvalds (torvalds.delete@this.linux-foundation.org), December 20, 2020 11:39 am
Room: Moderated Discussions
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 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