[comp.lang.c] what's the problem with modf

jwp@cupcake.sal.wisc.edu (Jeffrey W Percival) (10/31/90)

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@larry.sal.wisc.edu) (608)262-8686