comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Financial Calculations in Ada
Date: Mon, 21 Jul 2008 10:30:40 +0200
Date: 2008-07-21T10:30:40+02:00	[thread overview]
Message-ID: <48844930$0$7538$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <e219b06b-2977-4f96-83ee-14507a25db49@t54g2000hsg.googlegroups.com>

Graham Stark schrieb:
> On Jul 21, 12:27 am, rd <162...@gmail.com> wrote:
>> I'm playing around some with Ada, and today started with the
>> intent of cooking up a crappy mortgage calculator.  I did the
>> obvious:
>>
>>      type Money is delta 0.01 digits 12;
>>      package MIO is new Ada.Text_IO.Decimal_IO (Money); use MIO;


> I've been doing something similar. I would use float types if you can,
> not least because the root-finding algorithms you'll have to use
> probably won't work with discrete types. As someone else mentioned,
> financial institutions will have policies on exactly where and how
> money amounts are rounded, but it's unlikely you'll capture that just
> by relying on a Decimal type.


Also, consider using different types for different things,
e.g. Money for display, database tables, bank accounts, ... ,
and user defined floats or decimals for tax rates, and again
other (sub)types for interest rates and calculations reflecting
above mentioned policies.



--
Georg Bauhaus
Y A Time Drain  http://www.9toX.de



      reply	other threads:[~2008-07-21  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-20 23:27 Financial Calculations in Ada rd
2008-07-21  2:32 ` Keith Thompson
2008-07-21  5:11   ` tmoran
2008-07-21  4:46 ` Gautier
2008-07-21  8:24 ` Graham Stark
2008-07-21  8:30   ` Georg Bauhaus [this message]
replies disabled

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