From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Exponent floats?
Date: Mon, 28 Mar 2005 08:49:28 +0200
Date: 2005-03-28T08:49:18+02:00 [thread overview]
Message-ID: <18pr9vfqxcnbs.3a905du0c170.dlg@40tude.net> (raw)
In-Reply-To: E1M1e.19923$wL6.12523@trnddc03
On Mon, 28 Mar 2005 04:49:40 GMT, Puckdropper wrote:
> I have an algorithm that requires a floating point exponent. How can I
> use such a thing? I tried using **, but it gives me 3 errors:
>
> test.adb:12:24: invalid operand types for operator "**"
> test.adb:12:24: left operand has type "Standard.float"
> test.adb:12:24: right operand has type "Standard.float"
>
> To demonstrate my problem, I wrote a short program:
>
> -----------------------------
>
> with Ada.Text_IO, Ada.Float_Text_IO;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
> 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);
> Ada.Float_Text_IO.put(Answer);
> Ada.Text_IO.new_line;
> end test;
("**" is predefined for only integer powers, see ARM 4.5.6)
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2005-03-28 6: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 [this message]
2005-03-28 8:49 ` Pascal Obry
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