Path: csiph.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.uzoreto.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Decimal Floating Point Date: Fri, 10 Sep 2021 11:21:12 -0700 Organization: None to speak of Lines: 35 Message-ID: <87h7esfg13.fsf@nosuchdomain.example.com> References: <2bff66f3-391b-4785-9c43-1f056106d6a1n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="0e9d3ba203e9f9b63058110a571a6640"; logging-data="15058"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+isCqXp5suTGajF1ljj0fZ" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:aimhxqRxJQClFkxUUBggTBwTIi8= sha1:JEHvdmtkZ9Ll6a860r6/sNxx7xk= Xref: csiph.com comp.lang.c:162714 ram@zedat.fu-berlin.de (Stefan Ram) writes: > Fabian Russell 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 */