Re: Converting Rationals into Reals
- To: mathgroup at smc.vnet.net
- Subject: [mg62037] Re: Converting Rationals into Reals
- From: Peter Pein <petsie at dordos.net>
- Date: Wed, 9 Nov 2005 05:05:58 -0500 (EST)
- References: <dksdsr$ha8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
kristoph schrieb: > I would like to know how I can convert rationals into reals with four > digits. I know this sounds stange but I need the numbers for a diagram. > > If anyone knows how to covert a whole list of rationals into into four > digit reals I would be very happy. > > Thank you very much for help. > Kristoph > Hi Kristoph In[1]:= rat = Table[Random[Integer, {-10, 10}]/Random[Integer, {1, 10}], {7}] Out[1]= {-1, -(3/8), -(1/4), 5/4, 1/3, 1, 7/4} In[2]:= PaddedForm[N[#], {7, 4}, NumberPadding -> {" ", "0"}]& /@ rat Out[2]= { -1.0000, -0.3750, -0.2500, 1.2500, 0.3333, 1.0000, 1.7500} Peter