From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,587583eece659d7a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-16 12:37:12 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3C93ACE5.36B3BCE2@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Why raises this an error? :-( References: <3C93A19C.67D6E442@t-online.de> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Sat, 16 Mar 2002 20:37:09 GMT NNTP-Posting-Host: 209.86.209.151 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1016311029 209.86.209.151 (Sat, 16 Mar 2002 12:37:09 PST) NNTP-Posting-Date: Sat, 16 Mar 2002 12:37:09 PST Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Sat, 16 Mar 2002 12:37:09 PST (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:21345 Date: 2002-03-16T20:37:09+00:00 List-Id: 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