Home | History | Annotate | Line # | Download | only in softfloat
      1 /*	$NetBSD: flt_rounds.c,v 1.1 2025/10/04 21:03:16 nat Exp $	*/
      2 
      3 /*
      4  * Written by J.T. Conklin, Apr 11, 1995
      5  * Public domain.
      6  */
      7 
      8 #include <sys/cdefs.h>
      9 #if defined(LIBC_SCCS) && !defined(lint)
     10 __RCSID("$NetBSD: flt_rounds.c,v 1.1 2025/10/04 21:03:16 nat Exp $");
     11 #endif /* LIBC_SCCS and not lint */
     12 
     13 #include "namespace.h"
     14 #include <machine/float.h>
     15 #include <ieeefp.h>
     16 
     17 static const int map[] = {
     18 	1,	/* round to nearest */
     19 	0,	/* round to zero */
     20 #ifdef __m68k__
     21 	3,	/* round to positive infinity */
     22 	2	/* round to negative infinity */
     23 #else
     24 	2,	/* round to positive infinity */
     25 	3	/* round to negative infinity */
     26 #endif
     27 };
     28 
     29 int
     30 __flt_rounds(void)
     31 {
     32 	return map[fpgetround()];
     33 }
     34