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,fc647120984c9ad2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!news.glorb.com!peer1.news.newnet.co.uk!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Way to use Ada Mod function on floats? Date: Sat, 02 Dec 2006 17:48:34 +0000 Organization: Pushface Message-ID: References: <1164987168.477589.240140@j44g2000cwa.googlegroups.com> <4571ac78_6@news.bluewin.ch> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1165081715 7407 62.49.19.209 (2 Dec 2006 17:48:36 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 2 Dec 2006 17:48:35 +0000 (UTC) Cancel-Lock: sha1:SqkOBxFA8f2rknPeOhs8NA6/90k= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news2.google.com comp.lang.ada:7784 Date: 2006-12-02T17:48:34+00:00 List-Id: Gautier writes: > Stephen Leake: > >> SAL (http://stephe-leake.org/ada/sal.html) has: >> >> function Modulo (Dividend, Divisor : in Real_Type) return Real_Type >> is >> -- match names in Ada LRM 4.5.5 >> >> A : Real_Type renames Dividend; >> B : Real_Type renames Divisor; >> N : constant Integer := Integer (Real_Type'Floor (A / B)); >> begin >> return A - B * Real_Type (N); >> end Modulo; > > Out of curiosity, what is the need of converting Real_Type'Floor (A / > B) to an Integer and back to a Real_Type ? Especially when it can overflow and give you a Constraint_Error.