MathGroup Archive 2007

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

Search the Archive

Re: problem with parsing InputForm scientific notation (eg. 3.`*^-7)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80759] Re: problem with parsing InputForm scientific notation (eg. 3.`*^-7)
  • From: j.f.b.payne at tesco.net
  • Date: Sat, 1 Sep 2007 00:22:30 -0400 (EDT)
  • References: <fara85$4jd$1@smc.vnet.net>

I see the same thing as Chris (and I've noticed it happening before,
although I haven't pinned it down neatly, as Chris has).

I wonder whether to blame the editor, rather than the parser.  The
editor looks at the expression, to determine its layout (e.g. put
linebreaks at end of syntactical groups). But it actually also (or
consequently?) rephrases what was typed.

Thus, if you straightforwardly enter RealDigits[3.`*^7] then Show
expression yields

Cell[BoxData[
 RowBox[{"RealDigits", "[", "3.`*^7", "]"}]], "Input",
 CellChangeTimes->{{3.397549004920188*^9, 3.3975490074930663`*^9}, {
   3.3975492209091787`*^9, 3.397549228220056*^9},
3.397549302921195*^9},
 FormatType->"InputForm"]

On the other hand, if you produce it by editing, as per Chris's
recipe, Show expression yields

Cell[BoxData[
 RowBox[{"RealDigits", "[",
  RowBox[{"3.`", "*",
   RowBox[{"^", "7"}]}], "]"}]], "Input",
 CellChangeTimes->{{3.397549004920188*^9, 3.3975490074930663`*^9},
   3.3975490970532618`*^9, {3.397549245916384*^9,
3.3975492608986745`*^9}}]

Notice that "3.`*^7" has got broken up into RowBox-es. Presumably the
parser doesn't like that, and I can't say I blame it.



On 26 Aug, 08:31, "Chris Chiasson" <ch... at chiasson.name> wrote:
> Can anyone confirm this report?
>
> Steps to reproduce:
> 1. Enter "3.`*^-7" (without quotation marks) into an Input cell and evaluate it.
> 2. Go back to the Input cell, put your cursor at the beginning and
> enter "RealDigits["
> 3. Hit the End key, type "]" and then re-evaluate the cell, which by
> now reads "RealDigits[3.`*^-7]", but don't enter that directly.
>
> I have encountered other errors where InputForm messes up the syntax
> checker, but I haven't been able to make a small reproducible example
> like this one.
>
> Version 6.0.1 on MS Windows XP SP2
>
> --http://chris.chiasson.name/




  • Prev by Date: is there a better way to do constraint logic programming in Mathematica?
  • Next by Date: Re: [Mathematica 6] Bug in Labeled, Center align option not accepted.
  • Previous by thread: Re: Re: problem with parsing InputForm scientific notation (eg. 3.`*^-7)
  • Next by thread: making a fast projection of a crytsallographic unit cell