xref: /aosp_15_r20/external/fdlibm/w_fmod.c (revision 1e651e1ef2b613db2c4b29ae59c1de74cf0222ae)
1*1e651e1eSRoland Levillain 
2*1e651e1eSRoland Levillain /* @(#)w_fmod.c 1.3 95/01/18 */
3*1e651e1eSRoland Levillain /*
4*1e651e1eSRoland Levillain  * ====================================================
5*1e651e1eSRoland Levillain  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6*1e651e1eSRoland Levillain  *
7*1e651e1eSRoland Levillain  * Developed at SunSoft, a Sun Microsystems, Inc. business.
8*1e651e1eSRoland Levillain  * Permission to use, copy, modify, and distribute this
9*1e651e1eSRoland Levillain  * software is freely granted, provided that this notice
10*1e651e1eSRoland Levillain  * is preserved.
11*1e651e1eSRoland Levillain  * ====================================================
12*1e651e1eSRoland Levillain  */
13*1e651e1eSRoland Levillain 
14*1e651e1eSRoland Levillain /*
15*1e651e1eSRoland Levillain  * wrapper ieee_fmod(x,y)
16*1e651e1eSRoland Levillain  */
17*1e651e1eSRoland Levillain 
18*1e651e1eSRoland Levillain #include "fdlibm.h"
19*1e651e1eSRoland Levillain 
20*1e651e1eSRoland Levillain 
21*1e651e1eSRoland Levillain #ifdef __STDC__
ieee_fmod(double x,double y)22*1e651e1eSRoland Levillain 	double ieee_fmod(double x, double y)	/* wrapper fmod */
23*1e651e1eSRoland Levillain #else
24*1e651e1eSRoland Levillain 	double ieee_fmod(x,y)		/* wrapper fmod */
25*1e651e1eSRoland Levillain 	double x,y;
26*1e651e1eSRoland Levillain #endif
27*1e651e1eSRoland Levillain {
28*1e651e1eSRoland Levillain #ifdef _IEEE_LIBM
29*1e651e1eSRoland Levillain 	return __ieee754_fmod(x,y);
30*1e651e1eSRoland Levillain #else
31*1e651e1eSRoland Levillain 	double z;
32*1e651e1eSRoland Levillain 	z = __ieee754_fmod(x,y);
33*1e651e1eSRoland Levillain 	if(_LIB_VERSION == _IEEE_ ||ieee_isnan(y)||ieee_isnan(x)) return z;
34*1e651e1eSRoland Levillain 	if(y==0.0) {
35*1e651e1eSRoland Levillain 	        return __kernel_standard(x,y,27); /* ieee_fmod(x,0) */
36*1e651e1eSRoland Levillain 	} else
37*1e651e1eSRoland Levillain 	    return z;
38*1e651e1eSRoland Levillain #endif
39*1e651e1eSRoland Levillain }
40