what's the problem with modf()?

Jeffrey W Percival jwp at cupcake.sal.wisc.edu
Wed Oct 31 05:54:42 AEST 1990


I ported a C program from Ultrix to Sun 4.1, and discovered
that modf() was giving me fits.  Much debugging, only to discover
that modf() was giving me a NaN result *sometimes*.  Unpredictable,
seemingly dependent on program size, linkage, etc.  A real bear
to find.

I saw in the Sun man pages that modf() was accompanied with the
warning that it may not be portable, and that there were better
ways to do it.  While not disputing that, I wonder what makes
it flakey?  Its function is well-defined, no?  The output is
defined for all real input, no?

Can someone fill me in on this seemingly sordid topic?
-- 
Jeffrey W Percival (jwp at larry.sal.wisc.edu) (608)262-8686



More information about the Comp.lang.c mailing list