comp.lang.ada
 help / color / mirror / Atom feed
From: Al Christians <achrist@easystreet.com>
Subject: Re: fixed type (delta) in ada
Date: 1999/11/27
Date: 1999-11-27T00:00:00+00:00	[thread overview]
Message-ID: <38409C87.69EC865@easystreet.com> (raw)
In-Reply-To: 81pvi5$sl1$1@nnrp1.deja.com



Robert Dewar wrote:
> 
> In article <383f6dbb.22609744@news.tstonramp.com>,
>   nap@nobody.com (Nap) wrote:
> > does anyone know why mutiplication between fixed type in ada
> produce a
> > big round off error?
> >
> > type money is delta 0.01 range 0.0..100_000_000.00;
> > a, b, c : money;
> >
> > package money_io is new ada.text_io.fixed_io(money);
> >
> > a := 351.00;
> > b := 0.20;
> > c := a * b;
> >
> > money_io.put(c);
> >
> > -- the output should be 70.2 but it prints 71.3 instead.
> > -- this is so frustrating. typecasting (back to float) doesn't
> help
> > either.
> 
> No, the output should be 71.3, and this is what is expected. 

So, why does GNAT 3.12p give 68.55?


Al




  reply	other threads:[~1999-11-27  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-27  0:00 fixed type (delta) in ada Nap
1999-11-26  0:00 ` Al Christians
1999-11-27  0:00   ` fixed type (delta) in ada and GNAT bug David C. Hoos, Sr.
1999-11-28  0:00 ` fixed type (delta) in ada Nick Roberts
1999-11-30  0:00   ` Simon Wright
1999-11-28  0:00 ` Robert Dewar
1999-11-27  0:00   ` Al Christians [this message]
1999-11-28  0:00     ` Preben Randhol
1999-11-28  0:00     ` Florian Weimer
1999-11-28  0:00       ` Al Christians
1999-11-29  0:00         ` Preben Randhol
1999-11-29  0:00           ` Al Christians
1999-11-29  0:00             ` Preben Randhol
1999-11-29  0:00     ` Robert Dewar
1999-11-29  0:00       ` Al Christians
1999-11-29  0:00         ` Lutz Donnerhacke
1999-11-29  0:00           ` Preben Randhol
replies disabled

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