From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.8 required=3.0 tests=BAYES_50 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 6 Apr 93 12:50:43 GMT From: agate!dog.ee.lbl.gov!network.ucsd.edu!munnari.oz.au!csis!dubhe.anu.edu.au !newshost.anu.edu.au!csc.canberra.edu.au!lobo!karen@ucbvax.Berkeley.EDU (Karen George) Subject: Ceiling function in Ada Message-ID: List-Id: I'm a new user of Ada. My immediate problem is to implement the ceiling function - also called the next integer function. I.e., for x a float, 1.0 < x <= 2.0, ceil(x) returns 2, etc. My "real" problem is how to obtain only the integer part of the floating point number. In Pascal, and other languages, one can use a truncate function or coerce x to an integer which truncates the fractional part. But, in Ada, coercion to integer actually rounds (so says the documentation) so how does one truncate a float in Ada? Please don't bother suggesting adding 0.5 to x. Not only is Integer(1.5) implementation dependant (so says the documentation), but it is of no value anyway. If Integer(1.5) returns 2, then it's wrong for the ceiling function and I have no means of determining that. If it returns 1, then my function is still implementation dependant and therefore not portable. Thanks -- Karen George Email: karen@lobo.canberra.edu.au Information Sciences and Engineering Phone: +61 6 201 2430 University of Canberra, AUSTRALIA FAX: +61 6 201 5227 -- email: karen@ise.canberra.edu.au karen@lobo.canberra.edu.au karen@abel.anu.edu.au