Skip to main content
edited tags
Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Source Link

How to use fixed point decimals in emacs lisp?

How to use large decimal numbers with fixed precision, like money amount, in emacs lisp? For example, I'm writing a function that takes amount of money as a parameter. When I pass large float like 999999999999999.01 it looses precision and becomes 999999999999999.0. I didn't find fixed type in manual. My workarounds are:

  1. Pass two integers separately, integer part and fraction part - like dollars and cents
  2. Pass amount as string and parse it to two integers,

but both of this approaches will be less convenient for users.