Developer Tool
Hey all!
I made this script for developers who don't like Lua's default inaccurate math.round(). Why? Because it fails!


All description you need is on the picture.
In fact my small function corrects the math.round() whenever it returns a wrong value.
For example, math.round(2.3) returns you a 3.
Quote
math.round(2.1) => 3
math.round(2.7) => 3
My round() :
round(2.1) => 2
round(2.7) => 3
math.round(2.7) => 3
My round() :
round(2.1) => 2
round(2.7) => 3

1. Add the whole part of the code to your script or add the file with dofile(better_rounding.lua)
2. Use round(2.3) instead math.round(2.3) !


There're no restrictions. Use the code how you want!
But please don't reupload it anywhere and say it's yours! (the code is very simple and you're just an idiot if you do that ;))
About:
Only 8 lines of code and 115 characters. Smallest script (function) I've ever made.
edited 4×, last 29.01.12 04:00:21 am
Approved by GeoB99
Download
39 kb, 502 Downloads