Re: Is there a simple way to transform 1.1 to 11/10?
- To: mathgroup at smc.vnet.net
- Subject: [mg92976] Re: [mg92968] Is there a simple way to transform 1.1 to 11/10?
- From: Jan Schmedes <jasch at crustal.ucsb.edu>
- Date: Wed, 22 Oct 2008 05:35:42 -0400 (EDT)
- References: <200810211024.GAA04964@smc.vnet.net>
If you use something like rational[x_] = Round[Round[(x - Floor[x])^-1]*x]/Round[(x - Floor[x])^-1] you get for rational[1.0000001] 10000001/10000000 but for rational[1.0000000000001] you get 10007999171935/10007999171934 because 1.0000000000001-1 gives 9.99201*10^(-14) ... Cheers Jan On Oct 21, 2008, at 3:24 AM, Alain Cochard wrote: > > > The obvious > > In[1]:= x=1.1`Infinity > > is not syntactically correct. > > I understand that SetPrecision[1.1,Infinity] does not work either: > > In[3]:= SetPrecision[1.1,Infinity] > > 2476979795053773 > Out[3]= ---------------- > 2251799813685248 > > In[4]:= N[%,20] > > Out[4]= 1.1000000000000000888 > > I searched the newsgroup and thought I had the solution with > Rationalize: > > In[5]:= Rationalize[1.1,0] > > 11 > Out[5]= -- > 10 > > But > > In[9]:= Rationalize[1.000000001,0] > > 999999918 > Out[9]= --------- > 999999917 > > In[10]:= N[%,20] > > Out[10]= 1.0000000010000000830 > > So any simple way? > > Thanks, > Alain >
- References:
- Is there a simple way to transform 1.1 to 11/10?
- From: Alain Cochard <alain@geophysik.uni-muenchen.de>
- Is there a simple way to transform 1.1 to 11/10?