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


Groups > comp.lang.forth > #135697

Re: ddfloat library: the behavior of >dd

From marcel hendrix <mhx@iae.nl>
Newsgroups comp.lang.forth
Subject Re: ddfloat library: the behavior of >dd
Date 2026-09-14 12:22 +0200
Organization A noiseless patient Spider
Message-ID <1188htd$2vabu$1@dont-email.me> (permalink)
References (7 earlier) <6aa58871$1@news.ausics.net> <1185hme$195e1$1@dont-email.me> <6aa769c9$1@news.ausics.net> <1188a3t$2v3j3$1@dont-email.me> <6aa7c5cf$1@news.ausics.net>

Show all headers | View raw


On 9/14/2026 12:00 PM, dxf wrote:
> On 14/09/2026 6:09 pm, marcel hendrix wrote:
>> On 9/14/2026 5:28 AM, dxf wrote:
>>> On 13/09/2026 5:00 pm, marcel hendrix wrote:
>>>> ...
>>>> My interest is only in >DD . I now allow the exponent range [-294,+304] (this gives a reasonable mantissa size, e.g.
>>>> FORTH> s" 1000.0e+304  " >dd ddfe.  1.000000000000000000000000000000e307
>>>
>>> How did you get that?  NORMALIZE (even if it doesn't hang) will cause
>>> 1e307 to be converted to NAN NAN and extracting digits from that will
>>> result in a string of '0's.
>>
>> Slightly dirty...: normalize ( F: x xx -- |y + yy| ) ( n -- n' ) ddabs                   ( F: -- |x + xx| )
>>          DUP  dd=10 dd^n  dd/    ( F: -- [|x+xx|]/10^n ) ( -- n )
>>          BEGIN   FOVER 10e F>=    \ make sure it's between 1 and 10
>>          WHILE   dd=10 dd/  1+
>>          REPEAT
>>          BEGIN   FOVER 1e F<    \ make sure it's between 1 and 10
>>          WHILE   dd=10 dd*  1-
>>          REPEAT ;
> 
> That was enough to cause mine to go into a loop (see below).  It was
> essentially the change I made in 2012 unaware I was introducing an issue.
> I'm using x87 with software stack.  Ran it on Gforth (SSE?) and that goes
> into a loop too.
> 
> 
> dd# 1e300 dd# 1e7 dd* ok  1.00000000000002E307 1.39689402397438E290 <f
> ddfs.  \ hangs!
> 
> 
> : normalize ( F: x xx -- |y yy| ) ( n -- n' )
>      >R
>      DDABS
>      dd10 R@ DD^N  DD/          ( [|x|+|xx|]/10^n )
> 
>    \ make sure it's between 1 and 10
>      BEGIN   FOVER   10e0  F< 0=  \ F>
>      WHILE   dd10  dd/  R> 1+ >R  REPEAT
> 
>      BEGIN   FOVER   1e0   F<
>      WHILE   dd10  dd*  R> 1- >R  REPEAT
>      R>
> ;

Interesting. The way it is written, iForth will execute `FOVER   10e0 
F< 0=` and `FOVER 1e0 F<` on the FPU stack with the full 80 bits. (the 
CPU is in 53-bit mode here, which affects the loading of 10e0 as a 10 
byte constant).

I made a few tiny changes to the basic dd-fp words that gave me a
few more valid bits (as seen with the library tests), maybe that is the 
reason.

Try insert .S before 10e0 and 1e0 to see what's happening?

-marcel

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


Thread

ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-10 19:33 +0200
  Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-10 13:35 -0500
    Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-10 22:10 +0200
      Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-10 16:51 -0500
  Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-11 12:16 +1000
    Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-11 12:05 +0200
      Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-12 00:27 +0200
        Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-11 20:29 -0500
          Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-12 12:02 +1000
            Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-12 10:24 -0500
          Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-12 10:45 +0200
            Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-12 19:51 +1000
            Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-12 22:47 +1000
              Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-13 03:14 +1000
                Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-12 13:02 -0500
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-13 15:44 +1000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-13 09:00 +0200
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-13 20:33 +1000
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-14 13:28 +1000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-14 10:09 +0200
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-14 20:00 +1000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-14 12:22 +0200
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-14 21:59 +1000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-14 14:26 +0200
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-15 01:32 +1000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-14 21:08 +0200
                Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-14 15:25 -0500
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-15 13:11 +1000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-15 14:06 +0200
                Re: ddfloat library: the behavior of >dd dxf <dxforth@gmail.com> - 2026-09-16 00:05 +1000
                Re: ddfloat library: the behavior of >dd anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-09-14 15:00 +0000
                Re: ddfloat library: the behavior of >dd marcel hendrix <mhx@iae.nl> - 2026-09-14 21:15 +0200
                Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-14 15:29 -0500
                Re: ddfloat library: the behavior of >dd anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-09-14 20:58 +0000
                Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-15 07:33 -0500
                Re: ddfloat library: the behavior of >dd anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-09-15 15:53 +0000
                Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-15 15:23 -0500
                Re: ddfloat library: the behavior of >dd Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-15 17:53 -0500

csiph-web