[Haskell-cafe] Implementation of scaled integers
Stefan Heinzmann
stefan_heinzmann at yahoo.com
Tue Feb 13 14:15:22 EST 2007
Hi all,
is there a library for Haskell that implements scaled integers, i.e.
integers with a fixed scale factor so that the scale factor does not
need to be stored, but is part of the type?
In particular it would be useful (i.e. for signal processing) to have
numbers based on Int scaled such that they fall into the range [-1.0 ..
1.0). Or other scale factors which are powers of 2. Addition and
subtraction would then map to the ordinary operations for Int, while
Multiplication and Division would have to apply the scale factor to
correct the result of normal Int operations (which would be a shift
operation).
If it doesn't exist yet, have you got ideas how to implement that for
maximum efficiency?
Cheers
Stefan
More information about the Haskell-Cafe
mailing list