nevermind
11-11-2003, 12:46 PM
does anyone know an easy way to convert the files from float to double precision? i'm currently working on a project that requires double precision calculations, but the NR subroutines all use float
any suggestions are greatly appreciated
~kjd
Sherlock
11-22-2003, 05:12 PM
Kyle,
There is a little information on this topic in another part of this forum. Look under: General Hints, Tips, and Tricks for Using NR for the thread converting the NRC to double-precision?.
The basic information is this:
1. Change occurrences of "float" to "double" in the program
2. Change calls to utility routines that allocate and free memory.
vector() becomes dvector()
free_vector() becomes free_dvector()
matrix() becomes dmatrix()
free_matrix() becomes free_dmatrix()
3. Beyond the issue of data types, some Recipes use convergence tests or coefficients that will limit accuracy to single precision even if the data types are changed to double. These cases are summarized in the file at the following location:
http://www.numerical-recipes.com/utils/NR2DP.DAT.txt
You will have to make allowance for the fact that this file is written in reference to the Fortran version of the Recipes.
4. The Numerical Recipes in C++ are all done in double precision from the start, and in that case there is an Appendix C that explains how to get them back to "float".