comp.lang.ada
 help / color / mirror / Atom feed
* fixed type (delta) in ada
@ 1999-11-27  0:00 Nap
  1999-11-26  0:00 ` Al Christians
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Nap @ 1999-11-27  0:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~1999-11-30  0:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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
1999-11-28  0:00 ` Nick Roberts
1999-11-30  0:00   ` Simon Wright

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