Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Mathematical Library Functionsfmod(3M)


NAME

 fmod - floating-point remainder value function

SYNOPSIS

 
cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
double fmod(double x, double y);

DESCRIPTION

 

The fmod() function returns the floating-point remainder of the division of x by y.

RETURN VALUES

 

The fmod() function returns the value x - i * y, for some integer i such that, if y is non-zero, the result has the same sign as x and magnitude less than the magnitude of y.

If x or y is NaN, NaN is returned. If y is 0, NaN is returned and errno is set to EDOM. If x is +-Inf, NaN is returned. If y is non-zero, fmod(+-0,y) returns the value of x. If x is not +-Inf, fmod(x,+-Inf) returns the value of x.

ERRORS

 

The fmod() function may fail if:

EDOM
y is 0.

No other errors will occur.

USAGE

 

Portable applications should not call fmod() with y equal to 0, because the result is implementation-dependent. The application should verify y is non-zero before calling fmod().

An application wishing to check for error situations should set errno to 0 before calling fmod(). If errno is non-zero on return, or the return value is NaN, an error has occurred.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

isnan(3M), attributes(5)


SunOS 5.9Go To TopLast Changed 29 Dec 1996

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.