comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst-u@mib.org>
Subject: Re: Financial Calculations in Ada
Date: Sun, 20 Jul 2008 19:32:52 -0700
Date: 2008-07-20T19:32:52-07:00	[thread overview]
Message-ID: <lnwsjgkluz.fsf@nuthaus.mib.org> (raw)
In-Reply-To: 860d1$4883ccd5$45490079$7570@KNOLOGY.NET

rd <162144@gmail.com> writes:
> 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 hit a brick wall more quickly than usual in that I couldn't
> figure out a good way to handle interest rates that might have
> a decimal value with more digits than my Money type, such as 7.125.
>
> Can anyone give me any tips on how to handle this sort of thing
> in Ada?

An interest rate isn't an amount of money, so don't use type Money to
represent it.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"



  reply	other threads:[~2008-07-21  2:32 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 [this message]
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
replies disabled

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