Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Always draw your curves, then plot your reading.


devel / comp.lang.c / Decimal Floating Point

SubjectAuthor
* Decimal Floating PointFabian Russell
+* Re: Decimal Floating PointStefan Ram
|+- Re: Decimal Floating PointKeith Thompson
|`* Re: Decimal Floating PointKaz Kylheku
| `* Re: Decimal Floating PointKeith Thompson
|  `- Re: Decimal Floating PointKaz Kylheku
+* Re: Decimal Floating Pointjames...@alumni.caltech.edu
|+* Re: Decimal Floating PointScott Lurndal
||`* Re: Decimal Floating PointJames Kuyper
|| +* Re: Decimal Floating PointManfred
|| |+- Re: Decimal Floating PointLew Pitcher
|| |`- Re: Decimal Floating PointJames Kuyper
|| +* Re: Decimal Floating PointFabian Russell
|| |`- Re: Decimal Floating PointJames Kuyper
|| +* Re: Decimal Floating PointEli the Bearded
|| |+* Re: Decimal Floating PointKeith Thompson
|| ||+- Re: Decimal Floating PointFabian Russell
|| ||`- Re: Decimal Floating PointTim Rentsch
|| |`- Re: Decimal Floating PointJames Kuyper
|| `* Re: Decimal Floating PointScott Lurndal
||  `* Re: Decimal Floating PointJames Kuyper
||   `* Re: Decimal Floating PointManfred
||    `- Re: Decimal Floating PointJames Kuyper
|`* Re: Decimal Floating PointKeith Thompson
| +* Re: Decimal Floating PointBart
| |`* Re: Decimal Floating PointDavid Brown
| | `* Re: Decimal Floating PointKeith Thompson
| |  `- Re: Decimal Floating PointDavid Brown
| `- Re: Decimal Floating PointKeith Thompson
+- Re: Decimal Floating PointBonita Montero
+* Re: Decimal Floating PointBonita Montero
|+* Re: Decimal Floating PointMalcolm McLean
||`- Re: Decimal Floating PointBonita Montero
|+* Re: Decimal Floating Pointjames...@alumni.caltech.edu
||`* Re: Decimal Floating PointFabian Russell
|| `- Re: Decimal Floating Pointantispam
|`* Re: Decimal Floating PointScott Lurndal
| `* Re: Decimal Floating PointBonita Montero
|  `* Re: Decimal Floating PointSiri Cruise
|   `* Re: Decimal Floating PointBonita Montero
|    +- Re: Decimal Floating PointBarry Schwarz
|    `* Re: Decimal Floating PointJames Kuyper
|     `* Re: Decimal Floating PointKeith Thompson
|      `- Re: Decimal Floating PointRichard Damon
+- Re: Decimal Floating PointPhilipp Klaus Krause
+- Re: Decimal Floating PointChris M. Thomasson
`- Re: Decimal Floating PointThomas David Rivers

Pages:12
Decimal Floating Point

<2bff66f3-391b-4785-9c43-1f056106d6a1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18261&group=comp.lang.c++#18261

  copy link   Newsgroups: comp.lang.c
 by: Fabian Russell - Fri, 10 Sep 2021 13:35 UTC

Decimal floating point was standardized as IEEE758-2008 and new C types
were defined: _Decimal128, _Decimal64, and _Decimal32.

Gcc has many built-in functions (via libgcc) to handle decimal FP:

https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html

However, what puzzles me is that C has not yet incorporated the decimal
FP types so that the ordinary binary operators, such as "+ - * /" can operate
directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
one must use the function __bid_adddd3(x, y) instead of x + y.

Why bother to include the new types yet now allow them to be used
arithmetically like all other standard numeric types?

Re: Decimal Floating Point

<decimal-20210910150340@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18262&group=comp.lang.c++#18262

  copy link   Newsgroups: comp.lang.c
 by: Stefan Ram - Fri, 10 Sep 2021 14:04 UTC

Fabian Russell <fr314159@gmail.com> writes:
>Why bother to include the new types yet now allow them to be used
>arithmetically like all other standard numeric types?

One would have to define many new rules for cases like
"double + decimal" and so on. And these would have to be
worded conditionally to support systems that do not support
such decimal types. Maybe doing this would render the
language too complicated. Programmers on architectures
without decimal features would still have to pay that price,
even if they cannot use it.

