comp.lang.ada
 help / color / mirror / Atom feed
From: joe@petsd.UUCP (Joe Orost)
Subject: Re: What language do you use for scientific programming?
Date: Mon, 26-Aug-85 12:04:50 EDT	[thread overview]
Date: Mon Aug 26 12:04:50 1985
Message-ID: <627@petsd.UUCP> (raw)
In-Reply-To: 64500002@hpislb.UUCP

As an Ada implementer, I just want to correct some technical issues in the
following article:

In article <64500002@hpislb.UUCP> gore@hpisla.UUCP (Jacob Gore) writes:
>
>Ada is quite similar to Pascal and Modula-2.  It does have double-precision
>real types.  In fact, you can pretty much specify arbitrary precision, as
>long as you keep in mind that your program will run faster if there is a
>hardware data type in your machine that can support the precision that you
>asked for (otherwise, you could be executing lots of simulation code).

No simulation code is ever required.  Ada allows operations to be performed
with more precision than the user requested.  Therefore, all operations are
done with the next better floating point type in the machine.  The
"predefined types" of the implementation should correspond with supported
types on the machine.

In addition, fixed point types are defined in the language to allow
representation of fractions on machines that have no floating point
hardware.

>
>Ada follows the philosophy that anything that can be safely put into a
>library should not be a burden to the compiler.  Following this philosophy,
>I/O is not "built into the language" (which usually means that I/O routines
>are in the library anyway, but the compiler has to parse calls to those
>routines differently from calls to user-written routines).  DoD (who set
>the requirements for the language) does require provision of library
>routines that do minimal I/O, in the manner similar to that of Modula-2,
>but slightly more convenient.

No, the compiler doesn't parse I/O calls differently than non-I/O calls.

>
>  (4) Ability to pass parameters by name (instead of just their
>      relative positions within the call) or not to pass them at all.
>      Many statistical library routines have a dozen or two of
>      arguments, most of which the user wants to default to their usual
>      values.  In most languages, the best way to do this is to pass
>      some agreed-upon value, usually 0, which will be replaced with
>      the default value by the routine.  So the call might look like
>
>	CALL FUNFNC (1985, 34, 0,0,0,0,0, -23, 0,0,0,0, 1, 0,0,0,0,0,0)
>      
>      In Ada, it would like this:
>
>	FUNNY_FUCNTION (YEAR:=1985, DISTRICT:=34,
>			PENALTY:=-23, COEFFICIENT:=1);
>
>      The order of the parameters, when passed by name, does not
>      matter.

The correct syntax is:
	FUNNY_FUNCTION (YEAR => 1985,   DISTRICT => 34,
			PENALTY => -23, COEFFICIENT => 1);

>      
>      If you were a customer, which statement would you prefer to use?
>      Well, if you do want to pass values for most of the parameters,
>      you might prefer memorizing their positions to spelling out the
>      name for each of them.  But even that is easier to do in Ada:
>
>	FUNNY_FUNCTION (1985, 34, ,,,,, -23, ,,,, 1, ,,,,,);
>
>      And there is no confusion over which parameter gets the default
>      value, and which actually gets the value of zero!

Ada does not allow this!


All in all, I agree with you in selecting Ada as your language of choice.
Unlike C, however, an efficient Ada program requires a damn-good optimizing
compiler.  This is good for programmers, because they can concentrate on the
algorithm, rather than on an efficient implementation.

				regards,
				joe

--

 ........        .........	Full-Name:  Joseph M. Orost
 .       .       .		UUCP:       ihnp4!vax135!petsd!joe
 . ......   ...  ........	ARPA:	    vax135!petsd!joe@BERKELEY
 .               .		Phone:      (201) 758-7284
 .               .........	Location:   40 19'49" N / 74 04'37" W
				US Mail:    MS 313; Perkin-Elmer; 106 Apple St
					    Tinton Falls, NJ 07724

       reply	other threads:[~1985-08-26 16:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <909@oddjob.UUCP>
     [not found] ` <64500002@hpislb.UUCP>
1985-08-26 16:04   ` Joe Orost [this message]
1985-08-27 17:11     ` What language do you use for scientific programming? Stavros Macrakis
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox