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,701 of 117,927   
   Anton Ertl to albert@spenarnc.xs4all.nl   
   Re: Division on riscv   
   11 Nov 25 08:00:23   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   albert@spenarnc.xs4all.nl writes:   
   >I don't like it that a simple program   
   >ported from ciforth versus gforth or vice versa stops working because   
   >of floored/symmetric.   
      
   Do you have such programs?   
      
   If you implement floored in ciforth, you will have the same problem   
   when running such programs on a Forth system where /, MOD etc. are   
   symmetric.   
      
   A way to deal with that may be to use a checking /, MOD etc., and   
   replace occurences where the check reports problems with FM/MOD (or   
   SM/REM where that is desired).  E.g.:   
      
   : / ( n1 n2 -- n )   
     2dup xor 0< if \ there may be a difference between floored and symmetric   
       /mod swap abort" there is a difference between floored and symmetric"   
     else   
       /   
     then ;   
      
   : foo / ;   
      
   7 3 foo  ok 1   
   . 2  ok   
   -6 2 foo  ok 1   
   . -3  ok   
   -7 2 foo   
   *the terminal*:13:6: error: there is a difference between floored and symmetric   
   -7 2 >>>foo<<<   
      
   In Gforth the backtrace resulting from the abort" tells me the   
   location of the / that had the problematic parameters, so you can   
   decide whether you want to use FM/MOD or SM/REM there (or maybe   
   the Gforth-specific /F or /S).   
      
   - anton   
   --   
   M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html   
   comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html   
        New standard: https://forth-standard.org/   
   EuroForth 2025 CFP: http://www.euroforth.org/ef25/cfp.html   
   EuroForth 2025 registration: https://euro.theforth.net/   
      
   --- 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