From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109d8a,c7637cfdf68e766 X-Google-Attributes: gid109d8a,public X-Google-Thread: f43e6,c7637cfdf68e766 X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,c7637cfdf68e766 X-Google-Attributes: gid103376,public X-Google-Thread: 107079,c7637cfdf68e766 X-Google-Attributes: gid107079,public X-Google-Thread: f8362,c7637cfdf68e766 X-Google-Attributes: gidf8362,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: floating point comparison Date: 1997/09/05 Message-ID: #1/1 X-Deja-AN: 270068433 Distribution: inet References: <33EA46CC.226@pseserv3.fw.hac.com> <871377938snz@nezumi.demon.co.uk> <33FE4D83.4DCD@pseserv3.fw.hac.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada,sci.math.num-analysis,comp.software-eng,comp.theory,sci.math Date: 1997-09-05T00:00:00+00:00 List-Id: In article <33FE4D83.4DCD@pseserv3.fw.hac.com> "W. Wesley Groleau x4923" writes: > Let me put my original question another way. Can we (as Sam > suggested above) come up with something _at_the_level_of_ Ada > Quality and Style that tells the "analysis-challenged" when to > call for help--rather than telling them to never use floating point? For many calculations floating point offers convenience while preserving more than enough numerical accuracy. On other types of calculations, fixed point accuracy is required. (For example, checking your bank statement can only be done correctly using fixed point, and knowing the rules for computing interest on that account.) If you can't tell which you should be using, get help fast. In general it is much more work to write fixed point than floating point code, but especially in Ada, the error analysis is easy. Errors are only introduced by explicit conversions never by arithmetic operations. The much more work comes from defining the various types and putting in the conversions. It used to be difficult to use Ada fixed point with some compilers, but in Ada 95, most vendors are supporting the decimal types and 64-bit binary fixed point types. (If that sounds like I recommend using fixed point everywhere, far from it. If you are building flight control system, for example, and your control laws are stable over the envelope, then go ahead and use floating point. But if you are inverting large matrices or solving linear programming problems, then the real work needs to be done not only in fixed point, but with appropriate scaling, rebuilding of basises etc.) -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...