Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Leading Zeros? (question rephrased)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54453] Re: [mg54378] Leading Zeros? (question rephrased)
  • From: DrBob <drbob at bigfoot.com>
  • Date: Sun, 20 Feb 2005 00:11:09 -0500 (EST)
  • References: <200502190732.CAA06154@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

>> Are the leading zeros that I type into this list captured and stored
somehow by Mathematica?

No.

>> The question arises in part because there's a scientific journal
>> that identifies articles by "article numbers" rather than page numbers

These are character strings, NOT numbers.

>> 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.

In the following example, a is a String and b is an Integer. Period. You can do arithmetic with b, but not a. You can take substrings of a, but not b. Don't confuse them with each other.

a="000000574"

000000574

b=ToExpression@a

574

Bobby

On Sat, 19 Feb 2005 02:32:47 -0500 (EST), AES <siegman at stanford.edu> 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.]
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Bug Report - Two numerical values for a same variable
  • Next by Date: Re: Controlling program flow across cells
  • Previous by thread: Re: Leading Zeros? (question rephrased)
  • Next by thread: Re: Leading Zeros? (question rephrased)