Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #393945

Re: "A diagram of C23 basic types"

Path csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: "A diagram of C23 basic types"
Date Sat, 28 Jun 2025 20:51:24 -0700
Organization None to speak of
Lines 62
Message-ID <8734bjxl1f.fsf@nosuchdomain.example.com> (permalink)
References <87y0wjaysg.fsf@gmail.com> <20250403150210.000020f8@yahoo.com> <86selt8lxv.fsf@linuxsc.com> <20250428162738.00007c1d@yahoo.com> <103j290$3bv4a$1@dont-email.me> <8734bm1eqz.fsf@nosuchdomain.example.com> <20250626235916.00003314@yahoo.com> <lGi7Q.55256$Ra5f.13001@fx13.iad> <87y0teyrg7.fsf@nosuchdomain.example.com> <103kvst$3tgp3$1@dont-email.me> <87tt40znsu.fsf@nosuchdomain.example.com> <103qae2$16tu9$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain
Injection-Date Sun, 29 Jun 2025 05:51:25 +0200 (CEST)
Injection-Info dont-email.me; posting-host="11cdcae53e715b5eaee1af52dc668743"; logging-data="1409294"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+iN+1oOjLNZDAQkIFWkYvd"
User-Agent Gnus/5.13 (Gnus v5.13)
Cancel-Lock sha1:a2q2ONN0QmJZENGgiGJM9fqNwbE= sha1:zCa//YosKc13mv2fmr/8kzUSkNs=
Xref csiph.com comp.lang.c:393945

