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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3cff83f35107b37b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.152.115.41 with SMTP id jl9mr5872lab.6.1349940665474; Thu, 11 Oct 2012 00:31:05 -0700 (PDT) Path: q11ni134268801wiw.1!nntp.google.com!feeder1.cambriumusenet.nl!feeder2.cambriumusenet.nl!feed.tweaknews.nl!216.40.29.245.MISMATCH!novia!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!news.netfront.net!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Multiplying fixed-point by long integer Date: Thu, 04 Oct 2012 21:23:21 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: NNTP-Posting-Host: 184.20.60.112 Mime-Version: 1.0 X-Trace: adenine.netfront.net 1349411006 88541 184.20.60.112 (5 Oct 2012 04:23:26 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Fri, 5 Oct 2012 04:23:26 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-10-04T21:23:21-07:00 List-Id: On 10/04/2012 06:46 PM, Adam Beneschan wrote: > > 4.5.5 defines predefined multiplication operators between any fixed-point > type and Integer. However, it isn't defined for any other integer type. > This can cause a problem if I have an integer type whose bounds are larger > than Integer, since it obviously won't work to convert it to Integer. Has > anyone encountered this problem before, and how did you solve it? I'm > hesitant to try to solve it by converting things to floating point, since the > mantissa of a floating-point may have fewer bits than the fixed-point or > integer type, and fixed-point multiplication by an integer should be exact. Do the integer values fit in the range of the fixed-point type? If so, you could convert to the fixed-point type. If not, then the fixed-point abs value must be < 1, and you're dividing the integer value by 1/'Small. That might give you some idea how to proceed. -- Jeff Carter "C++ is vast and dangerous, a sort of Mordor of programming languages." Jason R. Fruit 120 --- news://freenews.netfront.net/ - complaints: news@netfront.net ---