MathGroup Archive 2005

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

Search the Archive

Re: appending '.' in CForm


Hi Matt,
Before printing change your Integers to Reals, e.g. by wrapping the 
whole expression in N[]. E.g.

CForm[N[3]]
gives 3.

Sincerely, Daniel

Matt Flax wrote:
> Hello,
> 
> I have an equation which symbolicly evals. to a 1 MB file when streamed 
> to file using CForm ... it is a very very long equation !
> 
> I am unsatisfied with the results of CForm, because it writes longs, 
> rather then writing doubles out ... for example :
>       314572800*Power(b,2)*Power(d,4)*dr*e*Power(f,6)*Power(t,10)*
> instead of :
>       314572800.0*Power(b,2)*Power(d,4)*dr*e*Power(f,6)*Power(t,10)*
> 
> The issue is that the integer aproaches the limit of max. int. which is 
> listed in values.h (GNU compiler).
> 
> So ... how would I force CForm to print out integers as doubles ?
> 
> thanks
> Matt


  • Prev by Date: saving data in a new cell
  • Next by Date: Re: ReplaceAll / sequential replacements versus joint replacement
  • Previous by thread: appending '.' in CForm
  • Next by thread: Re: appending '.' in CForm