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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9ea5d59767aa4a7d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!aioe.org!news.tornevall.net!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Truncating a fixed-point value Date: Fri, 09 Jul 2010 14:20:01 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <732bea9d-aacb-4b87-b64b-657aabce6736@w31g2000yqb.googlegroups.com> NNTP-Posting-Host: 9488e6ecbc01154192cd7188af305ede Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 16b8ed9de709f012a49f487121a6b02e X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-Validate-Post: http://news.tornevall.net/validate.php?trace=16b8ed9de709f012a49f487121a6b02e X-SpeedUI: 1738 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news1.google.com comp.lang.ada:12299 Date: 2010-07-09T14:20:01-07:00 List-Id: On 07/09/2010 01:39 PM, Gene wrote: > > An ugly approach is to convert to e.g. a long float, take the floor, > and convert back. No doubt others will have something more elegant. That's the approach I use, though, in the interest of portability, I declare my own floating-point type for the purpose: function Floor (Value : in Fixed) return Integer is type Big is digits System.Max_Digits; begin -- Floor return Integer (Big'Floor (Big (Value) ) ); end Floor; -- Jeff Carter "It's symbolic of his struggle against reality." Monty Python's Life of Brian 78