xref: /csrg-svn/usr.bin/f77/libF77/r_nint.c (revision 47940)
1*47940Sbostic /*-
2*47940Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47940Sbostic  * All rights reserved.
422964Skre  *
5*47940Sbostic  * %sccs.include.proprietary.c%
610533Sdlw  */
710533Sdlw 
8*47940Sbostic #ifndef lint
9*47940Sbostic static char sccsid[] = "@(#)r_nint.c	5.4 (Berkeley) 04/12/91";
10*47940Sbostic #endif /* not lint */
11*47940Sbostic 
1223856Sjerry float flt_retval;
1323856Sjerry 
r_nint(x)1423854Sjerry float r_nint(x)
1510533Sdlw float *x;
1610533Sdlw {
1710533Sdlw double floor();
1810533Sdlw 
1923856Sjerry flt_retval = (*x)>=0 ? floor(*x + .5) : -floor(.5 - *x);
2023856Sjerry return(flt_retval);
2110533Sdlw }
22