Re: How to get result in shape of fraction in Mathematica 4.2

*To*: mathgroup at smc.vnet.net*Subject*: [mg91599] Re: How to get result in shape of fraction in Mathematica 4.2*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Thu, 28 Aug 2008 07:40:00 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <g95k9b$54b$1@smc.vnet.net>

b wrote: > When I calculate something I would like to get result in shape of fraction; > Like 1/2 not 0.5. > > How?? The best method to get exact results is to use infinite precision numbers [1], i.e. 314/100 rather than 3.14 or 2 rather than 2. or 2.0 Also you could set system variables such as *$Post* [2] or $PrePrint to Rationalize (or Rationalize[#, 0]&). In[1]:= 1 - 1/2 Out[1]= 1/2 In[2]:= 2*314/100 Out[2]= 157/25 In[3]:= $Post = Rationalize; In[4]:= 1 - .5 Out[4]= 1/2 In[5]:= 2*3.14 Out[5]= 157/25 In[6]:= $Post =.; Regards, - Jean-Marc [1] http://reference.wolfram.com/mathematica/tutorial/ArbitraryPrecisionNumbers.html [2] http://reference.wolfram.com/mathematica/ref/$Post.html