From: tmoran@acm.org
Subject: RE: Floating Decimal Package/Library?
Date: Wed, 17 Jul 2002 04:41:38 GMT
Date: 2002-07-17T04:41:38+00:00 [thread overview]
Message-ID: <6A6Z8.32985$Wt3.29013@rwcrnsc53> (raw)
In-Reply-To: mailman.1026874442.25524.comp.lang.ada@ada.eu.org
> Since Turkish Lira have been mentioned, when one tries to directly
> calculate currency equivalents based on the exchange rate
Using Gnat, the program:
with Ada.Text_IO;
with Ada.Text_IO.Editing;
procedure Turk is
type Turkish is delta 0.01 digits 18;
type US is delta 0.01 digits 18;
package Turkish_Output is new Ada.Text_IO.Editing.Decimal_Output(Turkish);
package US_Output is new Ada.Text_IO.Editing.Decimal_Output(US);
Money_Pic: constant Ada.Text_IO.Editing.Picture
:= Ada.Text_IO.Editing.To_Picture("-$$_$$$_$$$_$$$_$$$_$$9.99");
Dollars : US := 3_300_000_000.00;
Lira : Turkish;
begin
Lira := Turkish(Dollars * 1097213.08);
Ada.Text_IO.Put_Line(US_Output.Image(Dollars, Money_Pic)
& Turkish_Output.Image(Lira, Money_Pic));
end Turk;
produced:
$3,300,000,000.00 $3,620,803,164,000,000.00
Perhaps the IMF's accounting department has a library to go higher, but
$3.3 billion should satisfy most of the rest of us.
> Again, I would prefer to use decimals for engineering and scientific
> calculations.
I agree for that you would want floating point decimal.
next prev parent reply other threads:[~2002-07-17 4:41 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-12 17:19 Floating Decimal Package/Library? Warren W. Gay VE3WWG
2002-07-12 22:58 ` Robert Wessel
2002-07-12 23:30 ` Dann Corbit
2002-07-15 13:34 ` Warren W. Gay VE3WWG
2002-07-16 5:04 ` Robert C. Leif
2002-07-16 7:01 ` tmoran
2002-07-16 15:50 ` Robert C. Leif
2002-07-17 1:24 ` tmoran
2002-07-17 2:53 ` Robert C. Leif
2002-07-17 4:41 ` tmoran [this message]
2002-07-17 16:30 ` Warren W. Gay VE3WWG
2002-07-17 22:09 ` tmoran
2002-07-29 17:05 ` Warren W. Gay VE3WWG
2002-07-29 17:41 ` tmoran
2002-07-30 8:58 ` Jean-Pierre Rosen
2002-07-30 16:20 ` John H. Lindsay
2002-07-16 16:32 ` Pascal Obry
2002-07-16 17:53 ` Warren W. Gay VE3WWG
2002-07-17 1:24 ` tmoran
2002-07-17 8:28 ` Vadim Godunko
2002-07-17 13:32 ` Warren W. Gay VE3WWG
2002-07-22 23:33 ` Robert I. Eachus
2002-07-23 13:16 ` Marin David Condic
2002-07-24 15:18 ` Darren New
2002-07-24 15:43 ` Hyman Rosen
2002-07-24 16:17 ` Fraser Wilson
2002-07-17 13:30 ` Warren W. Gay VE3WWG
2002-07-13 21:55 ` Björn Lundin
2002-07-15 13:37 ` Warren W. Gay VE3WWG
2002-07-17 21:56 ` Waldek Hebisch
2002-07-18 14:13 ` Robert C. Leif
2002-07-19 14:41 ` Waldek Hebisch
2002-07-19 17:29 ` Warren W. Gay VE3WWG
2002-07-19 21:50 ` Waldek Hebisch
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox