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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1038abdfae2ba73,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!p31g2000prf.googlegroups.com!not-for-mail From: Andreas.Schmidl@googlemail.com Newsgroups: comp.lang.ada Subject: Modify value - type duration Date: Wed, 5 Nov 2008 13:50:59 -0800 (PST) Organization: http://groups.google.com Message-ID: <7ef68540-6df1-4e47-b425-ab08c03f2db9@p31g2000prf.googlegroups.com> NNTP-Posting-Host: 88.217.6.67 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1225921860 18471 127.0.0.1 (5 Nov 2008 21:51:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 5 Nov 2008 21:51:00 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p31g2000prf.googlegroups.com; posting-host=88.217.6.67; posting-account=kyGoqwoAAACcQeoP8h_XOdxjlbHwaXO2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.3) Gecko/2008092417 Bon Echo/2.0.0.11,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:8314 Date: 2008-11-05T13:50:59-08:00 List-Id: Hello! I started programming in Ada for about a month. Because of that my knowledge isn't really good, but will be better every day ;-) I have a problem to modify a fixed point value (type duration). I want to cut all before the point. Example: --------------------------------------------------- var1 : duration := 12.345; var2 : duration; var2 := cutIt(num => var1); --------------------------------------------------- var2 is now 0.345. To implement the function "cutIt" I tested an idea. I converte var1 to an integer: --------------------------------------------------- function cutIt(var : duration) return duration is tempvar : integer; begin tempvar := integer(var); return (var - duration(tempvar)); end cutIt; -------------------------------------------------- But this isn't a solution. Converting to integer with integer(...) round the value. Example: 12.345 ---> 12 12.854 ---> 13 Is there any other more elegant and functional solution in Ada? Thanks for your help! Best regards! Andreas