Math.Utils
floorSqrt :: Int -> Int Source #
>>> floorSqrt 0 0 >>> floorSqrt 1 1 >>> floorSqrt 2 1 >>> floorSqrt 4 2 >>> floorSqrt (12345 * 12345) 12345 >>> floorSqrt (2^52 + 2^27) 67108864 >>> floorSqrt maxBound 3037000499
>>>
floorSqrt 0
floorSqrt 1
floorSqrt 2
floorSqrt 4
floorSqrt (12345 * 12345)
floorSqrt (2^52 + 2^27)
floorSqrt maxBound
floorLog2 :: Int -> Int Source #
BSR (Bit Scan Reverse)
>>> floorLog2 0 -1 >>> floorLog2 1 0 >>> floorLog2 2 1 >>> floorLog2 1023 9 >>> floorLog2 1024 10 >>> floorLog2 maxBound 62
floorLog2 0
floorLog2 1
floorLog2 2
floorLog2 1023
floorLog2 1024
floorLog2 maxBound