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


Groups > comp.lang.forth > #135264

Re: kForth-Win32 fix for decimal string to double float conversion

From peter <peter.noreply@tin.it>
Newsgroups comp.lang.forth
Subject Re: kForth-Win32 fix for decimal string to double float conversion
Date 2026-07-25 17:07 +0200
Organization A noiseless patient Spider
Message-ID <20260725170716.00005ebb@tin.it> (permalink)
References <113lcfk$18opt$1@dont-email.me> <nnd$10021294$12a53193@9ed426c01832dcf1> <113nkmm$1u1in$1@dont-email.me> <nnd$245e5ae0$2ade0865@74903abd065dd450>

Show all headers | View raw


On Sat, 25 Jul 2026 16:08:35 +0200
albert@SPENARNC.XS4ALL.NL wrote:

> Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
> > On 7/21/26 04:40, albert@SPENARNC.XS4ALL.NL wrote:
> >> Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
> > ...
> >>>
> >>> Using double number arithmetic on a 64-bit Forth system, you may easily
> >>> verify that the correct round to nearest representable floating point
> >>> value is the one represented by the binary pattern 3ff00000 00000001 ,
> >>> rather than to the exactly representable value of 1.000.... (pattern
> >>> 3ff00000 00000000):
> >>
> >> If a number contains an exponent character, denoting a floating point,
> >> I convert this floating point number from the end. This had nothing
> >> to do with 32/64 bit system as it runs in the floating point 8087.
> >> In this case I remember the exponent first.
> >> start with 0,
> >> add 1 , divide by 10
> >> add 5 , 5 divide by 10
> >> ..
> >> decimal point, remember the place.
> >>
> >> The initial floating point number is 1/10 , the rounding mode
> >> doesn't matter much, because a host of larger numbers have been added.
> >>
> >>   1.000000000000000111022302462515654042363166809082031251E0 FS.
> >>   1.000000000000000110E0
> >>
> > ...
> >
> > I think you misunderstood the referenced paragraph. It has to do with
> > checking the conversion to see which of the adjacent representable
> > double precision numbers is the nearest one when the rounding mode is
> > set to nearest. It is possible to do this with integer arithmetic but
> > one needs double length 64-bit cell numbers to do it for the examples
> > given above.
> 
> If you set rounding mode to nearest, you expect to get the
> nearest result ???
> 
> Default is round to nearest.
> If you start at the end with the conversion all the intermediate results
> are round to nearest.
> You process 60 digits and shift 40 digits into oblivion.
> The last digit is 1. If this is the 60th decimal it is divided by 10 sixty
> times. There is nothing left of the poor 1, let alone of its rounding
> errors.
> 
> I think there is no need to check the end result with my method,
> unless I'm thoroughly mistaken.
> 
> Groetjes Albert
> 
> P.S.
> I do not buy that 10e100 FSIN becomes any better if you do the
> range reduction with utmost precision.
> 
so what do you get for 10e100 fsin ?

In my system I get: (using 64 bit floats)

10e100 fsin f.  0.995717064571709700

or to avoid the conversion to decimal

10e100 fsin fh.  0x1.FDCEA088CF298p-1


BR
Peter

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


Thread

kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-20 09:48 -0500
  Re: kForth-Win32 fix for decimal string to double float conversion albert@SPENARNC.XS4ALL.NL - 2026-07-21 11:40 +0200
    Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-21 06:20 -0500
      Re: kForth-Win32 fix for decimal string to double float conversion albert@SPENARNC.XS4ALL.NL - 2026-07-25 16:08 +0200
        Re: kForth-Win32 fix for decimal string to double float conversion peter <peter.noreply@tin.it> - 2026-07-25 17:07 +0200
          Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-25 13:22 -0500
            Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-25 13:30 -0500
        Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-25 13:17 -0500
          Re: kForth-Win32 fix for decimal string to double float conversion dxf <dxforth@gmail.com> - 2026-07-26 13:15 +1000
            Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-26 07:18 -0500
              Re: kForth-Win32 fix for decimal string to double float conversion dxf <dxforth@gmail.com> - 2026-07-31 14:54 +1000
                Re: kForth-Win32 fix for decimal string to double float conversion anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-07-31 08:35 +0000
                Re: kForth-Win32 fix for decimal string to double float conversion albert@spenarnc.xs4all.nl - 2026-07-31 12:05 +0200
                Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-31 07:54 -0500
                Re: kForth-Win32 fix for decimal string to double float conversion anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-07-31 16:55 +0000
                Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-31 14:40 -0500
                Re: kForth-Win32 fix for decimal string to double float conversion anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-01 08:23 +0000
                Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-01 06:42 -0500
    Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-21 11:30 -0500
      Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-21 14:47 -0500
  Re: kForth-Win32 fix for decimal string to double float conversion albert@SPENARNC.XS4ALL.NL - 2026-07-25 23:42 +0200
    Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-25 18:47 -0500
      Re: kForth-Win32 fix for decimal string to double float conversion albert@SPENARNC.XS4ALL.NL - 2026-07-26 13:11 +0200
  Re: kForth-Win32 fix for decimal string to double float conversion albert@SPENARNC.XS4ALL.NL - 2026-07-26 13:22 +0200
    Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-26 07:23 -0500
      Re: kForth-Win32 fix for decimal string to double float conversion albert@SPENARNC.XS4ALL.NL - 2026-07-26 20:13 +0200
        Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-07-27 12:20 -0500
  Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-11 07:24 -0500
  Re: kForth-Win32 fix for decimal string to double float conversion Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-24 18:55 -0500

csiph-web