Re: Import/CForm
- To: mathgroup at smc.vnet.net
- Subject: [mg22626] Re: Import/CForm
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Thu, 16 Mar 2000 09:10:44 -0500 (EST)
- Organization: "Wolfram Research, Inc."
- References: <8an14r$1ml@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 14 Mar 2000, Bernd Brandt wrote: > I just started using Import[]. > I have a strange "problem". > > !!myfile > > In := 1 7.535733e-04 2.705774e+00 2.513866e+00 > > In := Dat= Import["myfile", "Table"] > > In := Dat[[1,2]] + 1 > Out := 1.00075 > > In := Dat[[1,3]] + 1 > > This cannot be evaluated, because 2.70e+00 is regarded as a word. > This is output from a C program (%e format). My C program prints > positive powers as qqe+xx. > Mathematica CForm indeed does not include the '+'. > > In := CForm[0.44*10^(+10)] > Out := 4.4e9 (* NOT 4.4e+09 *) > > Has anyone else run into this? Is seems a bit strange to have to delete > al "+" from the exponent with e.g a string replace. This is a known problem for which there exists an FAQ: http://support.wolfram.com/Kernel/Files/Fortran.html By adding a few lines to your kernel's init.m file, the problem just goes away. This will be fixed in post 4.0 releases of Mathematica. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. Disclaimer: Opinions expressed herein are those of the author alone.