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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7cda96e9413b780c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-16 21:41:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn4feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: RE: Floating Decimal Package/Library? References: X-Newsreader: Tom's custom newsreader Message-ID: <6A6Z8.32985$Wt3.29013@rwcrnsc53> NNTP-Posting-Host: 12.234.12.135 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1026880898 12.234.12.135 (Wed, 17 Jul 2002 04:41:38 GMT) NNTP-Posting-Date: Wed, 17 Jul 2002 04:41:38 GMT Organization: AT&T Broadband Date: Wed, 17 Jul 2002 04:41:38 GMT Xref: archiver1.google.com comp.lang.ada:27176 Date: 2002-07-17T04:41:38+00:00 List-Id: > 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.