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: 107079,183ebe04e93f0506,start X-Google-Attributes: gid107079,public X-Google-Thread: 103376,183ebe04e93f0506,start X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: fixed point vs floating point Date: 1997/11/22 Message-ID: #1/1 X-Deja-AN: 291567558 Distribution: inet Organization: Estormza Software Newsgroups: comp.lang.ada,sci.math.num-analysis Date: 1997-11-22T00:00:00+00:00 List-Id: Matthew asks: <> Robert replies: <> Matthew asks <> Robert replies: <> Matthew replies, and then asks: OK, OK, I was being lazy. How about this definition of heading: type Heading_In_Degrees_Base is delta 512.0 * System.Fine_Delta range -512.0 .. 512.0; subtype Heading_In_Degrees is Heading_In_Degrees_Base range 0.0 .. 360.0; Now I know on GNAT that the delta is considerably smaller than 0.0625. (I really do wish implementations would give me extra accuracy and not extra range. Why do they do that?) Anyway, I'll accept that fixed point operations are slower, but the question remains: Why do most programmers insist on using floating point when a fixed point better models the abstraction? Is the reason solely based on efficiency? By the way, are there off-the-shelf subprograms (in Ada preferably, but I'd take any language) for computing the elementary functions (sin, cos, etc) of a fixed point angle? -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271