Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'PaddedForm output using CForm' topicStudent Support Forum > General > "PaddedForm output using CForm"

Help | Reply To Topic
Author Comment/Response
Chris Riedel
10/19/99 11:27am

Hello,

I have been using PaddedForm in conjunction with CForm and FortanForm using Mathematica version 3.0 and 4.0 (under Windows)and have noticed a difference between the two versions. Here is an example:

g=0.00000123456789
PaddedForm[CForm[g],{10,4}]

Running this under version 3.0 gives

1.2346e-6

which is correct. However, running this under version 4.0 gives

1.23456789e-6

which is incorrect. This result appears on both the screen and in my data files when I use OpenWrite to send the data to a file. FortranForm has the same problem. What's happening here?

I need to import my data, which are usually small numbers, to other programs so it is important to have the data in either Fortran or C Form; i.e. written in exponential form.

Any suggestions?

Thanks,
Chris Riedel

URL: ,
Help | Reply To Topic