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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: casting types Date: Mon, 06 Oct 2014 17:03:41 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <0e236d4b-2ece-4179-850c-46a0572f8339@googlegroups.com> <87iok1d09g.fsf@adaheads.sparre-andersen.dk> <5e669b7a-21ac-46cf-b850-50692c38541d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 7 Oct 2014 00:03:43 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="2cce0a40174b83136a5e3a34df5b5ee7"; logging-data="21667"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Pz/ejFl//ZI3j05lZn8MgIy0V+a57VE4=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 In-Reply-To: <5e669b7a-21ac-46cf-b850-50692c38541d@googlegroups.com> Cancel-Lock: sha1:EaerxYkHzTmXzSVslQv8DC/iV1M= Xref: news.eternal-september.org comp.lang.ada:22162 Date: 2014-10-06T17:03:41-07:00 List-Id: On 10/06/2014 04:36 PM, brbarkstrom@gmail.com wrote: > > First, to be safe in doing any floating point arithmetic, you should > use the Ada type long_float. No, you shouldn't. First, Long_Float is optional; there is no guarantee that a compiler implements it, so if you want your code to be portable you'll avoid it. Even if it is defined, it need not be any different from Float. Second, given that McCormick identified modeling scalars (using user-defined numeric and enumeration types) as the main Ada feature that allowed his students to be successful, advice to always use a predefined type should rightly be regarded with suspicion. If you have an application that needs the maximum precision the compiler can give you, you should define a floating-point type using System.Max_Digits. > return (Result); There is no need for parentheses here. -- Jeff Carter "I was hobbling along, minding my own business, all of a sudden, up he comes, cures me! One minute I'm a leper with a trade, next minute my livelihood's gone! Not so much as a 'by your leave!' You're cured, mate. Bloody do-gooder!" Monty Python's Life of Brian 76