Skip to content

JuliaMath/ILog2.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ILog2

Build Status Codecov Aqua QA

This package provides a fast implementation of the integer-valued, base-2 logarithm. ilog2 supports other types of numbers, as well. It also provides checkispow2.

ilog2(n::Real) compute the largest m such that 2^m <= n.

ilog2(n::Real, RoundUp) compute the smallest m such that 2^m >= n.

checkispow2(n::Number) returns ilog2(n) if n is a power of two. Otherwise throws a DomainError.