[aplusdev] Primitive function Deal?
Jon McGrew
Jon.McGrew at morganstanley.com
Thu Sep 6 15:19:53 EDT 2001
Hi, Sasha.
I tried your Deal examples on our internal version of A+,
and everything worked fine-- no errors. But then I tried
them on our distributed CD version, and Oh my! You are
right, of course. I also get a segv error. And yes, 16
seems to be a magic number. Hmmm. We'll get back with
you on this.
"Restricted whole number" is just a broader definition of
integer. We tend to mix up two ideas when we speak of
integers: Sometimes we mean numbers that have no fractional
part, and sometimes we mean that the data type is actually
integer. For example, "2.0" and 2147483648 are whole numbers,
but they are represented as floating point numbers within A+.
So, the original writer of the A+ manuals (Don Orth) was a
bit more precise with those terms. For functions which
require an argument of a whole number that can be exactly
converted to an integer, the manuals speak of "restricted
whole numbers."
Refer to the on-line manual under "Terms Used in the Manual"
(at http://www.aplusdev.org/APlusRefV2_2.html#11). It begins
by saying this:
----------
Terms Used in the Manual
Data Type and General Type
There are seven data types in A+: character, integer,
floating point, null, box, symbol, and function. The term
integer is always used in this manual in this strict sense,
to indicate not only a domain of values but also a particular
internal representation, the one identified by the A+ type
integer (`int, as the Type function calls it). Integral and
integral value also refer to both domain and representation.
The term restricted whole number is used to refer to any representation, integer or floating-point, of a member of the integral
domain of values - that is, of a value for which integer
internal representation is possible. The floating-point
representations in the set of restricted whole numbers need
only be equal to integers within the comparison tolerance or
be less than 1e-13 in absolute value. See "Representation of
Numbers", especially its "Comparison Tolerance" section. (Put
another way, a scalar x is a restricted whole number if either
(1) ©x is `int or (2) ©x is `float and either Íx is less than
1e-13 or there is a y such that x=y is 1 and ©y is `int.) The
chief significance of this concept, of course, is that any
floating-point representation that represents a restricted whole
number can always be faithfully coerced to an integer
representation.
----------
I will see if someone can look over the Deal problem. Thank
you for letting us know about it.
Best regards.
--Jon
Alexander Skomorokhov wrote:
>
> Hello,
>
> the following looks like a bug:
> -----------------------------------------------------------------------------------------
> This version is Release 4.18
> Thu Sep 6 21:11:36 MSD 2001 on suse
> ?16
> 7
> 2?15
> 1 10
> 2?16
> г[error] : segv
> * ->
> memory violation flag dc(135136704) aborted
> memory violation flag dc(135136768) aborted
> г[error] : segv
> * ->
> г[error] : segv
> *
> ----------------------------------------------------------------------------------------
>
> A "magic" number is 16 as a right argument of Deal.
> Note, that $reset or right arroe (-->) doesn't help.
>
> Also, what does it mean "__restricted__ whole numbers" in function description (Reference Manuals)?
>
> Thanks,
> Alexander.
More information about the apluslist
mailing list