Float to Double causes bad result


I’ve recently switched my code so it uses doubles instead of floats. It was a straight swap, everything that was float became double, however now the code gives some strange (incorrect) results. The results I’m getting with this version give lots of #IND00 and some very large numbers (20799597137535818000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000 for example).

The problem seems to first occur at the domain limits, and then spread through my domain. which suggests a problem lies in the way I treat the domain boundaries, however this problem did not occur beforehand when everything was set to floats. The only thing that has changed is this switch from floats to doubles, doubting myself i’ve also diffed the two versions to confirm I didn’t change anything else.

Can anyone suggest a solution or at least a way to debug this? I’m quickly running out of ideas.


PS. I’ve found similar threads to this, but not one that describes the problem I am seeing.

An embarrassing bug, I was reading in values from a data file using fscanf and the %f format specifier instead of %lf. All is working correctly now.