[Numeric] ANN: apportionment
Henning Thielemann
lemming at henning-thielemann.de
Wed Aug 19 10:46:55 UTC 2015
I have uploaded a new package to Hackage implementing two methods for
rounding a set of numbers while maintaining their sum. Useful applications
are elections of parliaments and rounding percentages. E.g.
Prelude> Apportionment.largestRemainderScaled 100 [1,2,3 :: Double]
[17,33,50]
Prelude> Apportionment.largestRemainderScaled 100 [1,1,1 :: Double]
[34,33,33]
The package is very simple, yet useful. It's plain Haskell 98.
https://hackage.haskell.org/package/apportionment
More information about the Numeric
mailing list