# holy hack # determine if a double has a repeating decimal d = 1.0/3.0 s = str(d)[2:] print 'val = ', d for i in xrange(len(s)/2): if(len(s.replace(s[0:i],''))==0): print 'repeating', s[0:i] break; else: print 'notrepeating'