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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,560b069fa82486f6 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!t-online.de!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Wiktor Moskwa Newsgroups: comp.lang.ada Subject: Re: Rounding with decimal types Date: Mon, 26 Nov 2007 08:15:02 +0000 (UTC) Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <13kjevsjmhujaa3@corp.supernews.com> NNTP-Posting-Host: aafr27.neoplus.adsl.tpnet.pl X-Trace: nemesis.news.tpi.pl 1196064902 26253 83.4.147.27 (26 Nov 2007 08:15:02 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Mon, 26 Nov 2007 08:15:02 +0000 (UTC) User-Agent: slrn/0.9.8.1 (Linux) Xref: g2news1.google.com comp.lang.ada:18621 Date: 2007-11-26T08:15:02+00:00 List-Id: On 25.11.2007, Dennis Lee Bieber wrote: > On Sun, 25 Nov 2007 15:36:39 +0000 (UTC), Wiktor Moskwa > declaimed the following in comp.lang.ada: > >> The problem that I'm trying to solve is what type is best suited >> for financial arithmetic and money representation. >> > For this, I'd suggest you define your data type to carry at least > one decimal place more significance than the monetary unit normally > supports. That gives you a guard digit on which to apply your own > rounding algorithm for display (you should probably NOT round values > that will be used for continued computation -- only round the display > representation). Hi Dennis, Thanks for your hint but I'm only trying to use a tool which is decimal type in Ada. Guard digit and extended precision would be a good idea if we needed the best possible accuracy but if the process of computation is well defined including what method of rounding to use in which step, extra precision would be erroneus. I'd like to know if there is "round up" and "unbiased rounding" implemented for decimal types in Ada and if not, how "is it usually done"? Thank you. -- Wiktor Moskwa