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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,18f7f6e041b3e0bf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-16 08:47:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.stealth.net!news.stealth.net!news-out.nuthinbutnews.com!propagator-sterling!news-in.nuthinbutnews.com!feed.cgocable.net!read2.cgocable.net.POSTED!53ab2750!not-for-mail Message-ID: <3D5D1EA5.1040406@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020618 Netscape/7.0b1 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Information Systems Annex (usefulness of Decimal Floats) References: <5ee5b646.0208150126.ac9f65e@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 16 Aug 2002 11:47:49 -0400 NNTP-Posting-Host: 24.150.168.167 X-Complaints-To: abuse@cogeco.ca X-Trace: read2.cgocable.net 1029512938 24.150.168.167 (Fri, 16 Aug 2002 11:48:58 EDT) NNTP-Posting-Date: Fri, 16 Aug 2002 11:48:58 EDT Organization: Cogeco Cable Xref: archiver1.google.com comp.lang.ada:28115 Date: 2002-08-16T11:47:49-04:00 List-Id: Robert Dewar wrote: > "Robert C. Leif" wrote in message news:... > >>Ada decimal types (as currently defined) are fixed-point >>types. >> >>Are you asking for decimal floating-point? > > Decimal floating-point would be quite useless in financial > applications as far as I can see (COBOL does not have this > facility). "Useless" is extreme. There are situations where decimal floating point is useful in computing financial values, but normally as intermediate results. The final values of financial calculations are obviously stored in fixed point. Currency conversions are often performed in floating point decimal since the currencies move all over the map in relative terms in terms of scale. As long as the precision is maintained in the intermediate results, and that you properly anticipate the resulting scale and precision, the use of decimal floats as intermediates work well, with the final results being stored in a fixed point decimal form. One recent example of this, was the Euro conversion, where we had to do those triangulation computations (three currencies were involved). You have a broad range of values between British pound and the Turkish Lira, for example. For smaller numbers you might still cry foul, but when you're computing the asset value of fund or fund(s) or management company(ies), you run into larger numbers ;-) Again of course, you _could_ structure your computations such that you don't need decimal floats, but this requires extreme care and good testing (something you don't often get from junior programmers - but that is a different issue ;-). So often it is just easier and safer to use decimal floats provided that the necessary precision is maintained. As a side note I should mention that in C/C++ code, floating point decimal is really the only other choice to binary floating point values. Database vendors INFORMIX and ORACLE for example, provide routines for decimal floating point computations (but not for fixed point). -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg