From: "Kai Gläsner" <Kai.Glaesner@t-online.de>
Subject: Re: Why raises this an error? :-(
Date: Sat, 16 Mar 2002 23:01:45 +0100
Date: 2002-03-16T23:01:45+01:00 [thread overview]
Message-ID: <3C93C0C9.14A5FC7D@t-online.de> (raw)
In-Reply-To: 3C93ACE5.36B3BCE2@acm.org
Thanks for the quick Response.
The problem I have is, that the exponent is not an Integer (this was
just a test-example to find out what is wrong)
<snip> 1.0 - (GetTemperature(The, Alt)/Temp) ** 0.2349690
Where GetTemperature() can return a value < 0.0.
But why is the value of the left operand not allowed to be negative
according to the ARM?
Jeffrey Carter wrote:
>
> Kai Gl�sner wrote:
> >
> > This:
> >
> > Alt_D := (-8.0/4.0) ** 2.0;
> >
> > raises this:
> >
> > raised ADA.NUMERICS.ARGUMENT_ERROR : a-ngelfu.adb:111 instantiated
> > at a-nuelfu.ads:20
> >
> > This:
> >
> > Alt_D := -2.0 ** 2.0;
> >
> > works fine!
>
> Exponentiation has higher precedence than unary minus (ARM 4.5), so this
> is equivalent to
>
> Alt_D := -(2.0 ** 2.0);
>
> ARM A.5.1 says that Argument_Error is raised "by the exponentiation
> operator, when the value of the left operand is negative". This is the
> case in your first example.
>
> Since your exponent is an integer value, you can avoid this restriction
> by using the predefined exponentiation operator for floating-point
> types:
>
> Alt_D := (-8.0 / 4.0) ** 2;
>
> --
> Jeff Carter
> "Your mother was a hamster and your father smelt of elderberries."
> Monty Python & the Holy Grail
next prev parent reply other threads:[~2002-03-16 22:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-16 19:48 Why raises this an error? :-( Kai Gläsner
2002-03-16 20:32 ` Damien Carbonne
2002-03-17 16:31 ` Steve Doiel
2002-03-16 20:37 ` Jeffrey Carter
2002-03-16 22:01 ` Kai Gläsner [this message]
2002-03-17 5:39 ` Jeffrey Carter
2002-03-17 7:25 ` Hyman Rosen
2002-03-16 22:12 ` Kai Gläsner
2002-03-17 1:06 ` tmoran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox