See this reddit post. My module has a different name and is based on this open-license implementation which uses different math.