Math with alot of decimals

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Math with alot of decimals

Post 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 ^^
User avatar
Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

Re: Math with alot of decimals

Post 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 :)
"When in doubt, use brute force." Ken Thompson
User avatar
kalle2990
Party member
Posts: 245
Joined: Sat Sep 12, 2009 1:17 pm
Location: Sweden

Re: Math with alot of decimals

Post 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 185 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 7 guests