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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: altering number of significant figures Date: Tue, 28 Sep 2004 08:51:59 +0200 Organization: AdaCL Message-ID: <2252146.BIGUFPfHef@linux1.krischik.com> References: <4158fd82@dnews.tpgi.com.au> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1096354694 02 24119 2Z4jX9VLqs2Hraj 040928 06:58:14 X-Complaints-To: usenet-abuse@t-online.de X-ID: rqnwKYZVoeX+sUbhsMj6jGAWvr1u-n+XVp3FRFr4QLU0eDpGvv3UUA User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:4310 Date: 2004-09-28T08:51:59+02:00 List-Id: David Peterson wrote: > Hi, sorry for this stupid question, but i can not seem to find out how to > do it. Suppose i define: > > > myfloat : float := 1234.5678; > screen_display("value = " & float'image(myfloat)); > > > ... where screen_display() prints out the content passed to it, to > standard output. > > However I do not know how to only print only the first 2 (for example) > decimal places of myfloat. > > The above will print "value = 1234.5678". However I want "value = > 1234.56". > > I know there is a simple solution to this, but i cant find it. Using > Barnes to learn from. The answer is: Ada.Text_IO.Float_IO It's quite straight foreward - The only supprise is that Fload_IO is embedded in Ada.Text_IO and not separate. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com