Mat Posted September 19, 2009 Posted September 19, 2009 (edited) I stumbled across a website the other day that said only one interesting thing... That you round -1.5 to -2. I have always been taught this should in fact be -1, so I asked wikipedia, found out there is actually about 8 different ways to resolve tie breaks. So I did a lot of research into rounding, and made this function. The functions parameters are a bit too complex to be all listed here, alongsside other stuff I need to mention, so I made a simple web page for it. Download Link: http://code.google.com/p/m-a-t/downloads/detail?name=Advanced%20Rounding.zip Info Page: http://code.google.com/p/m-a-t/wiki/Rounding On the page is the download link as well as another link to a dialog I created that is pretty simple, but gives you all the options in a more usable way. I might release it as an actual program later, but its not particularly useful. Even If you have no need for either, it makes very interesting reading, and does teach you a lot about computing numbers and floats. Mat Edit: you know, I was kinda hoping someone MIGHT just be interested, but I've had 4 vistors to that page, with an interest span of... <10secs. Maybe it wasn't worth the bother. Edited February 17, 2010 by Mat AutoIt Project Listing
jvanegmond Posted September 21, 2009 Posted September 21, 2009 Hey Mat, that was very interesting to read! : ) I never knew there were different types of rounding either, but you explained it very simple. github.com/jvanegmond
Mat Posted September 21, 2009 Author Posted September 21, 2009 Thanks manadar, good to see someone read it! Its explained simple becouse I understand it simple. I should probably do this on the page; a list of my sources:1) Wikipedia2) Rounding and truncating functions (PDF) ^^ The above was very helpful, and is aimed at programming.3) DIY CalculatorWikipedia was the first thing I found (obviously!), the other two I found in the reference section there. The PDF is a VERY interesting read, and explains functions such as: Mod, Int, Round, Floor, Ceiling. It also gives other ideas like getting the fractional part etc.Mat AutoIt Project Listing
jvanegmond Posted September 21, 2009 Posted September 21, 2009 I'm definitely bookmarking this thread. I have a feeling it will be useful in the future. github.com/jvanegmond
Mat Posted September 21, 2009 Author Posted September 21, 2009 Thanks again manadar! This was written as a function for my minicalculator script (just passed 2000 lines), and there it is proving incredibly useful!!! The other thing I'm thinking of is combining this with some bigint functions... creating myself a kind of "pure maths" udf. Shouldn't be too hard... I could add some other functions i've done like my root function. Why maths excites me I will never know. Mat AutoIt Project Listing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now