lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Double precision floating point can represent all integers up to +-2^53 exactly. You should represent your amounts as the smallest unit of currency, such as cents. Also be sure to round results to the nearest integer after all multiplications and divisions. Additions and subtraction of integer values will be exact.

Sent from my Samsung device over Bell's LTE network.

-------- Original message --------
From: Matthias Kluwe <>
Date: 09-05-2016 9:34 AM (GMT-05:00)
To: Lua mailing list <>
Subject: Re: Currency representation in Lua


Am 05.09.2016 03:40 schrieb "Diogo Mildenberger" <>:

> Has someone any experience to share about implementing a system that deals with currency values? I have already been bitten by the problems described in and I want to find a better way.

Before jumping to conclusions, I'd like to know what proble you actually encountered (besides from "my numbers don't add up").