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,329 of 117,927   
   Krishna Myneni to Anton Ertl   
   Re: D! and D@   
   22 Mar 24 15:13:28   
   
   From: krishna.myneni@ccreweb.org   
      
   On 3/22/24 12:08, Anton Ertl wrote:   
   > Krishna Myneni  writes:   
   >> In the Forth 2012 standard, and in prior standards, the representation   
   >> of double numbers on the stack seems to be allowed to be implementation   
   >> defined.   
   >   
   > No, the standard defines it:   
   >   
   > |3.1.4.1 Double-cell integers   
   > |   
   > |On the stack, the cell containing the most significant part of a   
   > |double-cell integer shall be above the cell containing the least   
   > |significant part.   
   >   
      
   Ok. I did not look in the earlier part of the standard, only the section   
   dealing with the double number word set.   
      
   >> Thus, on a 32-bit system, the stack order of a 64 bit double   
   >> number, the standard does not specify whether the high 32 bits of the   
   >> number are on top of the stack or the low 32 bits.   
   >   
   > But it does.   
   >   
   ...   
      
   >   
   >> More generally, the problem with the double number word set is that it   
   >> attempts to use the same word set for two different types:   
   >>   
   >> 1) pairs of cell length numbers   
   >> 2) double length integers   
   >   
   > Standard Forth has the 2... words that work for any pairs of cells,   
   > whether they represent double numbers or something else.  The   
   > double-number wordset includes some of these words.  Standard Forth   
   > also has D... words for dealing with double-cell numbers.  All these   
   > words are in the DOUBLE or DOUBLE EXT wordset.   
   >   
      
   Yes, 2! and 2@ words work, but as I've pointed out, the storage for   
   double length numbers isn't consistent with the expected native storage   
   on a little endian system in which the stack grows towards lower   
   addresses. The 2! and 2@ words are better suited for dealing with pairs   
   of cell length numbers.   
      
   >> It would be better to separate the words for these two types, the latter   
   >> having prefix of "D" and the former having prefix "2".   
   >   
   > So what would you do with the 2... words that are in the DOUBLE or   
   > DOUBLE EXT wordset?   
   >   
      
   I would place the 2... words into the Core Extensions word set.   
      
   --- 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