Re: Leading Zeros? (question rephrased)
- To: mathgroup at smc.vnet.net
- Subject: [mg54527] Re: [mg54378] Leading Zeros? (question rephrased)
- From: János <janos.lobb at yale.edu>
- Date: Tue, 22 Feb 2005 04:23:56 -0500 (EST)
- References: <200502190732.CAA06154@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I missed the computer science classes - actually there was no computer science at that time :), but in general the practice I think is this: If you plan to do computation with a value than store it as a number. If you do not do computation then store it as a string or text. Almost all languages are providing converters from string to number and vice versa. Now, there are cases when you use a number even if you do not do computation because of the storage of the number is more efficient than a string would be, like primary keys of database tables. In many cases like I mentioned above, some other constraints of optimizations are driving the selection of number or string, that is practice rules theory. János On Feb 19, 2005, at 2:32 AM, AES wrote: > Thanks for a couple of private msgs in response to my earlier post, but > my question is not how to format or display numbers with leading zeros. > Instead I'm asking, suppose I type > y = {001,002,003}; > into a newly opened "virgin" instance of Mathematica, without defining > any special formats or rules before I do this. > Are the leading zeros that I type into this list captured and stored > somehow by Mathematica? > Or is the default response that they're ignored and lost forever? (As > I > believe they are.) > ------------- > P.S. -- I'm not trying to argue what Mathematica should do, either way. > I'm just trying to learn whether Mathematica in particular, or > mathematics or computer science generally, has any "official policies" > on capturing or storing leading zeros that a user may type in, or that > may be loaded into a database. > The question arises in part because there's a scientific journal that > identifies articles by "article numbers" rather than page numbers, with > the initial digit of the article number sometimes being zero and > sometimes non-zero, and the zero when it's present being mandatory (at > least for some purposes). This number, moreover, is treated for some > purposes as a numerical value, though it's obviously also in some ways > a > "text label" rather than a numerical value. > Seem to me this is not a particularly wise design decision (although > it's the case for ZIP codes also), and I'm wondering if there's any > computer science thinking on it.] ------------------------------------------ "The shortest route between two points is the middleman" Ayn Rand
- References:
- Leading Zeros? (question rephrased)
- From: AES <siegman@stanford.edu>
- Leading Zeros? (question rephrased)