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


Groups > comp.lang.forth > #135696

Re: ddfloat library: the behavior of >dd

Date Mon, 14 Sep 2026 20:00:47 +1000
MIME-Version 1.0
User-Agent Mozilla Thunderbird
Subject Re: ddfloat library: the behavior of >dd
Newsgroups comp.lang.forth
References <117uplc$160ff$1@dont-email.me> <6aa3648f$1@news.ausics.net> <1180jpe$16qki$1@dont-email.me> <1181v83$17dme$1@dont-email.me> <11829tr$3chqi$1@dont-email.me> <11833g2$1818h$1@dont-email.me> <6aa549e4$1@news.ausics.net> <6aa58871$1@news.ausics.net> <1185hme$195e1$1@dont-email.me> <6aa769c9$1@news.ausics.net> <1188a3t$2v3j3$1@dont-email.me>
Content-Language en-GB
From dxf <dxforth@gmail.com>
In-Reply-To <1188a3t$2v3j3$1@dont-email.me>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
NNTP-Posting-Host news.ausics.net
Message-ID <6aa7c5cf$1@news.ausics.net> (permalink)
Organization Ausics - https://newsgroups.ausics.net
Lines 44
X-Complaints abuse@ausics.net
Path csiph.com!news.bbs.nz!news.ausics.net!not-for-mail
Xref csiph.com comp.lang.forth:135696

Show key headers only | View raw


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>
;

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