Back to index

glibc  2.9
w_fmod.c
Go to the documentation of this file.
00001 /* @(#)w_fmod.c 5.1 93/09/24 */
00002 /*
00003  * ====================================================
00004  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00005  *
00006  * Developed at SunPro, a Sun Microsystems, Inc. business.
00007  * Permission to use, copy, modify, and distribute this
00008  * software is freely granted, provided that this notice
00009  * is preserved.
00010  * ====================================================
00011  */
00012 
00013 #if defined(LIBM_SCCS) && !defined(lint)
00014 static char rcsid[] = "$NetBSD: w_fmod.c,v 1.6 1995/05/10 20:48:55 jtc Exp $";
00015 #endif
00016 
00017 /*
00018  * wrapper fmod(x,y)
00019  */
00020 
00021 #include <math.h>
00022 #include "math_private.h"
00023 
00024 
00025 #ifdef __STDC__
00026        double __fmod(double x, double y)  /* wrapper fmod */
00027 #else
00028        double __fmod(x,y)          /* wrapper fmod */
00029        double x,y;
00030 #endif
00031 {
00032 #ifdef _IEEE_LIBM
00033        return __ieee754_fmod(x,y);
00034 #else
00035        double z;
00036        z = __ieee754_fmod(x,y);
00037        if(_LIB_VERSION == _IEEE_ ||__isnan(y)||__isnan(x)) return z;
00038        if(y==0.0) {
00039                return __kernel_standard(x,y,27); /* fmod(x,0) */
00040        } else
00041            return z;
00042 #endif
00043 }
00044 weak_alias (__fmod, fmod)
00045 #ifdef NO_LONG_DOUBLE
00046 strong_alias (__fmod, __fmodl)
00047 weak_alias (__fmod, fmodl)
00048 #endif