comp.lang.ada
 help / color / mirror / Atom feed
From: "bob" <bklungle@junque.com>
Subject: Re: Calculating SQRT in ADA
Date: 1999/03/24
Date: 1999-03-24T10:31:22-06:00	[thread overview]
Message-ID: <01be7613$c90ed040$0e2915c0@w95> (raw)
In-Reply-To: auWJ2.6969$2G6.3578@c01read02.service.talkway.com

Several possibilities.

If you are using gnat Ada95, the following is a possibility:

[snip]
with text_io;
with Ada.Numerics.Generic_Elementary_Functions;
use text_io;

package body vectors is

  package math is new Ada.Numerics.Generic_Elementary_Functions(real);
  use math;
  package fio is new float_io(real);
  use fio;
[snip]
  -- Evaluate the magnitude of a vector 
  function mag(v : vector) return real is
  begin
    return sqrt(v(1)**2 + v(2)**2 + v(3)**2);
  end mag;
[snip]
end vectors;

In Ada83 or Ada95, if the target is real, possibly the following:
x : real;
[snip]
x = x**0.5;
[snip]

All of the Ada85 comilers I have used supply a "math" package containing
sqrt also.

cheers....bob

cmcrae <cmcrae@orca.st.usm.edu> wrote in article
<auWJ2.6969$2G6.3578@c01read02.service.talkway.com>...
>   I am trying to calculate the SQRT in ADA.  Is there a function that I
> can access?
> --
> Posted via Talkway - http://www.talkway.com
> Surf Usenet at home, on the road, and by email -- always at Talkway.
> 
> 




  parent reply	other threads:[~1999-03-24  0:00 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-24  0:00 Calculating SQRT in ADA cmcrae
1999-03-23  0:00 ` Chris Morgan
     [not found]   ` <36F913E0.75F51763@lmco.com>
1999-03-24  0:00     ` John Herro
1999-03-24  0:00       ` Hans Marqvardsen
     [not found]         ` <36FAA3DF.42C31CF@lmco.com>
1999-03-26  0:00           ` Tom Moran
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00         ` John Herro
1999-03-24  0:00           ` Hans Marqvardsen
1999-03-25  0:00             ` David C. Hoos, Sr.
1999-03-25  0:00           ` robert_dewar
1999-03-26  0:00             ` Calculating SQRT in Ada John Herro
1999-03-26  0:00               ` David C. Hoos, Sr.
1999-03-26  0:00                 ` John Herro
1999-03-25  0:00           ` Calculating SQRT in ADA robert_dewar
1999-03-25  0:00             ` David C. Hoos, Sr.
1999-03-26  0:00               ` Howard W. LUDWIG
1999-03-26  0:00             ` Ole-Hjalmar Kristensen
1999-03-27  0:00               ` robert_dewar
1999-03-29  0:00                 ` Robert I. Eachus
1999-03-30  0:00                   ` robert_dewar
1999-04-02  0:00                     ` Robert I. Eachus
1999-03-30  0:00                   ` robert_dewar
1999-04-02  0:00                     ` Robert I. Eachus
1999-04-03  0:00                       ` robert_dewar
1999-03-25  0:00       ` robert_dewar
1999-03-24  0:00     ` Ada 83 - Sometimes still chosen Richard D Riehle
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00         ` Richard D Riehle
1999-03-25  0:00           ` Marin David Condic
1999-03-26  0:00           ` robert_dewar
1999-03-25  0:00       ` robert_dewar
1999-03-25  0:00         ` Richard D Riehle
1999-03-25  0:00           ` Larry Kilgallen
1999-03-26  0:00           ` robert_dewar
1999-03-26  0:00             ` Tarjei Tj�stheim Jensen
1999-03-27  0:00               ` robert_dewar
1999-03-27  0:00                 ` Tarjei Tj�stheim Jensen
1999-03-26  0:00             ` Tom Moran
1999-03-26  0:00             ` Richard D Riehle
1999-03-26  0:00               ` Tom Moran
1999-03-26  0:00                 ` Larry Kilgallen
1999-03-29  0:00                 ` Marin David Condic
1999-03-29  0:00                   ` Tarjei Tj�stheim Jensen
1999-03-27  0:00               ` Matthew Heaney
1999-03-25  0:00     ` Calculating SQRT in ADA robert_dewar
1999-03-24  0:00       ` Howard W. LUDWIG
1999-03-25  0:00         ` Larry Kilgallen
1999-03-24  0:00   ` Marin David Condic
1999-03-24  0:00 ` bob [this message]
1999-03-24  0:00   ` Niklas Holsti
1999-03-26  0:00     ` als0045
1999-03-26  0:00       ` als0045
1999-03-26  0:00     ` bob
1999-03-26  0:00 ` Marin David Condic
1999-03-26  0:00   ` David C. Hoos, Sr.
replies disabled

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