🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #894

Re: .5 against 0.5f

#894
From: James Kuyper
Date: Tue, 27 Oct 2026 22:06
13 lines
1980 bytes
On 2026-10-27 17:43, James Kuyper wrote:
...> So, 0.1 and 0.1f have different values, and might be even more
different
> after either one is converted to the other's type for comparison. The
> difference is only in the last representable bits, which won't matter
> for most practical purposes, but will matter if you're comparing for
> exact equality.

That was a mistake. The difference involves the last representable bits
of the float value, and all of the smaller bits in the double format. As
a practical matter, if float arithmetic is adequate for your
application, it won't make much difference. However, if you need double
precision, you shouldn't be using the "f" suffix.
Technical Details
Message-ID: <11br792$1u7e5$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-mail
References: <11bpvs7$1e6kc$2@dont-email.me> <11bqnvh$1np7s$1@dont-email.me> <11br5td$1to7l$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: James Kuyper <jameskuyper@alumni.caltech.edu>
Newsgroups: comp.lang.c
Subject: Re: .5 against 0.5f
Date: Tue, 27 Oct 2026 18:06:25 -0400
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <11br792$1u7e5$1@dont-email.me>
References: <11bpvs7$1e6kc$2@dont-email.me> <11bqnvh$1np7s$1@dont-email.me>
 <11br5td$1to7l$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 27 Oct 2026 22:06:27 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="2039237"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX199QjoHYZNUxjZQwlW99v/I3LT5qLmBPCU="; posting-host="12d93631e700fb3ab499ef75e583e1ff"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Uie5iJt4zVHmW8CyME3yCaLUqDM= sha256:oJf2T4NhGHMSfKBuXYXvfvd5+UPYSJyYVy6x82+v/ag=
	sha1:rB+LdxW5r0T/T1cGfoKQrLJoZpU= sha256:X7vFyo1nnW3nzKnckUjVBuOBNEpJf9wqI0C06+2JV4w=
In-Reply-To: <11br5td$1to7l$1@dont-email.me>
Content-Language: en-US