{"action":"opened","issue":{"url":"https://api.github.com/repos/jackparmer/colorlover/issues/7","repository_url":"https://api.github.com/repos/jackparmer/colorlover","labels_url":"https://api.github.com/repos/jackparmer/colorlover/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/jackparmer/colorlover/issues/7/comments","events_url":"https://api.github.com/repos/jackparmer/colorlover/issues/7/events","html_url":"https://github.com/jackparmer/colorlover/issues/7","id":151219167,"number":7,"title":"divid by 0 in interp()","user":{"login":"garyfeng","id":1084989,"avatar_url":"https://avatars.githubusercontent.com/u/1084989?v=3","gravatar_id":"","url":"https://api.github.com/users/garyfeng","html_url":"https://github.com/garyfeng","followers_url":"https://api.github.com/users/garyfeng/followers","following_url":"https://api.github.com/users/garyfeng/following{/other_user}","gists_url":"https://api.github.com/users/garyfeng/gists{/gist_id}","starred_url":"https://api.github.com/users/garyfeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyfeng/subscriptions","organizations_url":"https://api.github.com/users/garyfeng/orgs","repos_url":"https://api.github.com/users/garyfeng/repos","events_url":"https://api.github.com/users/garyfeng/events{/privacy}","received_events_url":"https://api.github.com/users/garyfeng/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-26T19:28:19Z","updated_at":"2016-04-26T19:28:19Z","closed_at":null,"body":"The following code\r\n\r\n```\r\nimport colorlover as cl\r\ncl.interp( cl.scales['3']['div']['RdYlBu'], 5) \r\n```\r\n\r\ngenerates:\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nZeroDivisionError                         Traceback (most recent call last)\r\n<ipython-input-8-14a39fa30bf3> in <module>()\r\n      1 import colorlover as cl\r\n----> 2 cl.interp( cl.scales['3']['div']['RdYlBu'], 5)\r\n\r\n/Users/garyfeng/anaconda/lib/python2.7/site-packages/colorlover/__init__.py in interp(scl, r)\r\n   1821         # garyfeng: c_i could be rounded up so scl[c_i+1] will go off range\r\n   1822         #c_i = int(i*math.floor(SCL_FI)/round(r[-1])) # start color index\r\n-> 1823         c_i = int(math.floor(i*math.floor(SCL_FI)/round(r[-1]))) # start color index\r\n   1824         hsl_o = rgb_to_hsl( scl[c_i] ) # convert rgb to hls\r\n   1825         hsl_f = rgb_to_hsl( scl[c_i+1] ) if c_i < len(scl)-1 else hsl_o\r\n\r\nZeroDivisionError: float division by zero\r\n\r\n```\r\n\r\nApparently `round(r[-1])==0`. "}}