Show key headers only | View raw


Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 28.06.2025 02:56, Keith Thompson wrote:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> On 27.06.2025 02:10, Keith Thompson wrote:
>>>> scott@slp53.sl.home (Scott Lurndal) writes:
>>>> [...]
>>>>> But not all decimal floating point implementations used "hex
> floating point".
>>>>>
>>>>> Burroughs medium systems had BCD floating point - one of the advantages
>>>>> was that it could exactly represent any floating point number that
>>>>> could be specified with a 100 digit mantissa and a 2 digit exponent.
>>>>
>>>> BCD uses 4 bits to represent values from 0 to 9.  That's about 83%
>>>> efficent relative to pure binary.  (And it still can't represent 1/3.)
>>>
>>> That's a problem of where your numbers stem from. "1/3" is a formula!
>>
>> 1/3 is also a C expression with the value 0.  But what I was
>> referring to was the real number 1/3, the unique real number that
>> yields one when multiplied by three.
>
> Yes, sure. That was also how I interpreted it; that you meant (in
> "C" parlance) 1.0/3.0.

As mentioned elsethread, I was referring to the real value.
1.0/3.0 as a C expression yields a value of type double, typically
0.333333333333333314829616256247390992939472198486328125 or
0x1.5555555555555p-2   (Unless FLT_RADIX is a multiple of 3, which
pretty much never happens.)

>> My point is that any choice of radix in a floating-point format
>> means that there are going to be some useful real numbers you
>> can't represent.
>
> Yes, sure. Sqrt(2.0) for example, or 'pi', or 'e', or your 1.0/3.0
> example. These numbers have in common that there's no finite length
> standard representation; you usually represent them as formulas (as
> in your example), or in computers as constants in abbreviated form.

Again, by 1/3 I meant the real number that is the mathematical result of
that formula, and of 2/6, and of 1-2/3, not the formula itself.

> In numerics you have various places where errors appear in principle
> and accumulate. One of the errors is when transferred from (and to)
> external representation. Another one is when performing calculations
> with internally imprecise represented numbers.
>
> The point with decimal encoding addresses the lossless (and fast[*])
> input/output of given [finite] numbers. Numbers that have been (and
> are) used e.g. in financial contexts (Billions of Euros and Cents).
> And you can also perform exact arithmetic in the typical operations
> (sum, multiply, subtract)[**] without errors.[***]

Which is convenient only because we happen to use decimal notation
when writing numbers.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-26 09:01 +0000
  Re: "A diagram of C23 basic types" Richard Heathfield <rjh@cpax.org.uk> - 2025-06-26 13:27 +0100
    Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-27 00:39 +0000
      Re: "A diagram of C23 basic types" Richard Heathfield <rjh@cpax.org.uk> - 2025-06-27 02:40 +0100
        Re: "A diagram of C23 basic types" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-06-26 19:33 -0700
        Re: "A diagram of C23 basic types" BGB <cr88192@gmail.com> - 2025-06-28 14:16 -0500
        Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-15 19:41 +0000
          Re: "A diagram of C23 basic types" Richard Heathfield <rjh@cpax.org.uk> - 2025-07-16 03:55 +0100
            Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-20 00:16 +0000
              Re: "A diagram of C23 basic types" Richard Heathfield <rjh@cpax.org.uk> - 2025-07-20 07:58 +0100
                Re: "A diagram of C23 basic types" Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-07-20 11:28 +0200
    Re: "A diagram of C23 basic types" Kaz Kylheku <643-408-1753@kylheku.com> - 2025-06-29 04:44 +0000
      Re: "A diagram of C23 basic types" Michael S <already5chosen@yahoo.com> - 2025-06-29 17:13 +0300
  Re: "A diagram of C23 basic types" antispam@fricas.org (Waldek Hebisch) - 2025-06-26 12:51 +0000
    Re: "A diagram of C23 basic types" "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-06-26 13:23 -0700
    Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-26 23:58 +0000
      Re: "A diagram of C23 basic types" antispam@fricas.org (Waldek Hebisch) - 2025-06-27 03:51 +0000
        Re: "A diagram of C23 basic types" David Brown <david.brown@hesbynett.no> - 2025-06-27 13:44 +0200
      Re: "A diagram of C23 basic types" scott@slp53.sl.home (Scott Lurndal) - 2025-06-27 14:01 +0000
  Re: "A diagram of C23 basic types" David Brown <david.brown@hesbynett.no> - 2025-06-26 15:57 +0200
    Re: "A diagram of C23 basic types" Richard Heathfield <rjh@cpax.org.uk> - 2025-06-26 16:10 +0100
  Re: "A diagram of C23 basic types" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-06-26 12:31 -0700
    Re: "A diagram of C23 basic types" Michael S <already5chosen@yahoo.com> - 2025-06-26 23:59 +0300
      Re: "A diagram of C23 basic types" scott@slp53.sl.home (Scott Lurndal) - 2025-06-26 21:09 +0000
        Re: "A diagram of C23 basic types" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-06-26 17:10 -0700
          Re: "A diagram of C23 basic types" Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-27 04:33 +0200
            Re: "A diagram of C23 basic types" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-06-27 17:56 -0700
              Re: "A diagram of C23 basic types" Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-29 05:03 +0200
                Re: "A diagram of C23 basic types" James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-06-28 23:18 -0400
                Re: "A diagram of C23 basic types" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-06-28 20:37 -0700
                Re: "A diagram of C23 basic types" Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-29 20:48 +0200
                Re: "A diagram of C23 basic types" James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-06-30 21:59 -0400
                Re: "A diagram of C23 basic types" Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-06-28 20:51 -0700
                Re: "A diagram of C23 basic types" Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-29 20:40 +0200
                Re: "A diagram of C23 basic types" - correction Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-29 20:52 +0200
                Re: "A diagram of C23 basic types" - correction "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-06-29 12:14 -0700
          Re: "A diagram of C23 basic types" scott@slp53.sl.home (Scott Lurndal) - 2025-06-27 14:02 +0000
        Re: "A diagram of C23 basic types" Michael S <already5chosen@yahoo.com> - 2025-06-27 14:52 +0300
          Re: "A diagram of C23 basic types" Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-06-27 20:48 +0200
          Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-06-28 23:59 +0000
            Re: "A diagram of C23 basic types" James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-06-29 09:23 -0400
              Re: "A diagram of C23 basic types" Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-29 00:56 +0000
                Re: "A diagram of C23 basic types" James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-07-29 21:13 -0400

csiph-web