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


Groups > comp.lang.forth > #135439

Re: Make double numbers notation more strict

From peter <peter.noreply@tin.it>
Newsgroups comp.lang.forth
Subject Re: Make double numbers notation more strict
Date 2026-08-26 18:42 +0200
Organization A noiseless patient Spider
Message-ID <20260826184213.00006b6b@tin.it> (permalink)
References (2 earlier) <116js4d$3le16$1@dont-email.me> <nnd$6d306c76$0159a1e5@5ebe29de058d18a5> <nnd$0ec0070e$4366bebb@5ebe29de058d18a5> <116mtrp$3d9f8$2@paganini.bofh.team> <2026Aug26.172819@mips.complang.tuwien.ac.at>

Show all headers | View raw


On Wed, 26 Aug 2026 15:28:19 GMT
anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:

> antispam@fricas.org (Waldek Hebisch) writes:
> >Just a little comment: it is easy to input or output floating point
> >numbers in hexadecimal.  Advantage compared to decimal is that
> >input and output can be exact.
> 
> Decimal input and output can also be exact (for input you have to
> input a number that can be represented exactly as an FP number, but
> that's also the case with hex).  The difference is that the hex-base
> FP numbers are much shorter.  Never more than 14 hex digits in the
> mantissa of a binary64 number compared to up to 751 decimal digits.
> Also, as long as the exponent is in the range of normal numbers, every
> number of the form
> 
> 1.hhhhhhhhhhhhhp<exp>
> 
> can be represented exactly as FP number, while there are lots of even
> very short decimal numbers that cannot be represented exactly as FP
> number.
> 
> >But to allow this one either needs
> >separate hex float prefix or some other syntactic way to
> >distinguish them from double integers.
> 
> C99's %a conversion format for printf uses (in regexp syntax):
> 
>   -?0xh.h*[+-]d+
> 
> and I dimly remember that at least one Forth system also uses "p" to
> indicate the exponent of a hex float.

I use that in lxf64 (and also in lxf for 80 bit floats)
It is very useful for input of exact constants

1e-6 fh.  0x1.0C6F7A0B5ED8Dp-20  ok
0x1.0C6F7A0B5ED8Dp-20 e.  1e-6  ok

works for input and out put.

Peter

> - anton

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Make double numbers notation more strict albert@spenarnc.xs4all.nl - 2026-08-24 13:36 +0200
  Re: Make double numbers notation more strict anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-24 14:44 +0000
  Re: Make double numbers notation more strict Stephen Pelc <stephen@vfxforth.com> - 2026-08-24 16:57 +0000
  Re: Make double numbers notation more strict dxf <dxforth@gmail.com> - 2026-08-25 11:10 +1000
    Re: Make double numbers notation more strict Paul Rubin <no.email@nospam.invalid> - 2026-08-24 18:25 -0700
      Re: Make double numbers notation more strict dxf <dxforth@gmail.com> - 2026-08-25 14:44 +1000
    Re: Make double numbers notation more strict Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-24 20:51 -0500
      Re: Make double numbers notation more strict dxf <dxforth@gmail.com> - 2026-08-25 14:17 +1000
        Re: Make double numbers notation more strict Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-25 05:51 -0500
          Re: Make double numbers notation more strict dxf <dxforth@gmail.com> - 2026-08-25 21:20 +1000
            Re: Make double numbers notation more strict Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-25 10:41 -0500
              Re: Make double numbers notation more strict dxf <dxforth@gmail.com> - 2026-08-26 13:51 +1000
          Re: Make double numbers notation more strict albert@spenarnc.xs4all.nl - 2026-08-26 11:54 +0200
            Re: Make double numbers notation more strict albert@spenarnc.xs4all.nl - 2026-08-26 12:00 +0200
              Re: Make double numbers notation more strict antispam@fricas.org (Waldek Hebisch) - 2026-08-26 14:39 +0000
                Re: Make double numbers notation more strict anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-26 15:28 +0000
                Re: Make double numbers notation more strict peter <peter.noreply@tin.it> - 2026-08-26 18:42 +0200
                Re: Make double numbers notation more strict anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-26 17:04 +0000
                Re: Make double numbers notation more strict albert@spenarnc.xs4all.nl - 2026-08-27 12:43 +0200
        Re: Make double numbers notation more strict Hans Bezemer <the.beez.speaks@gmail.com> - 2026-08-26 09:12 +0200
    Re: Make double numbers notation more strict Hans Bezemer <the.beez.speaks@gmail.com> - 2026-08-26 09:15 +0200
  Re: Make double numbers notation more strict Hans Bezemer <the.beez.speaks@gmail.com> - 2026-08-26 09:09 +0200
    Re: Make double numbers notation more strict albert@spenarnc.xs4all.nl - 2026-08-26 12:22 +0200
      Re: Make double numbers notation more strict Hans Bezemer <the.beez.speaks@gmail.com> - 2026-08-26 19:40 +0200

csiph-web