CompuServe Thread

#C/rounding floats

4 messages in this thread
#34823From: jack yorkMay 18, 1993 4:27 PM
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.
#34828From: Rob ZijlstraMay 18, 1993 5:11 PM
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
#34913From: Doug WalkerMay 23, 1993 9:22 AM
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
#35380From: jack yorkJun 16, 1993 9:13 PM
How do I tell if I compiled with MATH=68881? I didn't do so explicitly.