OTOH, it is not totally impossible that the process needs
time. It would start with support on some C implementations.
Once there are enough widespread C implementation with support
for decimal operators, the committee then might seen a need
for standardization. Maybe you want to submit a patch?
Or, use C++ where you can easily overload operators.

Re: Decimal Floating Point

<993af611-3442-412b-8fc8-2e1d081f0d36n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18266&group=comp.lang.c++#18266

  copy link   Newsgroups: comp.lang.c
 by: james...@alumni.calt - Fri, 10 Sep 2021 15:17 UTC

On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
> Decimal floating point was standardized as IEEE758-2008 and new C types
> were defined: _Decimal128, _Decimal64, and _Decimal32.

Can you cite a reference for that? The latest draft of the C standard that I
currently have access to is n2176.pdf, a draft version of the standard that
eventually got approved as C2017. I found no mention of those types in that
document.

> Gcc has many built-in functions (via libgcc) to handle decimal FP:
>
> https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
>
> However, what puzzles me is that C has not yet incorporated the decimal
> FP types so that the ordinary binary operators, such as "+ - * /" can operate
> directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
> one must use the function __bid_adddd3(x, y) instead of x + y.
>
> Why bother to include the new types yet now allow them to be used
> arithmetically like all other standard numeric types?

This appears to be a gcc extension to C; as such, the best place to get good
answers to your question would be a forum devoted to gcc.

Re: Decimal Floating Point

<N3L_I.34042$tG6.4937@fx39.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18269&group=comp.lang.c++#18269

  copy link   Newsgroups: comp.lang.c
 by: Scott Lurndal - Fri, 10 Sep 2021 15:44 UTC

"james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>> Decimal floating point was standardized as IEEE758-2008 and new C types
>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>
>Can you cite a reference for that? The latest draft of the C standard that I
>currently have access to is n2176.pdf, a draft version of the standard that
>eventually got approved as C2017. I found no mention of those types in that
>document.

I believe Fabian was referring to the IEEE standard, not the C standard.

Re: Decimal Floating Point

<shfvmj$v31$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18270&group=comp.lang.c++#18270

  copy link   Newsgroups: comp.lang.c
 by: Bonita Montero - Fri, 10 Sep 2021 16:04 UTC

Am 10.09.2021 um 15:35 schrieb Fabian Russell:
> Decimal floating point was standardized as IEEE758-2008 and new C types
> were defined: _Decimal128, _Decimal64, and _Decimal32.
> Gcc has many built-in functions (via libgcc) to handle decimal FP:
> https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
> However, what puzzles me is that C has not yet incorporated the decimal
> FP types so that the ordinary binary operators, such as "+ - * /" can operate
> directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
> one must use the function __bid_adddd3(x, y) instead of x + y.
> Why bother to include the new types yet now allow them to be used
> arithmetically like all other standard numeric types?

What I'm curious about is: has anyone found a decimal FP lib that works
with datatypes that match the behaviour of SQL's NUMBER datatype ? I.e.
the same maximum length of digits and the same rounding behaviour.

Re: Decimal Floating Point

<shfvpl$vu6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18271&group=comp.lang.c++#18271

  copy link   Newsgroups: comp.lang.c
 by: James Kuyper - Fri, 10 Sep 2021 16:06 UTC

On 9/10/21 11:44 AM, Scott Lurndal wrote:
> "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>>> Decimal floating point was standardized as IEEE758-2008 and new C types
>>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>
>> Can you cite a reference for that? The latest draft of the C standard that I
>> currently have access to is n2176.pdf, a draft version of the standard that
>> eventually got approved as C2017. I found no mention of those types in that
>> document.
>
> I believe Fabian was referring to the IEEE standard, not the C standard.

Yes, but because they are not in the C standard, they're not C standard
types, which means that the best place to ask questions about them is
not this newsgroup.

Re: Decimal Floating Point

<shfvqk$v31$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18272&group=comp.lang.c++#18272

  copy link   Newsgroups: comp.lang.c
 by: Bonita Montero - Fri, 10 Sep 2021 16:06 UTC

