formatting numerical output to fixed decimal precision

formatting numerical output to fixed decimal precision

Post by yoyotwea » Sat, 05 Mar 2005 01:08:19


Is there a way to format text file write outputs for numerical values
in a fixed decimal precision?

Thanks!

Bill
 
 
 

formatting numerical output to fixed decimal precision

Post by Mike Willi » Sat, 05 Mar 2005 05:39:05


You can convert it to a string with str

For example:

#write( ftest, "< ",str(u_point,2,2),",",str(v_point,2,2)," > \n")

Produces output that looks like this:

< 0.03,-0.38 >
< 0.04,-0.39 >
< 0.05,-0.39 >
< 0.06,-0.40 >

--
Mike Williams
Gentleman of Leisure