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: 103376,8e0fcf9e7d370ccc X-Google-Attributes: gid103376,public From: l107353@cliffy.lfwc.lockheed.com (Garlington KE) Subject: Re: Fixed-point question Date: 1995/04/07 Message-ID: <3m43ot$grt@butch.lmsc.lockheed.com>#1/1 X-Deja-AN: 100070405 references: <3li7ec$k37@butch.lmsc.lockheed.com> organization: Lockheed Missiles and Space Co. newsgroups: comp.lang.ada Date: 1995-04-07T00:00:00+00:00 List-Id: Robert Dewar (dewar@cs.nyu.edu) wrote: : On most modern machines floating-point is much faster than fixed-point in : any case. Was there really a good case for using fixed-point in this cas. I don't know for sure, but I would assume space was the driver (16-bit fixed-point vs. 32-bit fixed-point). Some of our users like to use fixed point in large lookup tables to save space. I've received a couple of replies concerning a "roughly equal" function, and I think everyone so far ran up against the same snags I did. I haven't had time to do any more work on this, but if I do, I'll post the results in case anyone's interested. To repeat the problem: A user declared a fixed-point type, like type D is delta 0.1 range ... This generates a set of model numbers M. In this particular user's mind, however, he is thinking in terms of the set S = { ... 2.0, 2.1, 2.2 ... } (is there a name in Ada for this set?). What happened was that he did a calculation that yielded the model number 2.25, which is neither the model number used by the compiler for the literal 2.2 nor the model number for the literal 2.3. What the user wants is a way to map items in M to S, such that the model number for "2.1" will be equal to 2.1, and both 2.25 and the model number for "2.3" will be equal to "2.3". This "roughly equal" function would, ideally, be insensitve to the order of the operands. If all else fails, I could ask Tartan: their AdaScope debugger does this mapping, such that when X = 2.25, asking the debugger to print out X yields the value "2.3". (This also helped to confuse the user; his code was operating as if X /= 2.3, but the debugger told him X was 2.3!) -------------------------------------------------------------------- Ken Garlington GarlingtonKE@lfwc.lockheed.com F-22 Computer Resources Lockheed Fort Worth Co. If LFWC or the F-22 program has any opinions, they aren't telling me.