2

When performing the below operation: float remainder_fl = fmod (float(a), float(b));

The "remainder_fl" is set to "-1.#IND", when a = 0 and b = 300. This happens only on with a Windows release 64-bit DLL. With a debug 64-bit DLL, and with Windows 32-bit release and debug DLLS, this issue is not seen at all.

If anyone has any suggestions or pointers on why this might be happening, I would highly appreciate it.

Thank you, Ash

Machine configuration 64-bit Windows 2008 Std Server, Optimized release DLL.

mskfisher
  • 3,291
  • 4
  • 35
  • 48
AshD
  • 21
  • 2

1 Answers1

0

It sounds like it may be a bug but, since it doesn't seem to happen in the latest Visual Studio and a complete program exhibiting the behaviour was not actually provided, it's hard to tell. I used this, based on a reasonable reading of the question:

#include <iostream>
int main() {
    double a = 0, b = 300;
    float rem = fmod(float(a), float(b));
    std::cout << rem << "\n";
}

I do know that early version of fmod had certain problems with returning indeterminate values such as with this bug report. I'd also be wary of possible problems with casting to and from float types, errors could be introduced there.

Bottom line, check your code against the current version of Visual Studio and, if the problem still exists, raise a bug report to Microsoft.

paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953