Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Perfect Cube
Date: Fri, 13 Feb 2009 06:19:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <gn33cl$nli$1@fred.mathworks.com>
References: <gn2kcl$c3d$1@fred.mathworks.com> <gn2vq9$c3b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1234505941 24242 172.30.248.37 (13 Feb 2009 06:19:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 13 Feb 2009 06:19:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:518044

"Husam Aldahiyat" <numandina@gmail.com> wrote in message <gn2vq9$c3b$1@fred.mathworks.com>...
> if mod(a^(1/3),1)
> 	s='no';
> else
> 	s='yes';
> end

  As Matt has shown, Husam, the test with a^(1/3) fails to work properly most of the time.  The trouble is with the fraction 1/3 which cannot be expressed exactly.  A 1/2 or 1/4 power seems to work all right as far as I have tried.  Algorithms do exist that can find any n-th root exactly for a number that is the n-th power of an integer.  I once found one in an ancient book on arithmetic that had belonged to my father.

Roger Stafford