comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@dr_no.mitre.org (Robert I. Eachus)
Subject: Re: Membership in "set" of characters
Date: Mon, 22 Mar 1993 17:11:06 GMT
Date: 1993-03-22T17:11:06+00:00	[thread overview]
Message-ID: <EACHUS.93Mar22121106@dr_no.mitre.org> (raw)
In-Reply-To: dww@math.fu-berlin.de's message of Mon, 22 Mar 1993 12:22:49 GMT


    Just to avoid giving fixed point a bad name...

   > Just using 
   >   type DM is delta 0.01 range 0.0 .. 1000.0; 
   > gets me in trouble because the delta is a positive fraction
   > that causes rounding errors. I need
   >   for DM'small use 0.01;
   > to make it work as I expect, but I've been advised to leave FIXED
   > alone until I understand more about Ada :-) 

   The 'small clause may make things work the way that you expect
(assuming your compiler supports it).  In any case the ADAR packages
should help.  Fixed point arithmetic--independant of Ada--is hard,
however if you know how to use it you can and will get much more
accurate results than using floating point.  Floating point can be
easily used to give you an answer which is very close to correct,
fixed point allows you to always get the exact right answer, but is
much harder to use.  The trick is that you must at every point be
aware of the ACCURACY and PRECISION of the data--and be aware that
they are two different things.  When I am writing such code, I find
myself doing several passes looking at each operation to be sure I
know if and when any rounding, truncation or change in precision
occurs.




--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...



  reply	other threads:[~1993-03-22 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-03-19 17:06 Membership in "set" of characters Debora Weber-Wulff
1993-03-19 19:57 ` Mark A Biggar
1993-03-22 10:37   ` Andrew Dunstan,,2285592,
1993-03-22 12:22     ` Debora Weber-Wulff
1993-03-22 17:11       ` Robert I. Eachus [this message]
1993-03-22 15:49   ` Ada 9X references M. Ramchandran
1993-03-22 21:50     ` Alex Blakemore
1993-03-23  4:16     ` Michael Feldman
replies disabled

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