🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #1168

Re: .5 against 0.5f

#1168
From: Janis Papanagnou
Date: Fri, 30 Oct 2026 13:07
20 lines
2283 bytes
On 2026-10-30 10:39, chine.bleu wrote:
>
> You could make a library for rational numbers (two integers) arithmetic 
> where the denominator is a power of ten.

Using rational numbers is of course an option. Though I don't recall
to have seen common systems with support of rational arithmetic, and
also languages with a rational numbers type seem not be too common.
(Incidentally I've not long ago written such for a language that while
inherently supporting even 'complex' numbers there's no 'rational'.
Rationals are no biggie so could easily be provided through a library.)
But I also think the fixed point approach is still just simpler and
that's probably the reason for often having been used.

> If the CPU has decimal arithmetic, implement it in assembly.

Well, the pocket calculators often had that and did exactly that.

Janis
Technical Details
Message-ID: <11c24qq$2t866$9@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> <Ue6ES.2265$y_V1.1859@fx12.iad> <11bv5o7$37qph$1@dont-email.me> <11c0plh$3s02c$1@dont-email.me> <11c14qg$2t866$7@dont-email.me> <11c1ok8$469v$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: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.c
Subject: Re: .5 against 0.5f
Date: Fri, 30 Oct 2026 14:07:38 +0100
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <11c24qq$2t866$9@dont-email.me>
References: <11bpvs7$1e6kc$2@dont-email.me> <11bqnvh$1np7s$1@dont-email.me>
 <Ue6ES.2265$y_V1.1859@fx12.iad> <11bv5o7$37qph$1@dont-email.me>
 <11c0plh$3s02c$1@dont-email.me> <11c14qg$2t866$7@dont-email.me>
 <11c1ok8$469v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 30 Oct 2026 13:07:39 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3055814"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18pRxaxQ5nhY+MiUqSxzA2o"; posting-host="0fda1f313dd998dda8e95c4840e29ea0"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:E9zc6OBChfpROPkqMcMOqxfYfNo= sha256:vSQZOSwTe8lgjGx4jFakRhrmDxCKy6Q7r7Uq7yAAAbw=
	sha1:67qY6ZvN++oHUM6VElc2OZyDFAY= sha256:hpi64o6os+mg5WwR1PHcrk1gmpkTCuy9pM4okFcXtmM=
In-Reply-To: <11c1ok8$469v$1@dont-email.me>
Content-Language: en-US