/************************************************/
/* fmod2p.c					*/
/*						*/
/* given an angle in radians, returns an angle	*/
/* in radians in the range of 0 to 2pi.		*/
/************************************************/

/***** description
 *
 *	$Id: fmod2p_2.c,v 1.2 2001/04/04 14:42:45 misha Exp $
 *
 */

/***** modification history
 *
 *	translated by f2c (version of 12 March 1993  7:07:21).
 *
 *	$Log: fmod2p_2.c,v $
 *	Revision 1.2  2001/04/04 14:42:45  misha
 *	*** empty log message ***
 *	
 * Revision 1.1  1993/04/02  18:02:52  craig
 * Initial revision
 *
 *
 */

/***** include files *****/

#include "satellite.h"
#include "satproto.h"

/***** global variables *****/

extern struct MCONSTANTS mcnsts;

/**********/
/* fmod2p */
/**********/

double fmod2p_2 (double x)
{
    /* System generated locals */

    double ret_val;

    /* Local variables */

    int i;

    ret_val = x;
    i = ret_val / mcnsts.twopi;
    ret_val -= i * mcnsts.twopi;

    if (ret_val < 0) 
    {
	ret_val += mcnsts.twopi;
    }
   
    return (ret_val);
}
