home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.rexx
- 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
- From: anders@lise1.lise.unit.no (Anders Christensen)
- Subject: Rounding twice in format()
- Message-ID: <ANDERS.92Dec13213633@lise1.lise.unit.no>
- Sender: news@ugle.unit.no (NetNews Administrator)
- Organization: University of Trondheim, Norway
- Distribution: comp
- Date: 13 Dec 92 21:36:33
- Lines: 16
-
- In some cases, TRL requires built-in function format() to round
- numbers twice, which may result in confusing output.
-
- The following piece of code demonstrates the problem (notice the last
- digit of the output in the third line):
-
- say format( '1.0000045',, 5 ) /* says 1.00000 */
- say format( '1.00000045',, 6 ) /* says 1.000000 */
- say format( '1.000000045',, 7 ) /* says 1.0000001 */
- say format( '1.0000000045',, 8 ) /* says 1.00000000 */
- say format( '1.00000000045',, 9 ) /* says 1.000000000 */
-
- Is it a bug or an intended feature? (Or maybe is it just what I
- should expect when working too close to the setting of digits() :-)
-
- -anders
-