Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*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 1992

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

Search the Archive

Fortran Format

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Fortran Format
  • From: CHALLACOMBE at baeyer.chem.fsu.edu
  • Date: Fri, 9 Oct 1992 9:06:24 -0400 (EDT)

MathGroup,

Franz Amador writes 

>> Is there a way to make Mathematica print numbers in a FORTRAN-like
>> way, e.g.  -2.45658E-3

one simple (string) function that does the job is

FortranFormat[x_]:=ToString[ PaddedForm[x,{14,13},
        { NumberFormat->(SequenceForm[#1,"D",#3]&),
          ExponentFunction->(If[#==0,0,#]&)}]];
	    
You may want to change the "D" to "E" for s.p. or diddle the # of decimals 
out put {14,13}.  
Hope this is usefull,
				Matt Challacombe
				Chemical Physics and the 
				Supercomputer Computations Research Inst.
				Tallahassee, FL.			





  • Prev by Date: Mma vectors do not have to be one-dimensional
  • Next by Date: Re:AllRoots
  • Previous by thread: Mma vectors do not have to be one-dimensional
  • Next by thread: AllRoots, indented and functionalized .....