Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Mata - ascii()


From   [email protected] (William Gould, Stata)
To   [email protected]
Subject   Re: st: Mata - ascii()
Date   Fri, 27 Jan 2006 08:15:21 -0600

David Harrison <[email protected]> asked, 

> Does anyone know if there is a good reason why the function -ascii()-
> returns values in the range -128 to 127 rather than 0 to 256?

I have recorded this as a bug and we will fix it; function -ascii()-
will return results in the range 0 through 255.

An overly detailed discussion of the issue follows.

In one sense, it does not matter whether the characters above 127 are
considered to be numbered 128 through 255 or -127 through -1; it's a 
matter of interpretation more than anything else.  Nevertheless, most 
people would expect the upper characters to be coded 128 through 255, 
and, if not for no other reason than that, Mata should treat the upper
characters as being coded 128 through 255.

In this case, however, the problem is more than just a matter of
interpretation.  David pointed out that that -char()- and -ascii()- ought to
be inverse functions and that, the way they are right now, they are not.
Changing the coding to all-positive will make them inverse functions again.

-- Bill
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index