comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <jacob@jacob-sparre.dk>
Subject: Re: A curiosity about decimal fixed point types...
Date: Tue, 12 Nov 2013 13:31:53 +0100
Date: 2013-11-12T13:31:53+01:00	[thread overview]
Message-ID: <87vbzxg5s6.fsf@adaheads.sparre-andersen.dk> (raw)
In-Reply-To: 7d4f2e0c-0aed-4ba3-aa5a-0c2bc0c2c5a0@googlegroups.com

Riccardo <framefritti@gmail.com> wrote:

>  type Euro is delta 0.01 digits 20;  
>  -- Would be 20 enough? :-)

Depends on your budget and your cash-flow.  For mine it is plenty.

> Are they currently used?

Yes.

> Where?

In 182 out of 119_391 Ada source files (including duplicates) on my laptop.

Reduced to unique type declarations, there is:

   type Decim is delta 0.1 digits 5;
   type Duration is delta 0.001 digits 9 range -24.0 * 3600.0 .. 48.0 * 3600.0;
   type Duration is delta 1.0 digits 9 range -24.0 * 3600.0 .. 48.0 * 3600.0;
   type Kroner is delta 0.01 digits 10;
   type Megabucks is delta 0.01 digits 15;
   type My_Float is delta 0.01 digits 10;
   type Percent is delta 0.01 digits 5 range 0.0 .. 100.0;
   type Push_Data_Type is delta 0.01 digits 7;
   type Real_Val_To_Print is delta 0.01 digits 8;

> Since most of the examples are about money (mine and RM's) included, I
> guess that they were thought for financial applications, but I am
> unsure if nowadays financial software uses this type of types or just
> floating point.

This indicates that they are used for a few more cases than just money
(2 of 9 are money types), but it appears that they aren't all that
common.

Greetings,

Jacob
-- 
"It's not a question of whose habitat it is,
 it's a question of how fast you hit it."


  parent reply	other threads:[~2013-11-12 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 15:04 A curiosity about decimal fixed point types mockturtle
2013-11-11 17:06 ` Mike H
2013-11-11 18:54 ` Oliver Kleinke
2013-11-11 19:58 ` AdaMagica
2013-11-12 12:31 ` Jacob Sparre Andersen [this message]
2013-11-14 13:12   ` Marius Amado-Alves
2013-11-14 14:20     ` gautier_niouzes
replies disabled

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