From: N J Chackowsky <chackowsky@brandonsd.mb.ca>
Subject: Re: School Assignment--Can this be simplified?
Date: Thu, 31 Aug 2000 18:35:23 GMT
Date: 2000-08-31T18:35:23+00:00 [thread overview]
Message-ID: <39AEAE34.4E9753C8@brandonsd.mb.ca> (raw)
In-Reply-To: 39AE0E2A.C11F53F4@baesystems.com
Thanks for the advice/warnings/etc. I think that where I'm getting
myself confused is with which libraries are standard and which aren't. I
had *thought* that any ada.* were standard. The text I'm using (Feldman)
doesn't make this clear. I've started to plow through the reference
manual, looking for the functions available in
...generics_elementary_functions.
The reason I was using such a mix of "magic numbers", constants, and
variables, was to "code around" the multiple data types, as a result of
using ada.numerics.aux (based on double). As I get to know the libraries
better, I'll tidy up my code.
(Using gnat-3_13p-nt.exe on Win95/98.)
One problem that smote my eyes *just* after making the post was, of
course, that the calculation can be vastly simplified. Since it takes
the form
x
a (x-y)
---- which is a . Not really an Ada95-specific issue,
though.
y
a
Again, thanks for the responses.
Nick J Chackowsky
Brandon, MB
Martin Dowie wrote:
>
> A little more detail about what compile suite you are using might be
> helpful...
>
> What is 'ada.numerics.aux' - it isn't a standard library unit?
> Why not use an instance of 'Ada.Numerics.Generic_Elementary_Functions',
> which is the standard library generic for maths functions? (some
> implementations provide 'ready-to-use' instances for float/long_float).
>
> On the programming style front (feel free to ignore the rest of this
> response ;-)
>
> 1. 'magic numbers' (e.g. 273.15) are repeated and would be more
> readable as named numbers (e.g. c_to_k_factor : constant := 273.15;)
>
> 2. Why are all the data objects 'variables' that are only ever assigned
> once? This is a little pet-hate of mine, as by declaring them as
> constants would help reduce target code size on some (most?)
> compilers. I was always taught it is simply 'better programming'.
>
> It is a current loathing of mine simply because we are using
> a non-optimizing compiler just now; 3 out of the original 5 s/w
> engineers have left and their stuff is litter with this and, hey,
> guess what, we're short on space on the target! If they had used
> constants like this we would have an extra couple of percent -
> not much, but for a little thought when programming, it is a couple
> of percent we wouldn't have to be scrapping together now! As a side
> effect, by reducing code size we increase throughput on the target
> too :-)
>
> 3. I best not even get into the whole 'why is everything a 'float' and
> not user-defined float types' thing... This smacks of 'C' programs
> not Ada programs.
>
> N J Chackowsky wrote:
> >
> [snip]
> >
> --
> The views expressed here are personal and not those of BAE Systems.
next prev parent reply other threads:[~2000-08-31 18:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-08-30 0:00 School Assignment--Can this be simplified? N J Chackowsky
2000-08-30 0:00 ` Pascal Obry
2000-08-30 0:00 ` tmoran
2000-08-30 0:00 ` Keith Thompson
2000-08-31 0:00 ` Martin Dowie
2000-08-31 11:31 ` Simon Wright
2000-08-31 11:51 ` Martin Dowie
2000-08-31 18:35 ` N J Chackowsky [this message]
2000-08-31 19:19 ` N J Chackowsky
2000-08-31 19:33 ` Pascal Obry
2000-08-31 23:03 ` Nick J Chackowsky
2000-09-01 1:02 ` tmoran
2000-09-01 4:14 ` Robert Dewar
2000-09-01 17:51 ` tmoran
2000-09-02 3:12 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox