The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

Math Software that supports BCD?
Message #1 Posted by Tim Wessman on 1 Apr 2010, 3:42 p.m.

Hello,

Is anyone aware of a mathematical suite that has an option to use BCD math instead of binary? (not something like the IBM BCD library, but more like matlab)

TW

Edited: 1 Apr 2010, 3:44 p.m.

      
Re: Math Software that supports BCD?
Message #2 Posted by Norman Dziedzic on 1 Apr 2010, 6:01 p.m.,
in response to message #1 by Tim Wessman

I don't know of any packages outside of the industrial software we use to program machine controllers but you have piqued my curiosity as to why you would want such a thing?

            
Re: Math Software that supports BCD?
Message #3 Posted by Tim Wessman on 1 Apr 2010, 7:54 p.m.,
in response to message #2 by Norman Dziedzic

Basically, for doing comparison against other sources when developing new math routines. For example, the FMRR calculation made for the 30b was very difficult to find things to compare against (granted, that is a specialized financial thing, but I've been hoping to find something for general usage for a while now). When you are implementing something new, and you have a slight difference in the last digit or two with what you are comparing against, is it difference in the algorithm? In the encoding? Do you have a bug? And so on. . .

Ideally, something that can be programmed/scripted allows good testing coverage.

TW

Edited: 1 Apr 2010, 8:23 p.m.

                  
Re: Math Software that supports BCD?
Message #4 Posted by hugh steers on 1 Apr 2010, 8:46 p.m.,
in response to message #3 by Tim Wessman

what you should do is use a multiprecision library (not necessarily in BCD) and make it work to 50 digits or so. then have it convert to strings and use those to compare your results. ie validate the resultant decimalised strings.

Suppose you want to verify a 12 figure answer, from the high precision library result first add ANS*5e-13 for 12 figure rounding, then convert to a string, then just keep the first 12 figures and compare.

                        
Re: Math Software that supports BCD?
Message #5 Posted by Tim Wessman on 1 Apr 2010, 9:16 p.m.,
in response to message #4 by hugh steers

Well, yes. There are definitely plenty of ways to do this. I was thinking it would be quite cool to be able to essentially "simulate" 12 digit, 15, 6 or whatever nicely. :-)

TW

                              
Re: Math Software that supports BCD?
Message #6 Posted by Pal G. on 2 Apr 2010, 12:45 a.m.,
in response to message #5 by Tim Wessman

Tim, have you looked at:

bc:

http://en.wikipedia.org/wiki/Bc_programming_language

.. or,

dc:

http://en.wikipedia.org/wiki/Dc_(Unix)

Unix, Linux, or Mac (Darwin).

                  
Re: Math Software that supports BCD?
Message #7 Posted by Bart (UK) on 2 Apr 2010, 3:07 a.m.,
in response to message #3 by Tim Wessman

Quote:
Ideally, something that can be programmed/scripted allows good testing coverage.
What you're actually looking at is "validation", a subset of a complete test plan/program.

Things to beware of:
-Using a single alternative comparison does not prove anything.
- If using more than one alternative source, how independent are they (be aware of: if they are using the same language, compiler, algorithms [e.g. both used snippets of the same publicly available -possibly erroneous- code], or similar coding logic, etc).
      
Re: Math Software that supports BCD?
Message #8 Posted by hugh steers on 1 Apr 2010, 6:40 p.m.,
in response to message #1 by Tim Wessman

source or exe?

here's my windows command line version of reckon. I use this for my own calculations.

www.voidware.com/reckon/reckon.exe

      
Re: Math Software that supports BCD?
Message #9 Posted by Alain Mellan on 2 Apr 2010, 1:47 a.m.,
in response to message #1 by Tim Wessman

Not really a math suite, but Python supports BCD computation with the decimal module.

$ python
>>> import decimal
>>> help(decimal)

Edited: 2 Apr 2010, 1:49 a.m.

      
Re: Math Software that supports BCD?
Message #10 Posted by Thomas Chrapkiewicz on 2 Apr 2010, 9:07 a.m.,
in response to message #1 by Tim Wessman

Not exactly Math Software, but PowerBasic has a BCD datatype.

TomC

            
Re: Math Software that supports BCD?
Message #11 Posted by Bill (Smithville, NJ) on 5 Apr 2010, 7:16 a.m.,
in response to message #10 by Thomas Chrapkiewicz

And if you really want to go old tech - definitely not Math Software - the old Turbo Pascal 3.0 had a BCD version that worked with Reals up to 18 Significant digits.

Bill

                  
Re: Math Software that supports BCD?
Message #12 Posted by Namir on 5 Apr 2010, 10:37 a.m.,
in response to message #11 by Bill (Smithville, NJ)

Ah Bill ... Turbo Pascal ... those were the days!!!

                        
Re: Math Software that supports BCD?
Message #13 Posted by Bill (Smithville, NJ) on 5 Apr 2010, 11:03 a.m.,
in response to message #12 by Namir

Hi Namir,

Quote:
Turbo Pascal ... those were the days!!!

What do you mean - I still use Turbo Pascal on a daily basis. Nothing works better for me for one-off utilities - data filter programs, etc. I do a lot of data collection, sometimes as often as every 6 seconds or so, and these generate very large files very quickly. So I use a Turbo Pascal Program to read the data and then output only the data I need at any particular time. Also useful for combining data into more usable subsets - such as hourly, daily or monthly.

Of course my new home computer is running 64 bit Windows 7 - which won't directly run my 16 bit programs. But Dosbox & virtual Machine work fine on it.

Bill

                              
Re: Math Software that supports BCD?
Message #14 Posted by Herbert Crepaz (UK) on 5 Apr 2010, 4:08 p.m.,
in response to message #13 by Bill (Smithville, NJ)

Hi Bill,

Quote:

What do you mean - I still use Turbo Pascal on a daily basis. Nothing works better for me for one-off utilities - data filter programs, etc. I do a lot of data collection, sometimes as often as every 6 seconds or so, and these generate very large files very quickly. So I use a Turbo Pascal Program to read the data and then output only the data I need at any particular time. Also useful for combining data into more usable subsets - such as hourly, daily or monthly.

Of course my new home computer is running 64 bit Windows 7 - which won't directly run my 16 bit programs. But Dosbox & virtual Machine work fine on it.




Then you might be interested in FreePascal. This is a modern Pascal compiler with excellent compatibility with TP 7.0. A native Win64 version can be found at: www.freepascal.org/

Herbert

                                    
Re: Math Software that supports BCD?
Message #15 Posted by Bill (Smithville, NJ) on 6 Apr 2010, 7:06 a.m.,
in response to message #14 by Herbert Crepaz (UK)

Herbert,

Thanks for the link to Free Pascal. I just downloaded it and the supporting documentation. I'll give it a try this weekend.

Thinking of Turbo Pascal 7.0, I remember when we upgraded to it at work, we paid "$45 Freight" instead of "shipping" charges due to the large amount of documentation that came with it. Man, those were the days - when computer programs came with full printed documentation.

Bill

                                          
Re: Math Software that supports BCD?
Message #16 Posted by David Hayden on 6 Apr 2010, 10:17 p.m.,
in response to message #15 by Bill (Smithville, NJ)

Bill,

You might also consider trying Delphi. It's a Pascal language with fabulous windows support.

                                                
Re: Math Software that supports BCD?
Message #17 Posted by Bill (Smithville, NJ) on 7 Apr 2010, 6:53 a.m.,
in response to message #16 by David Hayden

David,

Thanks for tip on Delphi. I don't really need or want "windows" support. A line oriented in/out batch file works great, and when assiged to the windows scheduler, can occur at a convient time each day. It's part of an automated data logging procedure. I usually create an excel spreadsheet that can directly load the resulting data files for any further viewing/manipulation.

I loaded Free Pascal last night and it's perfect for my application.

Bill


[ Return to Index | Top of Index ]

Go back to the main exhibit hall