comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: altering number of significant figures
Date: Tue, 28 Sep 2004 08:51:59 +0200
Date: 2004-09-28T08:51:59+02:00	[thread overview]
Message-ID: <2252146.BIGUFPfHef@linux1.krischik.com> (raw)
In-Reply-To: 4158fd82@dnews.tpgi.com.au

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




  parent reply	other threads:[~2004-09-28  6:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-28  5:59 altering number of significant figures David Peterson
2004-09-28  6:41 ` tmoran
2004-09-28  6:51 ` Martin Krischik [this message]
2004-09-28 17:58 ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2004-09-28  6:52 Christoph Karl Walter Grein
2004-09-28 10:26 ` David Peterson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox