1 /* $NetBSD: flt_rounds.c,v 1.3 1998/08/09 12:43:33 tsubai Exp $ */ 2 3 #include <float.h> 4 5 static const int map[] = { 6 1, /* round to nearest */ 7 0, /* round to zero */ 8 2, /* round to positive infinity */ 9 3 /* round to negative infinity */ 10 }; 11 12 int 13 __flt_rounds() 14 { 15 double tmp; 16 int x; 17 18 __asm("mffs %0; stfiwx %0,0,%1" : "=f"(tmp): "b"(&x)); 19 return map[x & 0x03]; 20 } 21