pythonmath

Fixed-point arithmetic


Does anyone know of a library to do fixed point arithmetic in Python? Or, does anyone has sample code?


Solution

  • If you are interested in doing fixed point arithmetic, the Python Standard Library has a decimal module that can do it.

    Actually, it has a more flexible floating point ability than the built-in too. By flexible I mean that it:

    All in all, it is handy for a million household uses.