🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1135

Re: .5 against 0.5f

#1135
From: Keith Thompson
Date: Thu, 29 Oct 2026 23:06
43 lines
3573 bytes
"Steven G. Kargl" <sgk@REMOVEtroutmask.apl.washington.edu> writes:
> On Thu, 29 Oct 2026 11:56:38 -0400, James Kuyper wrote:
>> On 2026-10-28 21:50, Steven G. Kargl wrote:
[...]
>>> Why?  What harm do the parentheses cause?
>> 
>> They can lead to people thinking that return is a function, even if they
>> nominally know better. What would you think of
>> 
>> 	return (a=b).retval;
>> 
>> You might never write such code, and might never read it either, but you
>> should have no trouble parsing it. Do you?
>
> Never written nor seen such a line of code.  Of course, a random
> line of code taken out of context may have many interpretations
> or no interpretation at all.  I likely know less than 25% of
> what C can do as I am primarily interested in only C23 7.12 and
> Annex F and G.

(7.12 is <math.h>; Annexes F and G are ISO/IEC 60559 arithmetic.)

The question isn't whether you've ever seen such code (which I'm
guessing James made up as an example).  The question is whether
you can easily understand it.  Someone who had a mental model that
return requires parentheses would likely have trouble with it.  (And
in fact very early versions of C did require parentheses on return
statements with an expression.)

> I do find it interesting that in a newgroup purportedly concerned
> with discussions about the C programming language, I seem to have
> been the only person in this thread to show a complete self-contained
> piece of code so fir can see the consequences of not understanding
> floating point arithmetic.

You may be one of the few people who's willing to engage with fir.
I didn't reply to him because I don't read his posts.

Are you the same person as steve g <Sgonedes1977@gmail.com>?

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID: <11c0jgr$3pmvb$1@kst.eternal-september.org>
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!kst.eternal-september.org!.POSTED!not-for-mail
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> <11brkco$21oj5$1@dont-email.me> <11bs4tj$26daj$1@dont-email.me> <11bs613$26knh$1@dont-email.me> <11bt7ff$2i0ag$1@dont-email.me> <11btm2a$2ojn1$2@kst.eternal-september.org> <11bttrp$2qvg6$1@dont-email.me> <11bu12l$2rgo2$4@kst.eternal-september.org> <11bu3kk$2svh8$1@dont-email.me> <868q3hmie0.fsf@linuxsc.com> <11bu8oi$2up7m$1@dont-email.me> <11bvqbn$3g0tj$1@dont-email.me> <11c01dq$3i9lv$1@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!kst.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: .5 against 0.5f
Date: Thu, 29 Oct 2026 16:06:03 -0700
Organization: None to speak of
Lines: 43
Message-ID: <11c0jgr$3pmvb$1@kst.eternal-september.org>
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> <11brkco$21oj5$1@dont-email.me>
	<11bs4tj$26daj$1@dont-email.me> <11bs613$26knh$1@dont-email.me>
	<11bt7ff$2i0ag$1@dont-email.me>
	<11btm2a$2ojn1$2@kst.eternal-september.org>
	<11bttrp$2qvg6$1@dont-email.me>
	<11bu12l$2rgo2$4@kst.eternal-september.org>
	<11bu3kk$2svh8$1@dont-email.me> <868q3hmie0.fsf@linuxsc.com>
	<11bu8oi$2up7m$1@dont-email.me> <11bvqbn$3g0tj$1@dont-email.me>
	<11c01dq$3i9lv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 29 Oct 2026 23:06:04 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="3988459"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/UY+0voV65fw2fRY4PxpKB"; posting-host="6d0778e7cc40265319e665d37d9f3d3e"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:oeo6L52I20u96JCGz3y276xzoVk= sha256:WEbd4Rpcl4nWJSePICbxI2zOUPpVk0/5JCdETTglMj0=
	sha1:T4E4svP4tzYGx/vzVcffE4HpHkY= sha256:2QcIkLWs6mJBzqi3amxovN2QGDJcyhEdC11k/fgEjf8=