Sha256: 1563a49ec4384cfea3650630f312d89d6d6c4649bb08aa517291598ba3c4fac6
Contents?: true
Size: 362 Bytes
Versions: 37
Compression:
Stored size: 362 Bytes
Contents
static dtype pow_<%=type_name%>(dtype x, int p) { dtype r = m_one; switch(p) { case 2: return m_square(x); case 3: return m_mul(m_square(x),x); case 1: return x; case 0: return m_one; } if (p<0) return m_zero; while (p) { if ((p%2) == 1) r = m_mul(r,x); x = m_square(x); p /= 2; } return r; }
Version data entries
37 entries across 37 versions & 2 rubygems