From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!mRBVMlGoFUnDsRgMYRJiSw.user.46.165.242.75.POSTED!not-for-mail From: Richard Iswara Newsgroups: comp.lang.ada Subject: Re: Gnat bug or mistaken program? Date: Wed, 21 Jul 2021 09:23:03 +0700 Organization: Aioe.org NNTP Server Message-ID: References: <318e5e93-5f66-4bb8-8bf0-7ee3fd2688fan@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gioia.aioe.org; logging-data="19375"; posting-host="mRBVMlGoFUnDsRgMYRJiSw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:62418 List-Id: On 20/07/2021 21.09, Niklas Holsti wrote: > On 2021-07-20 15:02, Richard Iswara wrote: >> I get this error on my program from the menu build => check semantic >> exponent must be of type Natural, found type "Standard.Float". >> >> Should not 10 ** (log10 a + log10 b) = a*b? >> >> This is my compiler build: >> >> GNAT Studio Community 2020 (20200427) hosted on x86_64-pc-mingw32 >> GNAT Community 2020 (20200429-93) targetting x86_64-pc-mingw32 >> SPARK Community 2020 (20200429) >> >> Here is the relevant part of program: >> >> with Ada.Numerics.Elementary_Functions; >> use Ada.Numerics; > > > To make Ada.Numerics.Elementary_Functions."**" visible without > qualification, you should also do "use Ada.Numerics.Elementary_Functions". > > Otherwise the compiler will see only the predefined operator: > >    function "**"(Left : Float; Right : Integer'Base) return Float > > (see RM 4.5.6(9 and 10)) which explains why the compiler does not accept > a floating-point value as the Right operand to "**". > > >> Logs : Float := 0.0; >> Multiples : Float; >    ...> Multiples := 10.0 ** Logs;  => this is where it fails > > > It fails because the compiler sees only the predefined "**" operator > which has an integral right operand. Thank you. So it is a visibility problem.