Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #167786 > unrolled thread
| Started by | Thiago Adams <thiago.adams@gmail.com> |
|---|---|
| First post | 2022-09-22 07:09 -0700 |
| Last post | 2022-09-29 14:06 -0400 |
| Articles | 10 — 7 participants |
Back to article view | Back to comp.lang.c
C23 _Decimal64 etc Thiago Adams <thiago.adams@gmail.com> - 2022-09-22 07:09 -0700
Re: C23 _Decimal64 etc Bart <bc@freeuk.com> - 2022-09-22 17:23 +0100
Re: C23 _Decimal64 etc Thiago Adams <thiago.adams@gmail.com> - 2022-09-22 10:44 -0700
Re: C23 _Decimal64 etc David Brown <david.brown@hesbynett.no> - 2022-09-22 23:03 +0200
Re: C23 _Decimal64 etc Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-22 11:29 -0700
Re: C23 _Decimal64 etc Richard Damon <Richard@Damon-Family.org> - 2022-09-22 19:10 -0400
Re: C23 _Decimal64 etc Bart <bc@freeuk.com> - 2022-09-23 01:19 +0100
Re: C23 _Decimal64 etc Richard Damon <Richard@Damon-Family.org> - 2022-09-22 23:42 -0400
Re: C23 _Decimal64 etc Michael S <already5chosen@yahoo.com> - 2022-09-23 02:50 -0700
Re: C23 _Decimal64 etc Thomas David Rivers <rivers@dignus.com> - 2022-09-29 14:06 -0400
| From | Thiago Adams <thiago.adams@gmail.com> |
|---|---|
| Date | 2022-09-22 07:09 -0700 |
| Subject | C23 _Decimal64 etc |
| Message-ID | <7724aa36-2772-4736-aedc-1de37b10e35fn@googlegroups.com> |
Decimal floating point types were added into C23. I was wondering.. how it will be implemented by c23 compilers? Is it already supported in x86 / x64 / arm? or it is a kind of emulation?
[toc] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2022-09-22 17:23 +0100 |
| Message-ID | <tgi26i$1f7p$1@gioia.aioe.org> |
| In reply to | #167786 |
On 22/09/2022 15:09, Thiago Adams wrote: > Decimal floating point types were added into C23. > > I was wondering.. how it will be implemented by c23 compilers? > Is it already supported in x86 / x64 / arm? > > or it is a kind of emulation? Probably it will be emulation just like those precise N-bit types. AFAIK x64 doesn't support those 64-bit/128-bit decimal types, and from reading about the format months back, it looks horrendous to do in software. I think, if your translator has to provide emulations, then you have your work cut out. But I believe some of these features will be optional.
[toc] | [prev] | [next] | [standalone]
| From | Thiago Adams <thiago.adams@gmail.com> |
|---|---|
| Date | 2022-09-22 10:44 -0700 |
| Message-ID | <bfac019c-f4b5-4569-b435-82dde76c7fc8n@googlegroups.com> |
| In reply to | #167792 |
On Thursday, September 22, 2022 at 1:24:05 PM UTC-3, Bart wrote: > On 22/09/2022 15:09, Thiago Adams wrote: > > Decimal floating point types were added into C23. > > > > I was wondering.. how it will be implemented by c23 compilers? > > Is it already supported in x86 / x64 / arm? > > > > or it is a kind of emulation? > Probably it will be emulation just like those precise N-bit types. > > AFAIK x64 doesn't support those 64-bit/128-bit decimal types, and from > reading about the format months back, it looks horrendous to do in software. I guess people requiring this..were already using some lib like in c99 https://www.intel.com/content/www/us/en/developer/articles/tool/intel-decimal-floating-point-math-library.html
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2022-09-22 23:03 +0200 |
| Message-ID | <tgiiim$2a6td$1@dont-email.me> |
| In reply to | #167792 |
On 22/09/2022 18:23, Bart wrote: > On 22/09/2022 15:09, Thiago Adams wrote: >> Decimal floating point types were added into C23. >> >> I was wondering.. how it will be implemented by c23 compilers? >> Is it already supported in x86 / x64 / arm? >> >> or it is a kind of emulation? > > Probably it will be emulation just like those precise N-bit types. > The point of the N-bit types is not as a general sized type for use in general coding. They are intended for use in specific hardware which has support for the size. A prime candidate is programmable logic, when bit sizes of 9-bit, 18-bit, 36-bit and 72-bit are very common in DSP accelerator blocks. When coding for such targets, you are going to want specific types that match these sizes. Having such support standardised makes live easier for everyone. (I know very little about the decimal floating point types and support.)
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2022-09-22 11:29 -0700 |
| Message-ID | <87o7v7dzz0.fsf@nosuchdomain.example.com> |
| In reply to | #167786 |
Thiago Adams <thiago.adams@gmail.com> writes:
> Decimal floating point types were added into C23.
>
> I was wondering.. how it will be implemented by c23 compilers?
> Is it already supported in x86 / x64 / arm?
>
> or it is a kind of emulation?
Decimal floating types are optional in C23.
Presumably they'll be implemented in hardware for targets that
support them, or in emulation or not at all for targets that don't.
gcc already supports decimal floating-point on some targets. A quick
test indicates that it generates function calls for _Decimal64 addition,
for example. I don't know the details. From the gcc manual:
As an extension, GNU C supports decimal floating types as defined in
the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating
types in GCC will evolve as the draft technical report changes.
Calling conventions for any target might also change. Not all
targets support decimal floating types.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2022-09-22 19:10 -0400 |
| Message-ID | <SX5XK.56021$OR4c.42578@fx46.iad> |
| In reply to | #167795 |
On 9/22/22 2:29 PM, Keith Thompson wrote: > Thiago Adams <thiago.adams@gmail.com> writes: >> Decimal floating point types were added into C23. >> >> I was wondering.. how it will be implemented by c23 compilers? >> Is it already supported in x86 / x64 / arm? >> >> or it is a kind of emulation? > > Decimal floating types are optional in C23. > > Presumably they'll be implemented in hardware for targets that > support them, or in emulation or not at all for targets that don't. > > gcc already supports decimal floating-point on some targets. A quick > test indicates that it generates function calls for _Decimal64 addition, > for example. I don't know the details. From the gcc manual: > > As an extension, GNU C supports decimal floating types as defined in > the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating > types in GCC will evolve as the draft technical report changes. > Calling conventions for any target might also change. Not all > targets support decimal floating types. > The key point is that decimal floating point isn't that hard to implement in software. It is just slightly harder than binary floating point on hardware that doesn't support that. The extra difficulty is mostly "shifting" by powers of 10 instead of 2.
[toc] | [prev] | [next] | [standalone]
| From | Bart <bc@freeuk.com> |
|---|---|
| Date | 2022-09-23 01:19 +0100 |
| Message-ID | <tgiu31$125r$1@gioia.aioe.org> |
| In reply to | #167808 |
On 23/09/2022 00:10, Richard Damon wrote: > On 9/22/22 2:29 PM, Keith Thompson wrote: >> Thiago Adams <thiago.adams@gmail.com> writes: >>> Decimal floating point types were added into C23. >>> >>> I was wondering.. how it will be implemented by c23 compilers? >>> Is it already supported in x86 / x64 / arm? >>> >>> or it is a kind of emulation? >> >> Decimal floating types are optional in C23. >> >> Presumably they'll be implemented in hardware for targets that >> support them, or in emulation or not at all for targets that don't. >> >> gcc already supports decimal floating-point on some targets. A quick >> test indicates that it generates function calls for _Decimal64 addition, >> for example. I don't know the details. From the gcc manual: >> >> As an extension, GNU C supports decimal floating types as defined in >> the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating >> types in GCC will evolve as the draft technical report changes. >> Calling conventions for any target might also change. Not all >> targets support decimal floating types. >> > > The key point is that decimal floating point isn't that hard to > implement in software. It is just slightly harder than binary floating > point on hardware that doesn't support that. It would be if designed properly. But not the Decimal64 type as described here: https://en.wikipedia.org/wiki/Decimal64_floating-point_format It is horrible. You would spend most of the time trying to disentangle what is what. Look for example at those groups of 10-bit 'declets'. It's probably OK if someone else makes the effort to implement it in hardware. But not as it is. > > The extra difficulty is mostly "shifting" by powers of 10 instead of 2.
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2022-09-22 23:42 -0400 |
| Message-ID | <qW9XK.166804$elEa.108100@fx09.iad> |
| In reply to | #167809 |
On 9/22/22 8:19 PM, Bart wrote: > On 23/09/2022 00:10, Richard Damon wrote: >> On 9/22/22 2:29 PM, Keith Thompson wrote: >>> Thiago Adams <thiago.adams@gmail.com> writes: >>>> Decimal floating point types were added into C23. >>>> >>>> I was wondering.. how it will be implemented by c23 compilers? >>>> Is it already supported in x86 / x64 / arm? >>>> >>>> or it is a kind of emulation? >>> >>> Decimal floating types are optional in C23. >>> >>> Presumably they'll be implemented in hardware for targets that >>> support them, or in emulation or not at all for targets that don't. >>> >>> gcc already supports decimal floating-point on some targets. A quick >>> test indicates that it generates function calls for _Decimal64 addition, >>> for example. I don't know the details. From the gcc manual: >>> >>> As an extension, GNU C supports decimal floating types as >>> defined in >>> the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating >>> types in GCC will evolve as the draft technical report changes. >>> Calling conventions for any target might also change. Not all >>> targets support decimal floating types. >>> >> >> The key point is that decimal floating point isn't that hard to >> implement in software. It is just slightly harder than binary floating >> point on hardware that doesn't support that. > > It would be if designed properly. But not the Decimal64 type as > described here: > > https://en.wikipedia.org/wiki/Decimal64_floating-point_format > > It is horrible. You would spend most of the time trying to disentangle > what is what. Look for example at those groups of 10-bit 'declets'. > The version with the 10-bit declets is a variant, (Densely packed Decimal), it tends to be more commonly done in the Binary Integer significand format, where the mantisa is one "binary" number, with a scale factor of a power of 10. > It's probably OK if someone else makes the effort to implement it in > hardware. But not as it is. Yes, The Densely packed format is likely much more prone to being implemented in hardware only. > >> >> The extra difficulty is mostly "shifting" by powers of 10 instead of 2. >
[toc] | [prev] | [next] | [standalone]
| From | Michael S <already5chosen@yahoo.com> |
|---|---|
| Date | 2022-09-23 02:50 -0700 |
| Message-ID | <b6e1db95-581b-4e5d-a5f4-ef16fc6c2ea4n@googlegroups.com> |
| In reply to | #167809 |
On Friday, September 23, 2022 at 3:20:01 AM UTC+3, Bart wrote: > On 23/09/2022 00:10, Richard Damon wrote: > > On 9/22/22 2:29 PM, Keith Thompson wrote: > >> Thiago Adams <thiago...@gmail.com> writes: > >>> Decimal floating point types were added into C23. > >>> > >>> I was wondering.. how it will be implemented by c23 compilers? > >>> Is it already supported in x86 / x64 / arm? > >>> > >>> or it is a kind of emulation? > >> > >> Decimal floating types are optional in C23. > >> > >> Presumably they'll be implemented in hardware for targets that > >> support them, or in emulation or not at all for targets that don't. > >> > >> gcc already supports decimal floating-point on some targets. A quick > >> test indicates that it generates function calls for _Decimal64 addition, > >> for example. I don't know the details. From the gcc manual: > >> > >> As an extension, GNU C supports decimal floating types as defined in > >> the N1312 draft of ISO/IEC WDTR24732. Support for decimal floating > >> types in GCC will evolve as the draft technical report changes. > >> Calling conventions for any target might also change. Not all > >> targets support decimal floating types. > >> > > > > The key point is that decimal floating point isn't that hard to > > implement in software. It is just slightly harder than binary floating > > point on hardware that doesn't support that. > It would be if designed properly. But not the Decimal64 type as > described here: > > https://en.wikipedia.org/wiki/Decimal64_floating-point_format > > It is horrible. You would spend most of the time trying to disentangle > what is what. Look for example at those groups of 10-bit 'declets'. > DPD is intended for HW implementations. Software implementation are expected to use BID. > It's probably OK if someone else makes the effort to implement it in > hardware. But not as it is. Under given constrains of fitting into 64 bits decimal64 in BID encoding is not horrible at all. Software implementation could to be rather fast on modern 64-bit processors. Intel's reference library implementation from 15+ plus years ago is slow not because it should be, but probably because it was done in hurry and never improved after that. The real problem with IEEE decimal64 is completely different. It's just not useful. For accountants it's o.k. for input/output but does not have enough of precision to hold intermediate results. In theory, higher precision could be used when needed, but that defeats the primary purpose of decimal floating-point, which is to make life of accountants simpler. So, the part of accountants that wants their lives simpler (and got brains) will use decimal128 from start to finish. Bigger fraction of accountants will continue to use fix-point and ignore decimal FP as too innovative and breaking existing practices. And the rest of the world is happy with binary and never wanted decimal to start with. So, no place for decimal64 in the world, as I understand it, except possibly, as a storage format for big missives of financial data. But even in this role zipped decimal128 can probably do at least as well if not better.
[toc] | [prev] | [next] | [standalone]
| From | Thomas David Rivers <rivers@dignus.com> |
|---|---|
| Date | 2022-09-29 14:06 -0400 |
| Message-ID | <6335DEAE.6010108@dignus.com> |
| In reply to | #167786 |
Thiago Adams wrote: >Decimal floating point types were added into C23. > >I was wondering.. how it will be implemented by c23 compilers? >Is it already supported in x86 / x64 / arm? > >or it is a kind of emulation? > > It is implemented in hardware on the z/Architecture, and our compilers have natively supported that for many years. We also have compilers that support it for x86 machines (both 32-bit and 64-bit) using the IBM DPD format. Since it's not native to the hardware those are supported via runtime functions. - Dave Rivers - -- rivers@dignus.com Work: (919) 676-0847 Get your mainframe programming tools at http://www.dignus.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c
csiph-web