#C/rounding floats
4 messages in this thread
I am trying to use the modf function to round a DOUBLE variable. It works fine
when I try it from a simple test program. But when I try using it in a program
that opens its own screen it fails. If I declare the variables as register
DOUBLE it will sometimes work. But if it fails the computer reboots. If I use
the function fmodf the computer doesn't reboot on failure but the return value
from the function is just the value I sent it. Any ideas on what is going on
here or any idea on another way to round a number.
Hello Jack, about your rebooting & other mysteries with modf: the SAS
library states as warning:
'NOTE: ensure that the second argument of modf is a pointer to a double.
a common error is to use a pointer to an integer'
Maybe that's it??
Greetings from a wet and hot Holland,
Rob Zijlstra
Jack,
I can't tell what's going on without seeing an example, but if your
machine is actually crashing then it's probably a pointer problem.
Check your usage of the function carefully. It's also possible that
you compiled with MATH=68881 but don't have a coprocessor.
–Doug