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=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a0c:ff01:: with SMTP id w1mr30253676qvt.28.1626782523137; Tue, 20 Jul 2021 05:02:03 -0700 (PDT) X-Received: by 2002:a25:dc50:: with SMTP id y77mr38850823ybe.405.1626782522859; Tue, 20 Jul 2021 05:02:02 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 20 Jul 2021 05:02:02 -0700 (PDT) Injection-Info: google-groups.googlegroups.com; posting-host=139.228.49.69; posting-account=oy9pPgoAAACICsEVtbydIrxpi9tsYOGl NNTP-Posting-Host: 139.228.49.69 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <318e5e93-5f66-4bb8-8bf0-7ee3fd2688fan@googlegroups.com> Subject: Gnat bug or mistaken program? From: Richard Iswara Injection-Date: Tue, 20 Jul 2021 12:02:03 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:62416 List-Id: 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; Counter : Integer := 1; Logs : Float := 0.0; Multiples : Float; inside some loop: Logs := Elementary_Functions.Log (Float(Counter), 10.0) + Logs; Multiples := 10.0 ** Logs; => this is where it fails I checked the Ada.Numerics.Generic_Elementary_Functions specifications (since Ada.Numerics.Elementary_Functions is just an instance of the generics) and it said: function "**" (Left, Right : Float_Type'Base) return Float_Type'Base with Pre => (if Left = 0.0 then Right > 0.0) and Left >= 0.0, Post => "**"'Result >= 0.0 and then (if Right = 0.0 then "**"'Result = 1.0) and then (if Right = 1.0 then "**"'Result = Left) and then (if Left = 1.0 then "**"'Result = 1.0) and then (if Left = 0.0 then "**"'Result = 0.0); So the question is this a Gnat bug, wrong function used, faulty logic on me or I am declaring it wrong?