All pastes #902842 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-02-13 20:08 UTC
rendered paste body
# 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'