comp.lang.ada
 help / color / mirror / Atom feed
From: David Taylor <dtaylor@sg2.ha.hac.com>
Subject: Re: sign bit for digits type
Date: 1997/02/12
Date: 1997-02-12T00:00:00+00:00	[thread overview]
Message-ID: <3301F811.5D09@sg2.ha.hac.com> (raw)
In-Reply-To: 5dq6am$5m0$1@lator.cybercom.net


luo@cybercom.net wrote:
<<snip>> 
> package A is
>    type float_32 is digits 6;
> end A;

> with A;
> package B is
>   function "-" (x, y : A.float_32) renames A."-" return A.float_32;
>   Real :A.float_32 := -5.0;
> end B;
> 
> with A;
> with B;
> procedure C is
>   value : A.float_32 := B.Real;
> begin
>   null;
> end C;
> 
> What is value equal to, 5.0 or -5.0?
> TIA.

You clearly didn't compile this.  The line:

function "-" (x, y : A.float_32) renames A."-" return A.float_32;

has incorrect syntax and also doesn't do what you want it to do.  You need a "unary" minus:

function "-" (x : A.float_32)  return A.float_32 renames A."-";

So, Value should be -5.0. 

Dave Taylor




      parent reply	other threads:[~1997-02-12  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-11  0:00 sign bit for digits type luo
1997-02-12  0:00 ` Mats Weber
1997-02-12  0:00 ` David Taylor [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox