lua-users home
lua-l archive

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


On 3/14/2012 4:37 PM, Axel Kittenberger wrote:
[snip]
I know of 4 ways to deal with this:
* Just live with your numbers to be inaccurate, compare with Deltas
and so. Fastest solution, most often used, least satisfactory if you
just need the precission.
* Have a "rationals" package. Most useful if you do not use irrational
things like sin(), PI or so, want precission, and don't run into the
big numbers problem. This kind of packages make out of numbers a
package that stores divisor and divident as seperate numbers. Clojure
comes to mind as a language that has this entities in the language
base package already.
* Have a "string numbers package" Useful if you have to deal with very
large numbers (64bit integer and beyond) and need precission to 1. The
computer calculates like a human with numbers represent as text.
Infinte size of numbers, very slow, always precise on integer.
* Have a package that splits every number into to floating points.
Where "your result" is represented by two limits, your result is
larger or equal than A and smaller or equal than B. Professional
calculations should work like this, speed is quite okay compared to
the naive approach.
[snip]

The original poster [1] has not replied. Since he used [2], he could easily have been a high school student exploring stuff. We did have people of high school age posting around here (and probably still do.) Or a non-programmer, for that matter.

Perhaps we have scared him off. :-) :-)

I would like to say that the list is usually very patient with people who are just starting to get into programming. We just lack a frame of reference in order to provide the best answers and guidance. The list help can point the way forward to someone just starting out.

[1] http://article.gmane.org/gmane.comp.lang.lua.general/89200
[2] http://www.lua.org/cgi-bin/demo

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia