1 /* $NetBSD: flt_rounds.c,v 1.2 1998/02/03 01:30:43 mycroft 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