Re:FractionalPart
- To: mathgroup at smc.vnet.net
- Subject: [mg31246] Re:FractionalPart
- From: "Zhang Liwen" <gzgear at hotmail.com>
- Date: Tue, 23 Oct 2001 04:53:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Juan,
You can try the following routine.
In[43]:=
FractionNew[x_] := Module[{},
(t1 = Round[x];
t2 = t1 - x // Chop;
If[t2 == 0, result = t2, result = FractionalPart[x]];
result)];
In[47]:=
a = Range[9]^2
x = Exp[.5 Log[a]]
Map[FractionNew[#] &, x]
Out[47]=
{1, 4, 9, 16, 25, 36, 49, 64, 81}
Out[48]=
{1, 2., 3., 4., 5., 6., 7., 8., 9.}
Out[49]=
{0, 0, 0, 0, 0, 0, 0, 0, 0}
_________________________________________________________________