comp.lang.ada
 help / color / mirror / Atom feed
From: nap@nobody.com (Nap)
Subject: fixed type (delta) in ada
Date: 1999/11/27
Date: 1999-11-27T00:00:00+00:00	[thread overview]
Message-ID: <383f6dbb.22609744@news.tstonramp.com> (raw)

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. 

Thanks,
Nap




             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 Nap [this message]
1999-11-26  0:00 ` fixed type (delta) in ada 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
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-28  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