comp.lang.ada
 help / color / mirror / Atom feed
* Re: the 'small attribute and Ada95
  1996-11-12  0:00 ` Robert A Duff
@ 1996-11-12  0:00   ` Robert Dewar
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1996-11-12  0:00 UTC (permalink / raw)



Robert Duff says

"Several floating point attributes were removed from the language.  The
intent was that implementations would support them anyway, as
implementation-defined attributes, for upward compatibility.  We just
didn't want to go to the trouble of defining what they mean in the RM.
Unfortunately, there was a glitch -- an implementation is allowed to
define new attributes, but is not allowed to extend existing attributes.
Since Small is defined for fixed point types, it would normally be
illegal for an implementation to allow float'Small.  However, AI-93
explicitly gives permission to support Small on floating point types.
AI-93 has been approved by the appropriate ISO committees (ARG and WG9)."


GNAT implements all Ada 83 attributes, including Small on floating-point
types. I think it would be desirable if all Ada 95 compilers would do the
same.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* the 'small attribute and Ada95
@ 1996-11-12  0:00 Magnus Ericsson
  1996-11-12  0:00 ` Robert A Duff
  0 siblings, 1 reply; 3+ messages in thread
From: Magnus Ericsson @ 1996-11-12  0:00 UTC (permalink / raw)



I am trying to port some numeric legacy code from Ada 83 to Ada 95. 

Unfortunatly I am not the author of the original code, nor am I a
numerics expert!

The original code is using the construct:

  function Is_Zero(The_Number : in Number_T) return Boolean is
  begin
    return abs The_Number < Number_T'Small;
  end Is_Zero;

When I compile this with the Ada 95 compiler (ObjectAda) I get a 
message indicating that 'Small only is allowed for Fixed point types
(not for floating point that is used in the original Ada 83 code).

Is there a way to modify the code, making it portable between Ada 83
and Ada 95? If not, what is the best way of solving the problem
in an Ada 95 specific version?

Regards
Magnus



There are also other similar uses of 'Small 
        

-- 
Magnus Ericson M.Sc, Ericsson Microwave Systems
Torshamnsgatan 32C, S-164 84 STOCKHOLM
Tel: +46 8 757 35 38 Fax: +46 8 750 74 42
Disclaimer: "The opinions expressed here are my own,
             and not those of my employer."




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: the 'small attribute and Ada95
  1996-11-12  0:00 the 'small attribute and Ada95 Magnus Ericsson
@ 1996-11-12  0:00 ` Robert A Duff
  1996-11-12  0:00   ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: Robert A Duff @ 1996-11-12  0:00 UTC (permalink / raw)



In article <32889629.1C01@emw.ericsson.se>,
Magnus Ericsson  <Magnus.Ericson@emw.ericsson.se> wrote:
>When I compile this with the Ada 95 compiler (ObjectAda) I get a 
>message indicating that 'Small only is allowed for Fixed point types
>(not for floating point that is used in the original Ada 83 code).

Several floating point attributes were removed from the language.  The
intent was that implementations would support them anyway, as
implementation-defined attributes, for upward compatibility.  We just
didn't want to go to the trouble of defining what they mean in the RM.
Unfortunately, there was a glitch -- an implementation is allowed to
define new attributes, but is not allowed to extend existing attributes.
Since Small is defined for fixed point types, it would normally be
illegal for an implementation to allow float'Small.  However, AI-93
explicitly gives permission to support Small on floating point types.
AI-93 has been approved by the appropriate ISO committees (ARG and WG9).

You could ask your vendor to implement all the old attributes, and point
out AI-93 to them.  Or you could use the corresponding Ada 95 attribute.
I think it's Model_Small, but I'm not sure, because I'm not a numerics
expert either.  As far as I know, there's no simple way to write code
that works for both Ada 83 and Ada 95, unless Ada 95 implementers allow
the old attributes.

See AARM-J(1), A.5.3(67,67.a).

- Bob




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-11-12  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-12  0:00 the 'small attribute and Ada95 Magnus Ericsson
1996-11-12  0:00 ` Robert A Duff
1996-11-12  0:00   ` Robert Dewar

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