In article ,   
   dxf wrote:   
   >On 15/04/2025 12:14 am, Hans Bezemer wrote:   
   >> ...   
   >> BTW, the standard (section A.12.3.7, A.12.6.1.0558, 12.3.7) requires the   
   trailing E.   
   >>   
   >> As far as the embedded decimal point goes:   
   >>   
   >> "The Technical Committee has more than once received the suggestion that   
   the text interpreter in Standard Forth systems should treat numbers that have   
   an embedded decimal   
   >point, but no exponent, as floating-point numbers rather than double cell   
   numbers. This suggestion, although it has merit, has always been voted down   
   because it would break   
   >too much existing code; many existing implementations put the full digit   
   string on the stack as a double number and use other means to inform the   
   application of the location   
   >of the decimal point."   
   >>   
   >> In short: !!WE DON'T WANNA BREAK EXISTING CODE!!   
   >>   
   >> On the other hand, "TC reply to Q0004":   
   >>   
   >> Q: Will a number with an *embedded* decimal point be converted to a   
   double-cell number in a Standard Forth system?   
   >>   
   >> A: Not necessarily. A Standard System is permitted, *but not required,* to   
   convert digit strings with embedded periods as double numbers. Consequently, a   
   Standard Program   
   >cannot rely on any particular interpretation of such digit strings.   
   >   
   >AFAIR Forth-83 and prior never specified what form a double number should   
   take i.e.   
   >there was no 'standard code' to break. One could say Forth-94 was setting a   
   standard   
   >where none previously existed.   
   >   
      
   The best solution is to require an exponent sign, different from E.   
   An environment font of hex numbers, should not standardize this E.   
      
   A _ or ~ would be ideal.   
      
   Now the rule becomes a string containing an exponent sign would be fp.   
   Full stop.   
      
   1~0 2~0 F+ FS.   
   or   
   1_0 2_0 F+ FS. \ algol 68 compatible.   
      
   The exponent 0 can be ommitted:   
   1_ 2_ F+ FS. 3.0000000000000000000_   
      
   This can solve another unpleasantness.   
   Now most printed fp numbers would be read in as a double.   
   With _/~ you can print numbers like   
   567.123~   
   and read in just the same.   
      
   It can be upwards compatible, having all legacy shit intact.   
   In hex fp now can be transferred in ascii .   
   This is one headache less. I admit that at Shell, the fp   
   numbers the geology simulation get from the ai boys analysing   
   the drill specimens, precision was not a problem.   
   (transfer from lisp to c to FORTRAN.)   
      
   Groetjes Albert   
   --   
   Temu exploits Christians: (Disclaimer, only 10 apostles)   
   Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall   
   Art For Home, Office And Garden Decor - Perfect For Windows, Bars,   
   And Gifts For Friends Family And Colleagues.   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|