like numbers


Multiple Precision Toolbox for Matlab
under Microsoft Windows

Martin Andersson, Tokyo, Friday, January 4, 2008

(last update, January 28, 2010)

The Multiple Precision Toolbox for Matlab (mp_toolbox) enables you to to increase your numerical precision of all your calculations. It is becomes very easy to use hundreds or even thousands of decimals. Examples of applications are for comparison of numerical stability of algorithms, for solving for high order polynomial roots, eigenvector algorithms, numerical analysis of convergence and errors, and when solving differential equations. Pi and e can be computed with thousands of decimals. The numerical performance and numerical stability, even in cases where it is extremely complicated to compare algebraically, can be compared in a new way.

All the benefits of the matrix algebra notations and calculations in Matlab are inherited. The toolbox is fairly easy to install and has been confirmed to run on several Windows installations like Windows 2000, Windows XP. The drawback is that calculations become extremely slow.


The multiple precision toolbox for Matlab, was a key for conclusions within the field of chemometrics and partial least squares, PLS, in M. Andersson, A comparison of nine PLS1 algorithms, J. Chemom., 2009; 23, 518 - 529 (DOI: 10.1002/cem.1248). This paper led to the Kowalski Prize 2010 for the best theoretical paper in 2008 and 2009. There is a long story behind it, see also the press release from FOSS Analytical. Without the multiple precision toolbox, it would be impossible to objectively compare the numerical stability of the different PLS algorithms. As a result of the paper, Eigenvector Research, a leading software company within the field of chemometrics, decided to use a the new Direct Scores PLS in their PLS_Toolbox for Matlab from version 5.5.


Download this zip-file. Follow the below example, but please adjust the folder names according to your own specific situation on your Windows file system.

  1. 1.Extract the zip file to
    Note that the extracted files should now be located in
    2. Add C:\Matlab6p5\work\mp to your path. Do this by typing "edit pathdef" without quotes and add it at the end. As an example, the end of the pathdef.m may look like the following:
    Of course, you probably don’t have the same folder structure on your PC. Make sure that you have a folder named  .......\work\mp  and that you unzipped the files to this folder.

3. After unzipping, RESTART Matlab and initialize the toolbox by typing "mp_init(250)" without any quotes. This means that the precision is set to 250 binary digits.

4. Check that all functions of the toolbox are working. Type "mp_TESTING" and "mp_TESTING2". Confirm that all functions are be OK.

If you need so many digits to succeed with your calculations, it can be because the way you are approaching the problem wrongly from a numerical point of view. Instead of using many digits to succeed as is offered by the mp_toolbox, it may be a better idea to try to find a better way to solve the problem, using another algorithm.

This has been confirmed to work on MATLAB Version (R13), Matlab 7(R14) and 7.2 on Windows XP. It has not been tested it on any other versions.

Make sure that all the functions you are using in your own algorithms are overloaded by the mp_toolbox. The functions are overloaded if you can find their name in the mp directory or in the mp\@mp directory.

You may download newer versions of the Multiple Precision Toolbox from the Mathworks site, but then be aware that you may need some hands on to adjust the files to get them all running on a Windows based Matlab installation. Therefore, it is recommended to try the above zip file to first.


The toolbox was made by Benjamin Barrowes. All credits, donations and dollars should go to him for an excellent work. The dll-files for Microsoft Windows were compiled by Carlos López  who also enhanced some of the functions in the toolbox. All I did was to make an initialization file and to adjust a few of the m-files to get all functions working on my machine - and to make it available with an easy installation guide.