From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9e77901cfcd37ea X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!gnilink.net!wn14feed!worldnet.att.net!attbi_s51.POSTED!53ab2750!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: altering number of significant figures References: <4158fd82@dnews.tpgi.com.au> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 24.6.132.82 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s51 1096353699 24.6.132.82 (Tue, 28 Sep 2004 06:41:39 GMT) NNTP-Posting-Date: Tue, 28 Sep 2004 06:41:39 GMT Organization: Comcast Online Date: Tue, 28 Sep 2004 06:41:39 GMT Xref: g2news1.google.com comp.lang.ada:4307 Date: 2004-09-28T06:41:39+00:00 List-Id: > myfloat : float := 1234.5678; > screen_display("value = " & float'image(myfloat)); >The above will print "value = 1234.5678". However I want "value = 1234.56". I presume you actually want it rounded, not truncated. You can use Ada.Text_IO.Float_IO to make a string, with full control over total length, digits after the point, and E exponent notation. Another option is type Two_Aft_Digits is delta 0.01 range ... screen_display("value = " & Two_Aft_Digits'image(Two_Aft_Digits(myfloat)));