Article View: comp.lang.c
Article #1360Re: .5 against 0.5f
From: Chris M. Thomasson
Date: Sat, 07 Nov 2026 03:23
Date: Sat, 07 Nov 2026 03:23
36 lines
2920 bytes
2920 bytes
On 10/29/2026 3:06 AM, David Brown wrote: > On 28/10/2026 22:34, Chris M. Thomasson wrote: >> On 10/28/2026 12:39 AM, David Brown 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. >>> >>> >> >> Same here. I am mostly creating graphics related things. double >> precision in a GPU might not be there. Now, if I am doing something >> that needs higher precision, tends to be with deep zooms or >> granularity in a vector field, then double is okay. But I need to >> beware that the shaders might not support double. > > You can also see it in SIMD. A 128-bit SIMD register might be useable > for 4 single-precision values and parallel operations, while only 2 can > be handled for double-precision. Obviously details will vary by SIMD > implementation, but singles are going to be at least twice as fast in > general. > Indeed....
Technical Details
Message-ID:
<11cm5jl$33so2$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> <11bs8rb$26dq0$1@dont-email.me> <11btppc$2qhsd$1@dont-email.me> <11bv5rl$37s52$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!.POSTED!not-for-mail From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> Newsgroups: comp.lang.c Subject: Re: .5 against 0.5f Date: Fri, 6 Nov 2026 19:23:33 -0800 Organization: A noiseless patient Spider Lines: 36 Message-ID: <11cm5jl$33so2$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> <11bs8rb$26dq0$1@dont-email.me> <11btppc$2qhsd$1@dont-email.me> <11bv5rl$37s52$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 07 Nov 2026 03:23:34 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3273474"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tQSt1+q7kZGsHSZ37HeN6ndDUl2F3OIs="; posting-host="bc0e21f3ed9b117e5b0477befa9d31ee" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Pb8DsGnerK6hhiuQqAWGljVWQhg= sha256:XegbHc8K6LOey9TpROwoK3TsE+G1h/f+efijA4IxMlU= sha1:l9pKQE3KYVi7luJmS6uVefM8s+M= sha256:8MWO0ef1nZu3mUDvl/n5/siuzn/XQCjIKO7y5hiQZRI= In-Reply-To: <11bv5rl$37s52$1@dont-email.me> Content-Language: en-US