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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c4cb2c432feebd9d X-Google-Thread: 1094ba,c4cb2c432feebd9d X-Google-Attributes: gid103376,gid1094ba,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: =?ISO-8859-1?Q?Jan_Vorbr=FCggen?= Newsgroups: comp.lang.ada,comp.lang.fortran Subject: Re: Ada vs Fortran for scientific applications Date: Wed, 24 May 2006 08:46:47 +0200 Organization: MediaSec Technologies GmbH Message-ID: <4didprF1alnf3U1@individual.net> References: <0ugu4e.4i7.ln@hunter.axlog.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ilU35BkksrOe05ymAouU2wMEFopfqLtzjt6Qr39079yvycOBOG User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <0ugu4e.4i7.ln@hunter.axlog.fr> Xref: g2news2.google.com comp.lang.ada:4404 comp.lang.fortran:10174 Date: 2006-05-24T08:46:47+02:00 List-Id: > Is it possible in Fortran to define three *incompatible* types Length, > Time, and Speed, and define a "/" operator between Length and Time that > returns Speed? Yes. > I need to be educated about Fortran's kind, but can you use it to > specify that you want a type with guaranteed 5 digits accuracy? Yes. > Because Fortran has no fixed points, the scientific community sees > floating point as the only way to model real numbers. Ah nonsense. You often need the range, and the constant relative precision of FP is what is often - but not always, of course - needed in physical simuilation. > Ada's accuracy requirement is independent from any hardware (or > software) implementation of floating points, and are applicable even for > non IEEE machines. The same is true for Fortran. > More convenient to write: > Mat1 := Mat2 * Mat3; While that is true, it is much less convenient to read - see the seperate thread on the issue. >> How is Ada's bounds checking better or worse than Fortran's? > > I may miss something on the Fortran side, but Ada's very precise typing > allows to define variables whose bounds are delimited. If these > variables are later used to index an array (and if the language features > are properly used), the compiler statically knows that no out-of-bound > can occur. In short, most of the time, an Ada compiler is able to prove > that bounds checking is not necessary, and corresponding checks are not > generated. It's a little bit more difficult for a Fortran compiler, but an equivalent program - one that, directly or indirectly refers to the array bounds in the loop parameters - should be optmizable in the same way. With array expressions, Fortran has an additional and idiomatic way of doing this. Jan