home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / rexx / 1408 < prev    next >
Encoding:
Text File  |  1992-12-13  |  1.2 KB  |  28 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!wupost!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!ugle.unit.no!ugle!anders
  3. From: anders@lise1.lise.unit.no (Anders Christensen)
  4. Subject: Rounding twice in format()
  5. Message-ID: <ANDERS.92Dec13213633@lise1.lise.unit.no>
  6. Sender: news@ugle.unit.no (NetNews Administrator)
  7. Organization: University of Trondheim, Norway
  8. Distribution: comp
  9. Date: 13 Dec 92 21:36:33
  10. Lines: 16
  11.  
  12. In some cases, TRL requires built-in function format() to round
  13. numbers twice, which may result in confusing output. 
  14.  
  15. The following piece of code demonstrates the problem (notice the last
  16. digit of the output in the third line):
  17.  
  18.    say format( '1.0000045',, 5 )      /* says  1.00000  */
  19.    say format( '1.00000045',, 6 )     /* says  1.000000  */
  20.    say format( '1.000000045',, 7 )    /* says  1.0000001  */
  21.    say format( '1.0000000045',, 8 )   /* says  1.00000000  */
  22.    say format( '1.00000000045',, 9 )  /* says  1.000000000  */
  23.  
  24. Is it a bug or an intended feature?  (Or maybe is it just what I
  25. should expect when working too close to the setting of digits() :-) 
  26.  
  27. -anders
  28.