Monday, September 17, 2012

Improvements to Integer Mode

Currently Integer mode only works with integers between -2,147,483,648 and 2147483647.  If your result goes over or under this range, the integer turns into a decimal and it stops trying to simplify that number down.  This was originally done for speed reasons, but also because it was much easier to implement.

I have been working the past week to change this over to allow for much larger integers.  I have wrote my own code, from scratch, to handle infinitely large integers (well, until you run out of memory that is).  My reasons to write things from scratch are:
  1. I don't have to worry about copyright issues with someone else's work.
  2. I can tune it to be as fast as possible for my specific needs.
  3. Best of all, it is a good learning experience!
My goal was to not increase integer execution time by more than 20% when using integers in the +/- 65,000 range.  I have accomplished this.  I think execution time has increased between 10-15%.  I was most concerned about these smaller integers since they are what will be used most often.  Once you start using integers over 65,000, execution time takes up to 40% longer (depending on what you are trying to simplify), but now you aren't limited in integer like you were before.


In addition, when using integer mode, I remove the decimal point button because decimals shouldn't be entered.  This is also changing with the next release.  You will be able to enter decimals in integer mode, and when you do, they will be converted to fractions for simplification.  For example, if you enter 0.123, it will be converted to 123/1000 as the result.  Further more, it will turn repeating decimals into fractions.  For example, entering 0.3333333333 will result in 1/3 when executing in integer mode.

These changes and more will be coming in the next release!

No comments:

Post a Comment