Am 10.09.2021 um 15:35 schrieb Fabian Russell:
> Decimal floating point was standardized as IEEE758-2008 and new C types
> were defined: _Decimal128, _Decimal64, and _Decimal32.
>
> Gcc has many built-in functions (via libgcc) to handle decimal FP:
>
> https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
>
> However, what puzzles me is that C has not yet incorporated the decimal
> FP types so that the ordinary binary operators, such as "+ - * /" can operate
> directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
> one must use the function __bid_adddd3(x, y) instead of x + y.
>
> Why bother to include the new types yet now allow them to be used
> arithmetically like all other standard numeric types?

Decimal-FP is too highlevel for such a lowlevel language. Decimal-FP
would fit more with a language like C++, where everything could be
implemented without support of the core language just by the library,
supplying proper datatypes and overloading the operators accordingly.

Re: Decimal Floating Point

<shg00c$1jjd$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18273&group=comp.lang.c++#18273

  copy link   Newsgroups: comp.lang.c
 by: Manfred - Fri, 10 Sep 2021 16:09 UTC

On 9/10/2021 6:06 PM, James Kuyper wrote:
> On 9/10/21 11:44 AM, Scott Lurndal wrote:
>> "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>>> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>>>> Decimal floating point was standardized as IEEE758-2008 and new C types
>>>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>>
>>> Can you cite a reference for that? The latest draft of the C standard that I
>>> currently have access to is n2176.pdf, a draft version of the standard that
>>> eventually got approved as C2017. I found no mention of those types in that
>>> document.
>>
>> I believe Fabian was referring to the IEEE standard, not the C standard.
>
> Yes, but because they are not in the C standard, they're not C standard
> types, which means that the best place to ask questions about them is
> not this newsgroup.
>

He wrote "C types"..

Re: Decimal Floating Point

<shg0q3$6um$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18275&group=comp.lang.c++#18275

  copy link   Newsgroups: comp.lang.c
 by: Lew Pitcher - Fri, 10 Sep 2021 16:23 UTC

On Fri, 10 Sep 2021 18:09:48 +0200, Manfred wrote:

> On 9/10/2021 6:06 PM, James Kuyper wrote:
>> On 9/10/21 11:44 AM, Scott Lurndal wrote:
>>> "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>>>> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>>>>> Decimal floating point was standardized as IEEE758-2008 and new C types
>>>>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>>>
>>>> Can you cite a reference for that? The latest draft of the C standard that I
>>>> currently have access to is n2176.pdf, a draft version of the standard that
>>>> eventually got approved as C2017. I found no mention of those types in that
>>>> document.
>>>
>>> I believe Fabian was referring to the IEEE standard, not the C standard.
>>
>> Yes, but because they are not in the C standard, they're not C standard
>> types, which means that the best place to ask questions about them is
>> not this newsgroup.
>>
>
> He wrote "C types"..

Yes? So?

The IEEE doesn't have overriding authority over the ISO C standard, and /anybody/
can "define" a new "C type". But /defining/ such a thing, and /making it part
of the standard/ are two completely different things.

Microsoft /defined/ "far" as a C storage class specifier, but "far" isn't part of
the ISO C standard language.

Gnome /defined/ "GtkWidget" as a C object, but "GtkWidget" isn't part of the ISO
C standard language.

A number of the regulars here in comp.lang.c have /defined/ various enhancements
to the C language, ranging from garbage-collection to string-handling to OO primitives,
but none of these /defined/ enhancements are part of the ISO C standard language.

All in all, third party declarations of new "standard" features are just so much
smoke and wind, /until/ the ISO standardization committee enshrines them in the
C language standard. At best, those new "standard" features are just optional
libraries and/or modifications to compilers that also happen to support the C
language.

--
Lew Pitcher
"In Skills, We Trust"

Re: Decimal Floating Point

<8543b60b-db49-41e3-83de-f777dcf212c3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18276&group=comp.lang.c++#18276

  copy link   Newsgroups: comp.lang.c
 by: Malcolm McLean - Fri, 10 Sep 2021 16:37 UTC

