Re: ? write/save truncated numbers to file
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1970] Re: [mg1953] ? write/save truncated numbers to file
- From: m1mef00 at FRB.GOV
- Date: Wed, 30 Aug 1995 01:50:30 -0400
Thang Cao Nguyen writes:
>> The idea is that i don't need to save full-accuracy numbers (often
>> reaching 14-15 decimal places), and instead wanted, say, 2-3 decimal
>> places.
Will this help?
In[60]:= round[x_, dec_:3] := N[Round[10^dec x]/10^dec]
In[61]:= FullForm /@ {N[1 + 1/7], round[1 + 1/7]}
Out[61]= {1.142857142857143, 1.143}
--Mark
Mark Fisher
Mail Stop 91
Federal Reserve Board
Washington, DC 20551
voice: 202-452-2258
fax: 202-452-3819
e-mail: mfisher at frb.gov