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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,e55912fa8f040ab5,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!proxad.net!feeder1-2.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp2-1.free.fr!not-for-mail Date: Fri, 09 Oct 2009 22:36:49 +0200 From: Damien Carbonne User-Agent: Thunderbird 2.0.0.23 (X11/20090812) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: GNAT GPL 2009 - issue with floating points? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4acf9ee2$0$23472$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 09 Oct 2009 22:36:50 MEST NNTP-Posting-Host: 82.247.219.63 X-Trace: 1255120610 news-4.free.fr 23472 82.247.219.63:32893 X-Complaints-To: abuse@proxad.net Xref: g2news2.google.com comp.lang.ada:8638 Date: 2009-10-09T22:36:50+02:00 List-Id: Hi, When compiling the following sample code with GNAT GPL 2009 on Linux: generic type Real is digits <>; package Pack04 is Size1 : constant := Real'Size; Size2 : constant Integer := Real'Size; end Pack04; I get this: -- pack04.ads:4:24: non-static expression used in number declaration -- pack04.ads:4:28: size attribute is only static for scalar type (RM 4.9(7,8)) RM 3.5(1): "scalar types comprise enumeration types, integer types, and real types." RM 3.5.6 (1): "Real types provide approximations to the real numbers, with relative bounds on errors for floating point types, and with absolute bounds for fixed point types." So Real is supposed to be a scalar! Is this a problem with (misleading) message or with (effectively) wrong code? Initially I wanted to create a generic package similar to: generic type Real is digits <>; package Generic_Float_Util is function Is_Positive (X : Real) return Boolean; end Generic_Float_Util; The intent is to get the sign of a floating point by directly reading the sign bit (assuming float numbers are encoded as IEEE), without any test. Regards, Damien