comp.lang.ada
 help / color / mirror / Atom feed
From: "Christoph Karl Walter Grein" <AdaMagica@web.de>
To: comp.lang.ada@ada-france.org
Subject: Re: altering number of significant figures
Date: Tue, 28 Sep 2004 08:52:29 +0200
Date: 2004-09-28T08:52:29+02:00	[thread overview]
Message-ID: <mailman.120.1096354364.390.comp.lang.ada@ada-france.org> (raw)

>    myfloat : float := 1234.5678;
>    screen_display("value = " & float'image(myfloat));

> 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".

Look at RM A.10.1 (67) procedure Put to a String. There you can choose the format (digits before and after the dot, exponential digits). This rounds (1234.57).

If you really want 1234.56, you have to use the 'Floor attribute (RM K(74)).
________________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193




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

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

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