My submission for last week made use of my expression evaluator class. It evaluates user entered mathematical expressions using double precision math. I've also created a version that works with Bob Delaney's BigFloat plug-in for extended precision. It's almost a drop-in replacement for the original expression evaluator. So, I decided to come up with a project that would make use of user entered expressions in extended precision math. Against my better judgement, I decided to try writing a spreadsheet program. How hard could it possibly be to write a spreadsheet program in a week? Yeah right. Not surprisingly, this thing is a bit rough around the edges, and there are some bugs (refer to the notes in the download file), but it does basically work.
Since this is the final week of the Just Code Challenge, there's a special bonus: You get two for the price of one. There's the BigFloat version, and for those who would rather not download the BigFloat plug-in, there's a version that works with regular double precision math. To use the BigFloat version, you'll have to download and install Bob Delaney's free BigFloat plug-in: http://delaneyrm.com/fpPlugin.html
Other than the precision, the differences between the regular and the BigFloat versions are fairly minor.
- I haven't implemented functions Ceil(), Floor() or Int() in the BigFloat version;
- BigFloat doesn't generate NaN's, so divide by zero and math anomalies have to be trapped with exception handling, and I haven't found a convenient way to signal the user that this has occurred;
- The format() function doesn't work with BigFloats. So, the cell format command in the edit menu has no effect on the BigFloat version. But, it does work in the non-BigFloat version.
Due to time constraints, I haven't been able to test this thoroughly, and haven't had a chance to test it on anything newer than XOJO 2016r3 on a Mac which is my normal development configuration. If you have problems, please let me know.
The project file is here: BigFloat Spreadsheet Project
Please refer to the notes file that's included with the project.