🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #981

Re: .5 against 0.5f

#981
From: Michael S
Date: Wed, 28 Oct 2026 22:12
33 lines
2621 bytes
On Wed, 28 Oct 2026 14:26:05 -0700
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:

> David Brown <david.brown@hesbynett.no> writes:
> > On 28/10/2026 01:49, Lawrence D’Oliveiro wrote:  
> >> On Tue, 27 Oct 2026 18:06:25 -0400, James Kuyper wrote:  
> >>> However, if you need double precision, you shouldn't be using the
> >>> "f" suffix.  
> >> Is there any situation where you *should* use the “f” suffix?
> >> I am thinking: no.  
> >
> > Try thinking harder.
> >
> > I use the "f" suffix all the time in my code, because I do not want
> > double precision.  In many situations, single precision arithmetic
> > is at least twice as fast as double precision - in some situations
> > it can be two orders of magnitude faster.  
> 
> If you define objects as type float rather than double, do you have
> examples of code where using 0.1f rather than 0.1 makes a difference?
> 
> One simple example: These two declarations result in identical code
> using gcc:
> 
>     float f = 0.1f;
>     float f = 0.1;
> 

David almost certainly was talking about use of 0.1f in arithmetic
expressions rather than in simple initialization.

Technical Details
Message-ID: <20261029001256.00001179@yahoo.com>
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
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> <11bs8rb$26dq0$1@dont-email.me> <11btp9d$2ojn1$4@kst.eternal-september.org>

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: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: .5 against 0.5f
Date: Thu, 29 Oct 2026 00:12:56 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20261029001256.00001179@yahoo.com>
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>
	<11bs8rb$26dq0$1@dont-email.me>
	<11btp9d$2ojn1$4@kst.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Date: Wed, 28 Oct 2026 22:13:02 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2972890"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/wLwttVgSEBKejHQA+sFnyLChMwTtF54A="; posting-host="3200a54061ecbbbd9ff00ee3880229c4"
Cancel-Lock: sha1:5Ni6rsLSbTqEbbzmUq0HLc9h0Nk= sha256:ABAc0LgUUG+UH5dnTbMtD+ej2LLP6O1kRdGTwfIy0Iw=
	sha1:aeTovSQtD4c07+9UalhFm/yxBLw= sha256:lFFjpdd5OPWhzmUcow6o+8v/WUo2AlD6GEQRiy3Zo8I=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)