Article View: comp.lang.c
Article #1105Re: .5 against 0.5f
From: David Brown
Date: Thu, 29 Oct 2026 09:48
Date: Thu, 29 Oct 2026 09:48
31 lines
2548 bytes
2548 bytes
On 28/10/2026 21:25, Michael S wrote: > On Wed, 28 Oct 2026 08:39:23 +0100 > David Brown <david.brown@hesbynett.no> wrote: > >> 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. >> >> > > I'd still likely prefer to write it as (float)0.1 instead of 0.1f. > It somewhat depends on my mood in specific day, but likelihood is > certainly not in favor of 0.1f. > That seems a bit excessive to me, but okay. The principle is the same, making it clear to the reader and the compiler that no double-precision arithmetic is involved.
Technical Details
Message-ID:
<11bv4q0$37eth$1@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> <11bs8rb$26dq0$1@dont-email.me> <20261028222504.00004b8b@yahoo.com>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: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: .5 against 0.5f Date: Thu, 29 Oct 2026 10:48:48 +0100 Organization: A noiseless patient Spider Lines: 31 Message-ID: <11bv4q0$37eth$1@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> <11bs8rb$26dq0$1@dont-email.me> <20261028222504.00004b8b@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 29 Oct 2026 09:48:49 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3390385"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1935EBxjTnysPDvyI8fb+Zhk1Jr9DJRhC4="; posting-host="ee186c62f9168531a82b8aa89ffdfee0" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:35cK3KElpxDB+LQJPqut+BrmVKo= sha256:v83t6rokymgpy15gFho5ti9YoDDEkjnCEj4zC3A/Mx8= sha1:qWh/K5shXH7CEo39bJU6ng7Vq/U= sha256:gHdpYLiUc5qxy5vWDyuvCCG15Brwc1TBvthoElZH2Lo= In-Reply-To: <20261028222504.00004b8b@yahoo.com> Content-Language: en-GB, nb-NO