comp.lang.ada
 help / color / mirror / Atom feed
From: Pascal Obry <pascal@obry.net>
Subject: Re: Exponent floats?
Date: 28 Mar 2005 10:49:27 +0200
Date: 2005-03-28T10:49:31+02:00	[thread overview]
Message-ID: <ueke0yx2g.fsf@obry.net> (raw)
In-Reply-To: 18pr9vfqxcnbs.3a905du0c170.dlg@40tude.net


"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> with Ada.Numerics.Elementary_Functions;
> use  Ada.Numerics.Elementary_Functions;

Ok.

> > procedure test is
> > 
> > expon: float;
> > Answer: float;
> > Base: float;
> > 
> > begin -- Main Program
> > 	expon := 2.0;
> > 	Base := 2.0;
> > 	Answer := base ** expon;
> 
> Answer := exp (log (base) * expon);

No, No need to change that, see below...

> > 	Ada.Float_Text_IO.put(Answer);
> > 	Ada.Text_IO.new_line;
> > end test;
> 
> ("**" is predefined for only integer powers, see ARM 4.5.6)

Yes, but "**" on floats is defined in Ada.Numerics.Elementary_Functions.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



  reply	other threads:[~2005-03-28  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-28  4:49 Exponent floats? Puckdropper
2005-03-28  6:39 ` tmoran
2005-03-28  6:49 ` Dmitry A. Kazakov
2005-03-28  8:49   ` Pascal Obry [this message]
2005-03-28  9:57     ` Dmitry A. Kazakov
2005-03-28 17:47       ` Puckdropper
2005-03-28 18:34         ` Pascal Obry
2005-03-28 22:27           ` Puckdropper
2005-03-28 18:51         ` Dmitry A. Kazakov
2005-03-29  9:29           ` Martin Krischik
2005-03-29 18:55             ` Manuel G. R.
replies disabled

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