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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2d09fa6592c24a21 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-11 00:18:55 PST From: "Phil Thornley" Newsgroups: comp.lang.ada References: <3C8B184D.49214059@yahoo.com> Subject: Re: I think - it's a bug... Date: Mon, 11 Mar 2002 08:19:43 -0000 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: waec857.wa.bae.co.uk Message-ID: <3c8c686e@pull.gecm.com> X-Trace: 11 Mar 2002 08:18:54 GMT, waec857.wa.bae.co.uk Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.icl.net!colt.net!newspeer.clara.net!news.clara.net!btnet-peer!btnet-peer0!btnet-feed3!btnet!newreader.ukcore.bt.net!pull.gecm.com!waec857.wa.bae.co.uk Xref: archiver1.google.com comp.lang.ada:21039 Date: 2002-03-11T08:19:43+00:00 List-Id: "Anatoly Chernyshev" wrote in message news:3C8B184D.49214059@yahoo.com... > Hello everybody! > > Look at this piece of code: > > ---------------------------------------------------------------------- --------------------------- > > WITH ada.text_io,ada.numerics.elementary_functions; > USE ada.text_io, ada.numerics.elementary_functions; > PROCEDURE el_stat_fun IS > b : float := 7.5; > a:float:=4.0; > rr, z : float; > r : float := 4.0; > dz : float := 0.3; > BEGIN > FOR k IN 0..integer(b/dz) LOOP > z:=float(k)*dz; > put_line (float'image(1.0-(z/b))); > rr:=-a*sqrt((1.0-(z/b)**2))+a+r; > END LOOP; > END el_stat_fun; > ---------------------------------------------------------------------- ------------------------------ > > > > > When compiled using GNAT 3.14 (WinNT sp 6) it raises > ADA.NUMERICS.ARGUMENT_ERROR in sqrt function when k goes to 25 because > the argument for sqrt becomes > negative (like -X.XXXXXE-07 ... And this is a headache No 1). > However, if one comments out the put_line string - everything works > fine. > You need to look at the generated code. All the variables are local to the procedure, so if you comment out the Put_Line then the compiler might be generating no code at all for the procedure. Alternatively try changing it so that the variable rr is external to the procedure (and make it volatile as well). Cheers, Phil -- Phil Thornley Programmes, Engineering Warton