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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.77.42 with SMTP id c30mr182763yhe.6.1412641314724; Mon, 06 Oct 2014 17:21:54 -0700 (PDT) X-Received: by 10.140.80.210 with SMTP id c76mr41023qgd.18.1412641314681; Mon, 06 Oct 2014 17:21:54 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!dc16no1113225qab.1!news-out.google.com!q8ni43qal.1!nntp.google.com!s7no994943qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 6 Oct 2014 17:21:54 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.111.113.147; posting-account=Ies7ywoAAACcdHZMiIRy0M84lcJvfxwg NNTP-Posting-Host: 50.111.113.147 References: <0e236d4b-2ece-4179-850c-46a0572f8339@googlegroups.com> <87iok1d09g.fsf@adaheads.sparre-andersen.dk> <5e669b7a-21ac-46cf-b850-50692c38541d@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: casting types From: brbarkstrom@gmail.com Injection-Date: Tue, 07 Oct 2014 00:21:54 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:22163 Date: 2014-10-06T17:21:54-07:00 List-Id: On Monday, October 6, 2014 8:03:44 PM UTC-4, Jeffrey Carter wrote: > 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 Thanks for the correction.