Fractions!

2010

Today, I bring you yet another update to GlassCalc.  Version 1.32 can now display output as fractions using an algorithm by John Kennedy described here.  To display a result as a fraction, end it with ->frac, i.e. 0.5->frac = 1/2.   The -> operator (for output in fractions and different bases) also has syntax highlighting now.

I got a bug report earlier alerting me that 22.4 - 21.5 resulted in 0.899999999999999.  This happens because there are some numbers which cannot be represented exactly as floating point numbers.  22.4 and 0.9 happen to be two of those numbers. (If you don’t believe me, check out this floating point applet and enter “22.4” in the decimal box.  GlassCalc has 64 bit precision instead of 32, but the same idea applies.)  As a result, 22.4 - 21.5 almost equals 0.9, but not quite.

Unless someone invents a computer that operates in base 10, there’s no way to really fix this problem, but there are a couple ways to hide it.  One is to use higher precision floating point numbers to reduce the error, but I can’t do that until I finish porting MTParser to C#.  The other is to round results to hide the error in the last decimal place.  By default, GlassCalc now rounds to 14 places when displaying numbers.  You can change how much GlassCalc rounds (or turn rounding off) from the settings menu.  This rounding only applies to the numbers when they are displayed, so your calculations will be just as accurate (or inaccurate) as they were before.

Pi is another number that cannot be represented exactly in floating point. (It can’t be represented exactly in decimal either)  As a result, cos(pi/2) and sin(pi) resulted in very small, but non-zero numbers.  I’ve added a couple overrides into cos() and sin() so that they will return exactly 0 when they’re supposed to.  Again, this isn’t perfect.  sin(11pi) won’t return exactly 0, but it’s better than nothing.

Other improvements in the version include: smarter detection of changes in extensions.ini, single digit exponents are no longer padded with a zero, saved history no longer forgets the bases of results, and switching between radians and degrees scrolls the history list to the bottom.

Check the GlassCalc page for download links.

Mangafox Userscript Version 1.3

2010

I discovered a bug in my Mangafox userscript where it failed to clear old entries from its cache.  This update fixes that bug as well as a few others.  In Opera, the script was showing up in the debugger on pages other than mangafox.com.  Just to be safe, I added an extra check to make sure it would only be loaded on mangafox.com.

This update also adds a ‘Reload page’ button which might save you in the rare instance that a page never loads.  If clicking it once doesn’t help, double click it and it will force the browser to redownload the image.  I also renamed the ‘clear cache’ button  to ‘Reload chapter’ since that better describes what the button does.

If you use d.i.z.’s fantastic UJS Manager extension, most of the script settings can now be edited directly from UJS Manager.  If you don’t, the settings section will be a little harder to read, but it should still be manageable.

Download Mangafox Ajax Preloader version 1.3 for Opera or for Firefox (same file, different names)