Article View: comp.lang.c
Article #1124Re: .5 against 0.5f
From: Janis Papanagnou
Date: Thu, 29 Oct 2026 18:57
Date: Thu, 29 Oct 2026 18:57
48 lines
3405 bytes
3405 bytes
On 2026-10-29 09:30, David Brown wrote: > On 29/10/2026 00:08, Janis Papanagnou wrote: >> On 2026-10-28 21:27, Keith Thompson wrote: >> [...] >>> But 0.1f >>> and 0.1 are of different types. If they happen to behave the same way >>> in some context, it's a consequence of the C language rules. >> >> Yes, sure. Only that I think that context should suffice to interpret >> "0.1" appropriately! >> > > Do you mean that you think it would have been better if the rules of C > were different, so that the context always determined how "0.1" was to > be interpreted? (I think my opinion here is irrelevant since "C" is what it is.) But, yes, my question was whether it would haven been necessary (language design-wise!) to have those tags in the first place. > That's not an unreasonable feature for a programming > language - AFAIUI, that is how numeric literals work in Ada. But it is > not how things work in C, where the value and type of an expression is > determined entirely by the expression itself, independently of the context. > > I hate to try to speculate as to whether the C philosophy or the Ada > philosophy here is more common - (I also have no interest in speculations.) > but I don't know of any languages other > than Ada that make the type of literals dependent on their use or > context. There are of course many languages that might follow the Ada > path, unbeknownst to me. (You can have fun making class types in C++, > and no doubt other languages, that emulate this behaviour, but it is not > part of the language.) (Here I had started writing examples from other languages, but it got long and no end to see, and it's anyway most likely considered off-topic, so I decided to just stop here.) Thanks for your elaborations on the question. Janis > [...]
Technical Details
Message-ID:
<11c04uf$2t866$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11bpvs7$1e6kc$2@dont-email.me> <11bqnvh$1np7s$1@dont-email.me> <11br5td$1to7l$1@dont-email.me> <11br792$1u7e5$1@dont-email.me> <11brgqf$21170$2@dont-email.me> <11brir0$1uh9q$4@kst.eternal-september.org> <11bt4ua$139ta$8@dont-email.me> <11btlrl$2ojn1$1@kst.eternal-september.org> <11btv9c$139ta$12@dont-email.me> <11bv06a$34ll3$2@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.c Subject: Re: .5 against 0.5f Date: Thu, 29 Oct 2026 19:57:19 +0100 Organization: A noiseless patient Spider Lines: 48 Message-ID: <11c04uf$2t866$2@dont-email.me> References: <11bpvs7$1e6kc$2@dont-email.me> <11bqnvh$1np7s$1@dont-email.me> <11br5td$1to7l$1@dont-email.me> <11br792$1u7e5$1@dont-email.me> <11brgqf$21170$2@dont-email.me> <11brir0$1uh9q$4@kst.eternal-september.org> <11bt4ua$139ta$8@dont-email.me> <11btlrl$2ojn1$1@kst.eternal-september.org> <11btv9c$139ta$12@dont-email.me> <11bv06a$34ll3$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 29 Oct 2026 18:57:20 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3055814"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185deD5/Ugtc215KhezC9J2"; posting-host="5e472b3107e6c2ac767abee4ba3b623e" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:xO3Co2H3z9lYsarpS3PRqC9aiN8= sha256:hq/xfH44FpBtIYeWDP1g8ENxSzTokO8NkhgE5yWxNA4= sha1:ecjKv4PDDwHHgkTVXJkUK/D37Kw= sha256:mMEdnHffyQbgajDjgaU/DdG5D0vqvy7tzP0kGF7Ex48= In-Reply-To: <11bv06a$34ll3$2@dont-email.me> Content-Language: en-US