lua-users home
lua-l archive

Re: Formatting numbers without precision loss

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


On 20/06/2023 16:12, Thijs Schreijer wrote:
On 20 Jun 2023, at 14:39, Marcus Mason <m4gicks@gmail.com> wrote:
how can I format the number in the code such that does not loose any precision in it’s
journey from; number => string => lua-parser => number ?
I believe the %q specifier was designed for this purpose
%q expects a string. Hence it will format the number in quotes, turning it into a string.
Thijs
I found another relevant article:
https://portal.ampl.com/docs/archive/first-website/REFS/rounding.pdf
and also this SO post:
https://stackoverflow.com/a/2174100/2633423
which links to the article above and other info.

AltStyle によって変換されたページ (->オリジナル) /