On Friday, 10 September 2021 at 17:06:57 UTC+1, Bonita Montero wrote:
> Am 10.09.2021 um 15:35 schrieb Fabian Russell:
> > Decimal floating point was standardized as IEEE758-2008 and new C types
> > were defined: _Decimal128, _Decimal64, and _Decimal32.
> >
> > Gcc has many built-in functions (via libgcc) to handle decimal FP:
> >
> > https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
> >
> > However, what puzzles me is that C has not yet incorporated the decimal
> > FP types so that the ordinary binary operators, such as "+ - * /" can operate
> > directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
> > one must use the function __bid_adddd3(x, y) instead of x + y.
> >
> > Why bother to include the new types yet now allow them to be used
> > arithmetically like all other standard numeric types?
> Decimal-FP is too highlevel for such a lowlevel language. Decimal-FP
> would fit more with a language like C++, where everything could be
> implemented without support of the core language just by the library,
> supplying proper datatypes and overloading the operators accordingly.
>
Yes, that's the real answer. If you need width-limited decimals with defined
overflow behaviour, then make it a C++ numerical class. It won't be fast,
but it's unlikely that the speed of arithmetic is a serious consideration in
the types of applications it is likely to be used for.

Re: Decimal Floating Point

<shg1l3$u70$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18278&group=comp.lang.c++#18278

  copy link   Newsgroups: comp.lang.c
 by: James Kuyper - Fri, 10 Sep 2021 16:37 UTC

On 9/10/21 12:09 PM, Manfred wrote:
> On 9/10/2021 6:06 PM, James Kuyper wrote:
>> On 9/10/21 11:44 AM, Scott Lurndal wrote:
>>> "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>>>> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>>>>> Decimal floating point was standardized as IEEE758-2008 and new C types
>>>>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>>>
>>>> Can you cite a reference for that? The latest draft of the C standard that I
>>>> currently have access to is n2176.pdf, a draft version of the standard that
>>>> eventually got approved as C2017. I found no mention of those types in that
>>>> document.
>>>
>>> I believe Fabian was referring to the IEEE standard, not the C standard.
>>
>> Yes, but because they are not in the C standard, they're not C standard
>> types, which means that the best place to ask questions about them is
>> not this newsgroup.
>>
>
> He wrote "C types"..

Yes. Despite the fact that he described them as C types, they are not C
standard types, so the best place to discuss them is elsewhere. If
they're defined by the IEEE758-2008, they should be discussed in a forum
appropriate to that standard. If they're defined by gcc, they should be
discussed in a gcc forum. Discuss them anywhere else, and you're less
likely to find people who can intelligently discuss them. Unfortunately,
that won't stop people from trying to discuss them - but due to a
shortage of people who are sufficiently familiar with those types, any
errors perpetrated by people who aren't sufficiently familiar with them
may go unchallenged if you post your question in the wrong forum.

Re: Decimal Floating Point

<cc82c43b-511e-4259-a590-aad9146784d1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18279&group=comp.lang.c++#18279

  copy link   Newsgroups: comp.lang.c
 by: Fabian Russell - Fri, 10 Sep 2021 16:38 UTC

On Friday, September 10, 2021 at 12:06:29 PM UTC-4, james...@alumni.caltech.edu wrote:

> Yes, but because they are not in the C standard, they're not C standard
> types,
>

I now understand. I am more interested is using these new types rather than understanding
their origin.

But are the decFP types being considered for inclusion in the C standard?

Re: Decimal Floating Point

<caca351b-966c-43fc-8337-07f0c9b5c139n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18281&group=comp.lang.c++#18281

  copy link   Newsgroups: comp.lang.c
 by: james...@alumni.calt - Fri, 10 Sep 2021 16:52 UTC

On Friday, September 10, 2021 at 12:06:57 PM UTC-4, Bonita Montero wrote:
> Am 10.09.2021 um 15:35 schrieb Fabian Russell:
> > Decimal floating point was standardized as IEEE758-2008 and new C types
> > were defined: _Decimal128, _Decimal64, and _Decimal32.
> >
> > Gcc has many built-in functions (via libgcc) to handle decimal FP:
> >
> > https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
> >
> > However, what puzzles me is that C has not yet incorporated the decimal
> > FP types so that the ordinary binary operators, such as "+ - * /" can operate
> > directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
> > one must use the function __bid_adddd3(x, y) instead of x + y.
> >
> > Why bother to include the new types yet now allow them to be used
> > arithmetically like all other standard numeric types?
> Decimal-FP is too highlevel for such a lowlevel language. Decimal-FP
> would fit more with a language like C++, where everything could be
> implemented without support of the core language just by the library,
> supplying proper datatypes and overloading the operators accordingly.

