Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1993
*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 1993

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

Search the Archive

Re: I want to read numbers written in E-format.

  • To: mathgroup at yoda.physics.unc.edu, Peter Whaite <peta at cim.mcgill.ca>
  • Subject: Re: I want to read numbers written in E-format.
  • From: jacobson at cello.hpl.hp.com
  • Date: Mon, 20 Dec 93 08:39:22 -0800

Peter Whaite writes:

> I have programs that write Mma expressions to a file.  I bring this file into
> Mma using Get.  Unfortunately there are numbers in the file which are
> sometimes in e-format, so e.g. 1.234e+456 gets  parsed as 456 + 1.234*e.
> ReadList can handle e-format numbers but I can't use it.
> 
> I can do something like...
[scheme for altering the semantics of plus deleted.]

The proper way to do this is probably to write something involving
$PreRead to turn xxxe+yy into xxx*10^yy and xxxe-yy into xxx*10^-yy.

But another approach is to just transform the file first.  I'm sure
the problem is easy in sed, but if you are using emacs, my math-mode
for Gnu Emacs already has a function to do this.  Just get the file,
set "mark" and "point" and the beginning and end of the file, then
type ESC x math-transform-floats-in-region RET, and it will be done.

You can get math.el, which implements math-mode, from MathSource, or
by ftp from otter.stanford.edu, get mma/Utilities/math.el.Z.

  -- David Jacobson





  • Prev by Date: 3DBarChart and Windows PS
  • Next by Date: Re: I want to read numbers written in E-format.
  • Previous by thread: I want to read numbers written in E-format.
  • Next by thread: Re: I want to read numbers written in E-format.