fast-digits-0.2.1.0: The fast library for integer-to-digits conversion.

Copyright (c) Andrew Lelechenko, 2015-2016 GPL-3 andrew.lelechenko@gmail.com experimental None Haskell2010

Data.FastDigits

Description

Convert an integer to digits and back. Usually this library is twice as fast as Data.Digits. For small bases and long numbers it may be up to 40 times faster.

Synopsis

# Documentation

Arguments

 :: Int The base to use -> Integer The number to convert -> [Int] Digits in reverse order

Return digits of a non-negative number in reverse order. Throw an error if number is negative or base is below 2.

digits 10 123 = [3, 2, 1]
digits 10 0   = []

Arguments

 :: (Integral a, Integral b) => a The base to use -> [b] The list of digits to convert -> Integer

Return an integer, built from given digits in reverse order. Condition 0 ≤ digit < base is not checked.

Arguments

 :: Word Precondition that base is ≥2 is not checked -> Natural -> [Word]

Return digits of a non-negative number in reverse order.