Decimal-FP is being discussed precisely because there are platforms currently
planned which will have hardware support for it (they may already be in
production - I haven't been paying close attention). If ever standardized as part
of C, it will undoubtedly be optional, and few implementations will support it
except when targeting such platforms. On such platforms, it is no more of a
high-level feature than binary floating point.

Re: Decimal Floating Point

<shg2r2$j5m$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18282&group=comp.lang.c++#18282

  copy link   Newsgroups: comp.lang.c
 by: James Kuyper - Fri, 10 Sep 2021 16:58 UTC

On 9/10/21 12:38 PM, Fabian Russell wrote:
> On Friday, September 10, 2021 at 12:06:29 PM UTC-4, james...@alumni.caltech.edu wrote:
>
>> Yes, but because they are not in the C standard, they're not C standard
>> types,
>>
>
> I now understand. I am more interested is using these new types rather than understanding
> their origin.
>
> But are the decFP types being considered for inclusion in the C standard?

I have heard rumors to that effect.

Re: Decimal Floating Point

<a937b498-3fd9-429e-9a36-5c9ad6b38f48n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18283&group=comp.lang.c++#18283

  copy link   Newsgroups: comp.lang.c
 by: Fabian Russell - Fri, 10 Sep 2021 17:08 UTC

On Friday, September 10, 2021 at 12:52:28 PM UTC-4, james...@alumni.caltech.edu wrote:
> Decimal-FP is being discussed precisely because there are platforms currently
> planned which will have hardware support for it (they may already be in
> production
>

IBM mainframes, like the z-series, have had hardware decFP for quite some time.

In fact, the GCC extensions that I referred to earlier are based on libdecnumber
which was developed by IBM.

Also, IBM has donated to the FSF another decFP library of theirs called libdfp:

https://github.com/libdfp/libdfp

Libdfp essentially extends most glibc functions to the decFP types.

So GNU/Linux has very complete decFP capability.

Unfortunately, and maybe also surprisingly, considering how long the decFP
type has been around there is little information about decFP applications to be found.

Whether Intel or AMD will include decFP hardware support in the future is unknown.

Re: Decimal Floating Point

<eli$2109101411@qaz.wtf>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18285&group=comp.lang.c++#18285

  copy link   Newsgroups: comp.lang.c
 by: Eli the Bearded - Fri, 10 Sep 2021 18:11 UTC

In comp.lang.c, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
> On 9/10/21 11:44 AM, Scott Lurndal wrote:
>> I believe Fabian was referring to the IEEE standard, not the C standard.
> Yes, but because they are not in the C standard, they're not C standard
> types, which means that the best place to ask questions about them is
> not this newsgroup.

I'm reading this in comp.lang.c and I look at the Newsgroups header and
don't see a crosspost to comp.std.c so I'm wondering why you believe
"not C Standard ... not this newsgroup".

Elijah
------
comp.std.c seems to be the only active comp.std.* group

Re: Decimal Floating Point

<87lf44fgbr.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18286&group=comp.lang.c++#18286

  copy link   Newsgroups: comp.lang.c
 by: Keith Thompson - Fri, 10 Sep 2021 18:14 UTC

"james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>> Decimal floating point was standardized as IEEE758-2008 and new C types
>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>
> Can you cite a reference for that? The latest draft of the C standard that I
> currently have access to is n2176.pdf, a draft version of the standard that
> eventually got approved as C2017. I found no mention of those types in that
> document.

See n2596.pdf, a more recent draft of the C 202x standard. Yes, decimal
floating-point is being proposed as an optional standard C feature.

http://www.open-std.org/JTC1/SC22/WG14/www/docs/n2176.pdf

[...]

--
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 */

Re: Decimal Floating Point

<87h7esfg13.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18287&group=comp.lang.c++#18287

  copy link   Newsgroups: comp.lang.c
 by: Keith Thompson - Fri, 10 Sep 2021 18:21 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
> Fabian Russell <fr314159@gmail.com> writes:
>>Why bother to include the new types yet now allow them to be used
>>arithmetically like all other standard numeric types?
>
> One would have to define many new rules for cases like
> "double + decimal" and so on. And these would have to be
> worded conditionally to support systems that do not support
> such decimal types. Maybe doing this would render the
> language too complicated. Programmers on architectures
> without decimal features would still have to pay that price,
> even if they cannot use it.
>
> OTOH, it is not totally impossible that the process needs
> time. It would start with support on some C implementations.
> Once there are enough widespread C implementation with support
> for decimal operators, the committee then might seen a need
> for standardization. Maybe you want to submit a patch?
> Or, use C++ where you can easily overload operators.

The N2596 draft of the C 202X standard includes (optional) support for
decimal floating-point.

Section 6.3.1.8, "Usual arithmetic conversions", says:

If one operand has decimal floating type, the other operand shall
not have standard floating, complex, or imaginary type.

So "double + decimal" is not allowed. You can cast one operand to the
type of the other operand.

--
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 */

Re: Decimal Floating Point

<shg914$uq2$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18289&group=comp.lang.c++#18289

  copy link   Newsgroups: comp.lang.c
 by: Bonita Montero - Fri, 10 Sep 2021 18:43 UTC

Am 10.09.2021 um 18:37 schrieb Malcolm McLean:

> Yes, that's the real answer. If you need width-limited decimals with defined
> overflow behaviour, then make it a C++ numerical class. It won't be fast,
> but it's unlikely that the speed of arithmetic is a serious consideration
> in the types of applications it is likely to be used for.

And you could transparently use IEEE decimal-fp operations through
hardware which supports it: the POWER-CPUs support decimal-FP for
some generations.

Re: Decimal Floating Point

<v%N_I.46385$Dr.13473@fx40.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18290&group=comp.lang.c++#18290

  copy link   Newsgroups: comp.lang.c
 by: Scott Lurndal - Fri, 10 Sep 2021 19:04 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:
>On 9/10/21 11:44 AM, Scott Lurndal wrote:
>> "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>>> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>>>> Decimal floating point was standardized as IEEE758-2008 and new C types
>>>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>>
>>> Can you cite a reference for that? The latest draft of the C standard that I
>>> currently have access to is n2176.pdf, a draft version of the standard that
>>> eventually got approved as C2017. I found no mention of those types in that
>>> document.
>>
>> I believe Fabian was referring to the IEEE standard, not the C standard.
>
>Yes, but because they are not in the C standard, they're not C standard
>types, which means that the best place to ask questions about them is
>not this newsgroup.

I disagree. This is comp.lang.c, not comp.lang.std.c.

Re: Decimal Floating Point

<z1O_I.46386$Dr.39984@fx40.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18291&group=comp.lang.c++#18291

  copy link   Newsgroups: comp.lang.c
 by: Scott Lurndal - Fri, 10 Sep 2021 19:07 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 10.09.2021 um 15:35 schrieb Fabian Russell:
>> Decimal floating point was standardized as IEEE758-2008 and new C types
>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>
>> Gcc has many built-in functions (via libgcc) to handle decimal FP:
>>
>> https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
>>
>> However, what puzzles me is that C has not yet incorporated the decimal
>> FP types so that the ordinary binary operators, such as "+ - * /" can operate
>> directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
>> one must use the function __bid_adddd3(x, y) instead of x + y.
>>
>> Why bother to include the new types yet now allow them to be used
>> arithmetically like all other standard numeric types?
>
>Decimal-FP is too highlevel for such a lowlevel language.

Incorrect, as usual.

Decimal FP, when implemented in the hardware[*], is suitable for any
language (especially COBOL).

[*] And yes, there are systems with decimal FP hardware both historic
and present.

Re: Decimal Floating Point

<878s04fdm9.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18292&group=comp.lang.c++#18292

  copy link   Newsgroups: comp.lang.c
 by: Keith Thompson - Fri, 10 Sep 2021 19:13 UTC

Eli the Bearded <*@eli.users.panix.com> writes:
> In comp.lang.c, James Kuyper <jameskuyper@alumni.caltech.edu> wrote:
>> On 9/10/21 11:44 AM, Scott Lurndal wrote:
>>> I believe Fabian was referring to the IEEE standard, not the C standard.
>> Yes, but because they are not in the C standard, they're not C standard
>> types, which means that the best place to ask questions about them is
>> not this newsgroup.
>
> I'm reading this in comp.lang.c and I look at the Newsgroups header and
> don't see a crosspost to comp.std.c so I'm wondering why you believe
> "not C Standard ... not this newsgroup".

Because the general (though not universal) consensus is that comp.lang.c
is for discussion of the C language as defined by the standard, and
comp.std.c is for discussion of the standard itself as a document.

As it happens, decimal floating-point *is* part of the latest draft
standard, so it's topical here. Not everyone in the discussion was
aware of that.

--
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 */

Re: Decimal Floating Point

<shgio2$nk2$1@solani.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18295&group=comp.lang.c++#18295

  copy link   Newsgroups: comp.lang.c
 by: Philipp Klaus Krause - Fri, 10 Sep 2021 21:29 UTC

Am 10.09.21 um 15:35 schrieb Fabian Russell:
> Decimal floating point was standardized as IEEE758-2008 and new C types
> were defined: _Decimal128, _Decimal64, and _Decimal32.
>
> Gcc has many built-in functions (via libgcc) to handle decimal FP:
>
> https://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html
>
> However, what puzzles me is that C has not yet incorporated the decimal
> FP types so that the ordinary binary operators, such as "+ - * /" can operate
> directly on them. Rather, to add two _Decimal_64 values, x, y, for example,
> one must use the function __bid_adddd3(x, y) instead of x + y.
>
> Why bother to include the new types yet now allow them to be used
> arithmetically like all other standard numeric types?
>

The types are in the C standard (but optional, like VLAs). See the
latest C23 draft N2596. And you can do arithmetic with the the normal
way (i.e. using operators, like you would with other arithmetic types).

Philipp

Re: Decimal Floating Point

<bf748f39-4852-4f30-9ec3-0edecd08e4e2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18297&group=comp.lang.c++#18297

  copy link   Newsgroups: comp.lang.c
 by: Fabian Russell - Fri, 10 Sep 2021 21:52 UTC

On Friday, September 10, 2021 at 3:13:34 PM UTC-4, Keith Thompson wrote:

> Because the general (though not universal) consensus is that comp.lang.c
> is for discussion of the C language as defined by the standard,
>

Do pardon me. I was under the impression that comp.lang.c was for discussions
of the C programming language and issues of C programming.

In any case, I just want to point out that standards-conformant decFP hardware can
exist as shown by this product for ordinary PCs:

http://www.silminds.com/index.php?option=com_content&task=view&id=51&Itemid=36

The web page also lists some of the areas where decFP is applicable and if the C language
is to adequately service the future then decFP has to be made a part of the standard.

Re: Decimal Floating Point

<shgnfl$ark$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18299&group=comp.lang.c++#18299

  copy link   Newsgroups: comp.lang.c
 by: Bart - Fri, 10 Sep 2021 22:50 UTC

On 10/09/2021 19:14, Keith Thompson wrote:
> "james...@alumni.caltech.edu" <jameskuyper@alumni.caltech.edu> writes:
>> On Friday, September 10, 2021 at 9:35:09 AM UTC-4, Fabian Russell wrote:
>>> Decimal floating point was standardized as IEEE758-2008 and new C types
>>> were defined: _Decimal128, _Decimal64, and _Decimal32.
>>
>> Can you cite a reference for that? The latest draft of the C standard that I
>> currently have access to is n2176.pdf, a draft version of the standard that
>> eventually got approved as C2017. I found no mention of those types in that
>> document.
>
> See n2596.pdf, a more recent draft of the C 202x standard. Yes, decimal
> floating-point is being proposed as an optional standard C feature.

I should hope it's optional. I've been looking at the description of the
bit-format:

https://en.wikipedia.org/wiki/Decimal64_floating-point_format

and couldn't make head or tail of it. I'm not sure if they could have
made it any more complicated. Pity the people who have to do software
emulations since hardware support is going to be scant.

(I've done my own decimal FP emulation, but I'm not constrained to
32/64/128-bit values and my encoding is far simpler.)

> http://www.open-std.org/JTC1/SC22/WG14/www/docs/n2176.pdf
>

(This link is password protected. None of the handful of rude words I
typed in seemed to work.)

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor