comp.lang.ada
 help / color / mirror / Atom feed
* Legitimate Argument_Error Or Compiler Bug?
@ 2000-09-25  0:00 Marin David Condic
  2000-09-25  0:00 ` Marin David Condic
  2000-09-30  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: Marin David Condic @ 2000-09-25  0:00 UTC (permalink / raw)


The following code raises Argument_Error when attempting to compute a
positive fraction to a real power. Now so far as I can tell, there is
nothing particularly undefined about a fraction raised to a real power,
so Argument_Error seems to be out of place here. Either I've got
something wrong or I've tripped across a bug in the compiler (GNAT
3.13p). Is there a reason this exception should be raised or should I
submit a bug report?

Thanks for the help.

MDC


with Ada.Text_Io ;
with Ada.Numerics.Long_Long_Elementary_Functions ;
use Ada.Numerics.Long_Long_Elementary_Functions ;
--
procedure What_The_Heck is

   Alpha        : Long_Long_Float := 0.05;
   Log_Term     : Long_Long_Float;
   Neg_Log_Term : Long_Long_Float;
   Power_Term   : Long_Long_Float;
   --
begin
   --
   Log_Term      := Log(Alpha/2.0 , 10.0) ;
   Neg_Log_Term  := - Log_Term ;
   --
   Ada.Text_Io.Put ("Neg_Log_Term ** 2   is ") ;
   Power_Term    := Neg_Log_Term ** 2 ;
   Ada.Text_Io.Put_Line (Long_Long_Float'Image(Power_Term) ) ;
   --
   Ada.Text_Io.Put ("    Log_Term ** 2   is ") ;
   Power_Term    := Log_Term ** 2 ;
   Ada.Text_Io.Put_Line (Long_Long_Float'Image(Power_Term) ) ;
   --
   Ada.Text_Io.Put ("Neg_Log_Term ** 2.0 is ") ;
   Power_Term     := Neg_Log_Term ** 2.0;
   Ada.Text_Io.Put_Line (Long_Long_Float'Image(Power_Term) ) ;
   --
   Ada.Text_Io.Put ("    Log_Term ** 2.0 is (Argument_Error)") ;
   Power_Term    :=  Log_Term ** 2.0 ;    --  Dies here!
   Ada.Text_Io.Put_Line (Long_Long_Float'Image(Power_Term) ) ;
   --
end What_The_Heck ;

--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at:  http://www.mcondic.com/

    "Because that's where they keep the money."

        --  Willie Sutton when asked why he robbed banks.
======================================================================






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-09-30  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-25  0:00 Legitimate Argument_Error Or Compiler Bug? Marin David Condic
2000-09-25  0:00 ` Marin David Condic
2000-09-30  0:00 ` Robert Dewar

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