Arbitrary Precision Floating Point (APFP)

by Dennis Darland - pal at dennisdarland dot com
dennisdarland.com
Comments welcome
  1. Arbitrary precision floating point library written in Ruby

  2. Demos of Complex Number Calculator (version 0006 on 3/5/2015) with everything that was wrong fixed as far as I know

    I can thing of improvements - such as red error messages
    1. Complex Number Calculator 6 Demo 1 simple imaginary values
    2. Complex Number Calculator 6 Demo 2 simple complex arithmetic
    3. Complex Number Calculator 6 Demo 3 trig functions (some had trouble before - now work)
    4. Complex Number Calculator 6 Demo 4 trig, inverse trig, hyperbolic, and inverse hyperbolic functions of complex values
    5. Complex Number Calculator 6 Demo 5 some log and exponentiation
    6. Complex Number Calculator 6 Demo 6 misc functions
    7. Complex Number Calculator 6 Demo 7 calculating with lower precision
  3. Original Demos of Complex Number Calculator - I'm not used to doing this as you can tell.

    1. Complex Number Calculator Demo 1 - The values were at least approximate - compared with Maple - but I later discovered I used wrong version of library
    2. Complex Number Calculator Demo 2 - with correct library - the problem had been noticed with asin
    3. Complex Number Calculator Demo 3 - add, subtract, multiply divide
    4. Complex Number Calculator Demo 4 - trig - worked until 5 minute video time limit ran out on tan of pi/2 which failed
    5. Complex Number Calculator Demo 5 - trig - tan pi/2 failing
    6. Complex Number Calculator Demo 6 - trig - tan pi/4 worked but arctan of result failed
    7. Complex Number Calculator Demo 7 - trig and arc-trig of 0.1
    8. Complex Number Calculator Demo 8 - trig and arc-trig of complex value (0.1 + 0.2i)
    9. Complex Number Calculator Demo 9 - hyperbolic and arc-hyperbolic of complex values - also log and exp (0.3 + 0.2i)
    10. Complex Number Calculator Demo 10 - other functions
    11. Complex Number Calculator Demo 11 - entering using scientific notation
    12. Complex Number Calculator Demo 12 - entering data less accurately known
  4. Work Toward Using APFP in my systems of differential equations (SODE) program

  5. For Comparison to Maple

    1. Values for comparison from Maple 18 for Demo 1
    2. Values for comparison from Maple 18 for Demo 2
    3. Values for comparison from Maple 18 for Demo 3
    4. Values for comparison from Maple 18 for Demos 4 to 10
    I compared all the cases where APFP returned numeric answers for demos 2-10 and the answers were very accurate.
    Demo 1 was using a wrong library and arcsin was off & threw off subsequent answers in that demo.
    It appeared that deviations were on the order of magnitude of the estimated error but I would have to rely on an automated test to determine that conclusively.
    There were execution errors on tan(pi/2), and arctan(1)
  6. Experimenting with Maple 18 Interval Arithmetic

  7. 4/8/2015 Extensive Batch Tests

    This is from version in aptst0007.zip
    Fixed big problem in comparison operators.
    Also removed handling for special cases as this invalidates error estimate.
    As result fails for arcsin & arccos of +/-1.
    This version is in the file released as aptst0007.zip - it is the correct version although the subdirectory is aptst002 - I do not manage to coordinate all numbers I use.
    1. Old Test (more limited testing)
      1. The Ruby Program to generate a Ruby program to generate a Maple test program
      2. The generated Ruby program to generate a Maple test program
      3. The generated Maple test program
      4. Test Results - Just all functions
      5. Test Results EXCEPTIONS - all functions
      6. Ap.rb
      7. ApConfig.rb
      8. Apc.rb
      9. Apfp.rb
      10. Real.rb
    2. More thorough tests - input error given as 1.0e-13
      1. The Ruby Program to generate a Ruby program to generate a Maple test program
      2. The generated Ruby program to generate a Maple test program
      3. The generated Maple test program
      4. Test Results - Just all functions
      5. Test Results EXCEPTIONS - all functions
    3. More thorough tests - input error given as 1.0e-21
      1. The Ruby Program to generate a Ruby program to generate a Maple test program
      2. The generated Ruby program to generate a Maple test program
      3. The generated Maple test program
      4. Test Results - Just all functions
      5. Test Results EXCEPTIONS - all functions
    4. More thorough tests - input error given as 1.0e-29
      1. The Ruby Program to generate a Ruby program to generate a Maple test program
      2. The generated Ruby program to generate a Maple test program
      3. The generated Maple test program
      4. Test Results - Just all functions
      5. Test Results EXCEPTIONS - all functions
    5. More thorough tests - input error given as 1.0e-34
      1. The Ruby Program to generate a Ruby program to generate a Maple test program
      2. The generated Ruby program to generate a Maple test program
      3. The generated Maple test program
      4. Test Results - Just all functions
      5. Test Results EXCEPTIONS - all functions
    6. More tests - of operators rather than functions
      1. The Ruby Program to generate a Ruby program to generate a Maple test program
      2. The generated Ruby program to generate a Maple test program
      3. The generated Maple test program
      4. Test Results - Just all operators
      5. Test Results EXCEPTIONS - all operators
  8. NOTE: although the directory has the suffix "old" - it is not the old version - I should have used "src" - it just had to be different from the target directory.

  9. Also the download link is in the README for Installing file below! Save the link to the directions as they are not included in the download!

  10. NOTES


    1. 2/3/2010 Start development of regression test for APFP (Ruby program to generate a Ruby Program to generate a Maple Program to compare answers.
    2. 2/5/2010 Test program for APFP almost finished.
    3. 2/6/2010 Test program basically finished - tests ran OK on sin, cos and tan.
    4. 2/7/2010 Tested all functions - fixed some problems - log, log10 and sqrt not as accurate as desired.
      sinh and tanh also had one problem.
    5. 2/8/2010 Enhanced information in Exception file and added time info. Maple took about 16 minutes clock time - but I didn't find a function for that.
    6. 2/13/2010 Struggling with how to compute logarithms - I see what is wrong - but not how to fix it.
    7. 2/13/2010 Fixed problems with logarithms and other less difficult problems. Links to programs and results below.
      Maple produces results almost immediately if screen output is suppressed by using ":" instead of ";"
    8. 2/15/2010 Correction to calculation of percentage
    9. Samples:
      The Ruby Program to generate a Ruby program to generate a Maple test program
      The generated Ruby program to generate a Maple test program
      The generated Maple test program
      Test Results - Just all functions
      Test Results EXCEPTIONS - all functions
      Ap.rb
      ApConfig.rb
      Apc.rb
      Apfp.rb
      Real.rb
    10. NOTE about purpose of Apfp. I am trying to write an arbitrary precision floating point with a capability of tracking the possible error in values calculated from possible error in input or through rounding error. It is very slow, but its purpose is not speed. It is mainly an experiment to see how errors may propagate in calculations. In fact, in the tests above I am calculating to only 16 digits. But in practical applications I doubt if inputs are often known to this accuracy. Larger input errors can be specified as +/-error in literals. I think some improvements in both speed and accuracy are still possible - but it will never be very fast.
    11. Worked on Documentation: (via simple sample program)
      Sample program with comments
      Results are in: (I haven't checked all of them closely - I did check the comparison operators and made some improvements
      The tests above were also updated.
      Results from sample program.
      Generated rdoc files (documentation)
    12. Plan to set up calculator using APFP under Ruby on Rails
    13. 10:01:22 PM Wed, Feb 18 2015 Started up setting up Ruby on Rails under Windows 8.1 on development machine.
    14. Got it installed - there was initially an error and I had to manually install several gems.
    15. WEBrick seems to be working.
    16. I've had calculator working on my web site before - under much earlier versions of Rails.
    17. But it would always stop working
    18. It is very CPU intensive - I think my hosting service would disable it because of that.
    19. Now I only intend to run it locally.
    20. 11:51:24 PM Thu, Feb 19 2015
    21. Took a lot of time to set up routes.
    22. Then ran into problem with sessions - cookies taking up too much space.
    23. Fouled up rails installation debugging that.
    24. Unintalled Ruby, Rails, etc - starting over.
    25. Learned a lot about configuring Rails.
    26. 05:30:41 PM Fri, Feb 20 2015
    27. Calculators for both Real and Complex APFP numbers working!!!
    28. 10:05:46 PM Tue, Feb 24 2015
    29. Got Screen captures - resolution not what I would like
    30. APFP Real Number Calculator Image
    31. APFP Complex Number Calculator Image
    32. 07:42:46 PM Wed, Feb 25 2015
    33. Worked on installation procedure
    34. 2/26/2015 - Fixed a couple bugs in installation procedure and updated README for Installing above.
      Later discovered that version on rapfp library I grabbed for rails - switched to one which I ran tests below on.
      Had noticed error in asin which was correct in this version.
      Doing more testing while working also on more demos.
      Use realcalc0003.zip and compcalc00031.zip
    35. Initially developed as procedures in Icon then reworked as classes & overloaded operators in Unicon.
    36. Reworked much more elegantly in Ruby. Mostly because of greatly increased knowledge of problem from having done it before. Also conciseness of Ruby.
    37. 2/25/2015 added ruby on rails calculators
    38. 3/1/2015 Setup and ran aptst.rb
      Found I had to change some "require" statements to "require_relative".
    39. Then reworked totally the error handling in Apfp.rb
      Added error_flag to class - always initialized to false.
      Added function to report error - or if method is given value that had error previously.
      Added function to set error and then call function reporting it.
      All errors seem to be because of domain errors.
      The check is not catching all cases - because of "fuzziness" of comparisons - (or some may be missing) - doesn't always catch very close cases.
      I think I already have functions that can do tests - but I will have to examine each case carefully.
    40. Then I will have to make the rails code use this error handling also.
    41. It is past 5:00am (3/1/2015) so I am done for the night - as was on a roll, I did not want to quit - I will sleep better.
    42. Worked till 4:00am (3/2/2015) then again in afternoon - uploaded new versions realcalc0004.zip, compcalc0004.zip, and also batch test aptst0004.zip
      Also text files of batch tests below
    43. Need to redo demos - but too tired - will wait until I am fresher.
    44. Sourceforge Project Apfp page APFP PAGE
Dennis J. Darland
SourceForge Logo