Page 1 of 1

Math with alot of decimals

Posted: Fri Oct 16, 2009 3:49 pm
by kalle2990
I'm making a replacement for some common math calculations in lua, it will have functions instead of writing like '10 + 5', so it won't be exactly the same. So far, I've only done plus (+) and greater than (>), but I'm planning to add more, for example minus (-), multiplication (*), division (/), ! and ^. Well, why am I making this when it already exists? Because it supports much more decimals than the current one, actually, it supports as many decimals as the highest lua number (except from math.huge). It's rather fast and when I ran the first time test on plus calculation (which isn't a fair time testing calculation, it's not very complicated), with 100 digits and it took only a little less than 0.001 seconds.
Do you think this could be useful? Or maybe a fun test, I want your thoughts ^^

Re: Math with alot of decimals

Posted: Sat Oct 17, 2009 8:53 am
by Tenoch
Such a library should probably be implemented in C to be faster.
Well actually, here is one: http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lbc

Although it is indeed interesting to code stuff for the fun, I doubt that big numbers (arbitrary precision) are necessary for game development. I'd like to see your code though :)

Re: Math with alot of decimals

Posted: Sat Oct 17, 2009 10:35 am
by kalle2990
Well, I guess it's pretty useless, and it's pretty boring to make too... :death:
And I wanna get started with my GUI for LÖVE 0.6.0, so I will publish the code here, having addition (math2.AddMultiple) and greater than (math2.IsBigger).
Math2.love
An example including all the functions
(1.77 KiB) Downloaded 188 times