-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Round a set of numbers while maintaining its sum
--   
--   Round a set of numbers while maintaining its sum. According procedures
--   are used to assign seats to parties in a parliament. You may also use
--   it to round percentages that sum up to 100%.
--   <a>https://en.wikipedia.org/wiki/Apportionment_(politics)</a>
@package apportionment
@version 0.0.0.2

module Math.Apportionment

-- | This function rounds values such that the sum of the rounded values
--   matches the rounded sum of the original values.
--   
--   Also known as Hare-Niemeyer method.
--   <a>https://en.wikipedia.org/wiki/Largest_remainder_method</a>
--   
--   Input values must be non-negative, otherwise <a>properFraction</a>
--   bites us.
largestRemainder :: (RealFrac a) => [a] -> [Int]

-- | <tt>largestRemainderScaled s xs</tt> scales and rounds the values in
--   <tt>xs</tt> such that their sum becomes <tt>s</tt>.
--   
--   E.g. <tt>largestRemainderScaled 100 [1,2,3]</tt> returns integral
--   percentages proportional to 1:2:3.
largestRemainderScaled :: (RealFrac a) => Int -> [a] -> [Int]

-- | <a>https://en.wikipedia.org/wiki/Highest_averages_method</a>
--   
--   In <tt>highestAveragesScaled divs s xs</tt>, <tt>divs</tt> must be an
--   infinite list of strictly increasing positive numbers. E.g.
--   <tt>highestAveragesScaled dHondtDivisors s xs</tt> runs the d'Hondt
--   method.
highestAveragesScaled :: (RealFrac a) => [a] -> Int -> [a] -> [Int]
dHondtDivisors :: Num a => [a]
sainteLagueDivisors :: Num a => [a]
