comp.lang.ada
 help / color / mirror / Atom feed
* The AFT Attribute
@ 1986-09-16  0:32 Geoff Mendal
  1986-09-22 20:38 ` Dale Worley
  0 siblings, 1 reply; 5+ messages in thread
From: Geoff Mendal @ 1986-09-16  0:32 UTC (permalink / raw)


Hello Ada Fans,

I'm confused again.  In the LRM, 3.5.10(9) states (parenthetically)
that the value of the AFT attribute is the smallest positive N
such that (10 ** N) * T'DELTA >= 1.0.  Now, 3.5.10(15) states that
the value returned by AFT depends only on T'DELTA. [3.5.10(15) is
a "note".]

Can these two paragraphs imply a cohesive semantics for the AFT
attribute?  Using 3.5.10(9) on the following type:

  type Fix is delta 1.0 / 16.0 range 0.0 .. 1.0;

The smallest value N that satisfies the equation is 2.  But how can
one represent 1.0 / 16.0 accurately in two decimal digits?
[1.0 / 16.0 = 0.0625]

What am I missing here?

gom
-------

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

* Re: The AFT Attribute
       [not found] <20@<12239247219>
@ 1986-09-22 12:44 ` stt
  1986-09-24 15:13 ` stt
  1 sibling, 0 replies; 5+ messages in thread
From: stt @ 1986-09-22 12:44 UTC (permalink / raw)



In 3.5.10:9, the RM says "T'AFT yields the number of decimal
digits needed after the point to accommodate the precision
of the subtype T,..."  The key word is "accommodate," which is being
used in a way that is consistent with the definition of
DELTA itself, namely that the DELTA represents an upper bound
on the actual delta.  For T'AFT, it is an upper bound on the
value of a 1 in the last position.  In your example, the
relevant equation is that 0.01 <= 0.0625, not that the
decimal expansion of 1/16 requires 4 digits.  Otherwise,
imagine what the T'AFT would be for 1/3.

By the way, T'AFT is my favorite attribute.
-S. Tucker T'aft
 Intermetrics, Inc.
 733 Concord Ave.
 Cambridge, MA  02138

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

* Re: The AFT Attribute
  1986-09-16  0:32 The AFT Attribute Geoff Mendal
@ 1986-09-22 20:38 ` Dale Worley
  1986-09-24  5:11   ` Doug Bryan
  0 siblings, 1 reply; 5+ messages in thread
From: Dale Worley @ 1986-09-22 20:38 UTC (permalink / raw)


> I'm confused again.  In the LRM, 3.5.10(9) states (parenthetically)
> that the value of the AFT attribute is the smallest positive N
> such that (10 ** N) * T'DELTA >= 1.0.  Now, 3.5.10(15) states that
> the value returned by AFT depends only on T'DELTA. [3.5.10(15) is
> a "note".]
> 
> Can these two paragraphs imply a cohesive semantics for the AFT
> attribute?  Using 3.5.10(9) on the following type:
> 
>   type Fix is delta 1.0 / 16.0 range 0.0 .. 1.0;
> 
> The smallest value N that satisfies the equation is 2.  But how can
> one represent 1.0 / 16.0 accurately in two decimal digits?
> [1.0 / 16.0 = 0.0625]
> 
> What am I missing here?

The point is that T'AFT digits is not guaranteed to be enough to
represent the values of type T.  (Consider

	type Fix is delta 1.0 / 3.0 range 0.0 .. 1.0;

No number of digits is sufficient!)  All you are guaranteed is that
the delta is >= (10 ** -T'AFT).

Now, what 'AFT is good for, I don't rightly know...  Any guesses,
campers?

Dale

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

* Re: The AFT Attribute
  1986-09-22 20:38 ` Dale Worley
@ 1986-09-24  5:11   ` Doug Bryan
  0 siblings, 0 replies; 5+ messages in thread
From: Doug Bryan @ 1986-09-24  5:11 UTC (permalink / raw)



Dale brings up a few more interesting points concerning 'Aft.  Consider:

	type Fix is delta 1.0 / 3.0 range 0.0 .. 1.0;

Given the definition of Aft, Fix'Aft must return 1.  As Dale points out,
there is no way to exactly represent Fix'Delta in any finite number of digits.
It is interesting to note that Aft is defined in terms of delta, not small.
Thus Aft may not reflect the precision of the actual model numbers of the
type. (?)

Perhaps our question can more precisely be stated as follows:

        What was the rationale for defining Aft to return the smallest 
	positive integer N such that (10 ** N) * T'Delta >= 1?

Why was T'Small not used?  Surely T'Aft is not enough digits to precisely
display the decimal form of a model number of T. (We need
not even consider representation clauses.)  Is Aft sufficient digits
to display the model numbers of T such that one does not display the
same value more than once?

	type T is delta 1.0/16 range 0.0 .. 1.0;
	T'Aft = 2

let us look at some model numbers...

	0.0625	0.125	0.1875	0.25
	
If one were to print these model numbers using 
Put (X, Fore => 2, Aft => T'Aft, Exp => 0), we would see:

	0.06	0.12	0.18	0.25

No values are repeated.  Is this the intended use for 'Aft? 

Has anybody ever used 'Aft?  How  (campers) ?

doug and geoff
-------

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

* Re: The AFT Attribute
       [not found] <20@<12239247219>
  1986-09-22 12:44 ` stt
@ 1986-09-24 15:13 ` stt
  1 sibling, 0 replies; 5+ messages in thread
From: stt @ 1986-09-24 15:13 UTC (permalink / raw)



T'AFT's primary purpose is as the default value for FIXED_IO.DEFAULT_AFT,
which determines how many digits after the decimal point PUT should
emit (by default, of course!).  See RM 14.3.8:2,6.

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

end of thread, other threads:[~1986-09-24 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1986-09-16  0:32 The AFT Attribute Geoff Mendal
1986-09-22 20:38 ` Dale Worley
1986-09-24  5:11   ` Doug Bryan
     [not found] <20@<12239247219>
1986-09-22 12:44 ` stt
1986-09-24 15:13 ` stt

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