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

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

Search the Archive

Re: appending '.' in CForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55447] Re: appending '.' in CForm
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 24 Mar 2005 03:41:47 -0500 (EST)
  • References: <d1rgua$42h$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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