home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,516 of 117,927   
   Gerry Jackson to albert@spenarnc.xs4all.nl   
   Re: "Back & Forth" is back!   
   31 May 24 14:17:25   
   
   From: do-not-use@swldwa.uk   
      
   On 31/05/2024 10:23, albert@spenarnc.xs4all.nl wrote:   
   > In article ,   
   > Gerry Jackson   wrote:   
   >> On 23/05/2024 12:14, albert@spenarnc.xs4all.nl wrote:   
   >>> And then 'u' . When was the last time you calculate a root between   
   >>> 8FFF,FFFF,FFFF,FFFF and FFFF,FFFF,FFFF,FFFF  ?   
   >>   
   >> You mean that you are happy that USQRT fails for half the integers   
   >> available to you. Anyway not everybody uses 64 bits.   
   >   
   > If you claim that it works for unsigned numbers, then you have to   
   > test for that. What happens to 0x8000 , a number where ABS doesn't   
   > work >   
      
   Given the definition I posted:   
      
   : usqrt ( u -- u1 )   
       dup 2 u< if exit then   
       dup >r 2 rshift recurse   
       2*                     ( -- u sm )   
       1+ dup                 ( -- u la la )   
       dup *                  ( -- u la la^2 )   
       r> u> if 1- then       ( -- u1 )   
      
      
   and using the 32 bit equivalent of your 16 bit $8000 on my 32 bit system   
      
   $80000000 usqrt . 46340  ok   
      
   which according to my calculator is the correct answer and which   
   disproves the points you make.   
      
    > I'm happier ignoring those case, than writing tests for them.   
    > Groetjes Albert   
      
   I'm happier to not have to ignore any cases   
      
   --   
   Gerry   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca