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 117,694 of 117,927   
   albert@spenarnc.xs4all.nl to All   
   Division on riscv   
   08 Nov 25 14:47:42   
   
   The division in ciforth was default symmetric. The motivation is that   
   SM/REM is a wrapper for the single instruction IDIV while floored   
   is more complicated.   
   Signed division has a speed advantage for modular arithmetic too.   
   [   
       Normalizing a remainder to the range  0 .. _m is easily done by   
      
       : _norm_-m  DUP 0< _m @ AND + ;   
      
       (Note that all constituents are assembler primitives, such that   
       they can be collated into one assembler word.)   
   ]   
      
   There are m modulo classes modulo m. Then it embarrasses mathematicians   
   that `` I1 @ m MOD ''   and `` I2 @ m MOD '' are not equal,   
   despite i1 and i2 having the same modulo class.   
   Symmetric division:   
   2 3 MOD .   
   2 OK   
   -1 3 MOD .   
   -1 OK   
      
   So gforth (at least 0.7.3) avoids this   
   2 3 MOD . 2  ok   
   -1 3 MOD . 2  ok   
      
   I planned to introduce to change from symmetric division to floored   
   division at version 6 of ciforth (it warrants a   
   major version change from 5 to 6).   
   However the riscv situation is unclear.   
      
   The document I have of the RISCV instruction set doesn't specify   
   symmetric or floored division for the DIV instruction, either way!   
   Experimentation shows that for my boards (orange risc RV2 and Dongshan)   
   the DIV instruction is symmetric.   
      
   Note: instruction  set manuals for RISCV are hard to come by.   
   The official documents don't specify the bit pattern.   
   A question on stack-over-flow to ask for documentation about this was   
   shot down by the men-in-power at stack overflow. It got me fuming.   
   Instead of an absolute autoritive instruction manual for i86   
   by Intel, are there now competing, possibly incomplete manuals by   
   each supplier?   
      
   So should I continue with changing from symmetric to floored?   
      
   Groetjes Albert   
   --   
   The Chinese government is satisfied with its military superiority over USA.   
   The next 5 year plan has as primary goal to advance life expectancy   
   over 80 years, like Western Europe.   
      
   --- 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