Tech Tip: Using the NAG DLL Implementations From Microsoft Office Suit
It is well known that the NAG DLL implementations provide an excellent source of algorithmic power to boost the functionality of the Microsoft Office suite. Previous articles have described how easy it is to use the libraries in this way. The DLL libraries are provided with examples of use within the Excel package and also the necessary interfacing software to VB and VBA.
Some users have asked why when they solve a problem within Excel using a NAG routine, slightly different answers are obtained when they repeat the same calculation immediately afterwards. The Intel chip can support 80-bit and 64-bit operation. The NAG libraries use the 64-bit operating mode because this is the default operation with the compilers used to form the DLLs. The first time a problem is solved this will be the mode of operation. The mode can be changed by setting the Floating Point Control Word and Excel does this to set the mode of working to 80-bit. In consequence the second time the problem is solved the NAG libraries will start the calculation in 80-bit mode.
For well-conditioned problems this is not serious and the NAG library routines will switch back to 64-bit working whenever it is essential for the correct working of an algorithm, but it can be disconcerting to see this behaviour. A solution is to set the Floating Point Control Word before each call to a NAG routine. At the next release of the libraries NAG will expose this functionality from the DLLs; at the moment an external compiler function is required.
For more information on NAG's DLL, see www.nag.co.uk/numeric/Num_DLLhelp.asp.
For specific technical advice in using NAG's products, please contact our technical experts.
Return to Technical Tips & Hints index page.