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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b80661021d9cbcb1,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!t1g2000pra.googlegroups.com!not-for-mail From: DarthBob88 Newsgroups: comp.lang.ada Subject: Problem with Floating Points Date: Thu, 13 Dec 2007 20:19:07 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 209.216.178.243 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1197605948 28233 127.0.0.1 (14 Dec 2007 04:19:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 14 Dec 2007 04:19:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t1g2000pra.googlegroups.com; posting-host=209.216.178.243; posting-account=Wx82cgoAAACNa4nrJhRV8xCn3wMN2wR_ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:18938 Date: 2007-12-13T20:19:07-08:00 List-Id: I'm trying to use a Percentage type to show how often a given condition occurred; like percent := matches/attempts. The only problem is, it keeps outputting 0% for the result percentage. I have been unable to get it to change its output, even to another nonsense answer like that. Here follows my program, without the irrelevant portions. with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure test is type Percentage is Delta 0.01 range 0.00 .. 100.00; --Runs from 0 to 100%, and goes to two decimal places. Successes : Integer := 0; Attempts : Integer := 0; Output : Percentage; begin loop Attempts := Attempts + 1; --when we get a success Successes := Successes + 1; exit when iterator = 1000; end loop; Output := 100.00 * (Successes / Iterator); Put_Line("Attempts: " & Integer'Image(Attempts)); New_Line; Put_Line("Successes: " & Integer'Image(Successes)); New_Line; Put_Line("Percentage of Successes: " & Percentage'Image(Output)); end Test; I've been able to get real outputs for Attempts and Successes, but nothing at all for Output. I've been looking through every other source available, but nothing had an answer for me.