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.