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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.99.65.71 with SMTP id o68mr2445357pga.16.1485535866356; Fri, 27 Jan 2017 08:51:06 -0800 (PST) X-Received: by 10.157.8.10 with SMTP id 10mr733841oty.19.1485535866310; Fri, 27 Jan 2017 08:51:06 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!r185no681051ita.0!news-out.google.com!78ni14667itm.0!nntp.google.com!r185no681041ita.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 27 Jan 2017 08:51:05 -0800 (PST) In-Reply-To: <5a19787c-a11c-470e-8cef-2c5dc4897bf7@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=156.67.143.246; posting-account=3Fg1FgoAAACfsmWScNfMD1tGFhR4DU0o NNTP-Posting-Host: 156.67.143.246 References: <5a19787c-a11c-470e-8cef-2c5dc4897bf7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <85df173c-35e9-4e2e-b067-459794a98aa8@googlegroups.com> Subject: Re: Ada.Numerics.Long_Real_Arrays From: hnptz@yahoo.de Injection-Date: Fri, 27 Jan 2017 16:51:06 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:33200 Date: 2017-01-27T08:51:05-08:00 List-Id: > Hi, > > these are my definitions: > > with Ada.Numerics.Long_Real_Arrays; use Ada.Numerics.Long_Real_Arrays; > package nm is > > Np : Positive; > Type R_Vector is new Real_Vector (1..Np); > Type R_Matrix is array (Positive range <>) of R_Vector; > > procedure nm1 (P : in out R_Matrix); > > end nm; > > -- definition of procedure nm1 in package body nm done. > > now in procedure test_nm.adb (only definitions): > > Np : Positive := 2; > Mp : Positive := Np+1; > > 24 P : R_Matrix(1..Mp) := ((x,x),(y,y),(z,z)); > > no "build all" error or warning > > result when running: > > raised CONSTRAINT_ERROR : test_nm.adb: 24 length check failed. > > Can you help? On January 25. Simon Wright wrote: You could try a generic? with Ada.Numerics.Long_Real_Arrays; generic Rows : Positive; package Nm_G is subtype R_Vector is Ada.Numerics.Long_Real_Arrays.Real_Vector (1 .. Rows - 1); type R_Matrix is array (1 .. Rows) of R_Vector; end Nm_G; with Ada.Text_Io; use Ada.Text_Io; with Nm_G; procedure Nm_Test is package Nm is new Nm_G (Rows => 3); use Nm; P : R_Matrix := ((42.0, 42.0), (43.0, 43.0), (44.0, 44.0)); V : R_Vector := P (P'Last); begin Put_Line ("v: " & V (V'First)'Img & ", " & V (V'Last)'Img); end Nm_Test; It works. My new Nm_Test is with Ada.Text_Io; use Ada.Text_Io; with Nm_G; procedure Nm_Test is package Nm is new Nm_G (Rows => 3); use Nm; P : R_Matrix := ((42.0, 42.0), (43.0, 43.0), (44.0, 44.0)); V,X : R_Vector := P (P'Last); MLF : Long_Float := 6.0; begin Put_Line ("v: " & V (V'First)'Img & ", " & V (V'Last)'Img); X := V / MLF; Put_Line ("X: " & X (X'First)'Img & ", " & X(X'Last)'Img); end Nm_Test; It should also work according to the description in the ARM 2012. However, it says: expected type "Standard.Long_Float" Maybe it lacks implementation ?