1 /* 2 * Copyright (c) 2005-2019 Rich Felker, et al. 3 * 4 * Part of MUSL, released under the MIT license. 5 */ 6 7 8 #include <fenv.h> 9 #include <features.h> 10 11 #define hidden __attribute__((__visibility__("hidden"))) 12 13 /* __fesetround wrapper for arch independent argument check */ 14 15 hidden int __fesetround(int); 16 17 int fesetround(int r) 18 { 19 if (r != FE_TONEAREST 20 #ifdef FE_DOWNWARD 21 && r != FE_DOWNWARD 22 #endif 23 #ifdef FE_UPWARD 24 && r != FE_UPWARD 25 #endif 26 #ifdef FE_TOWARDZERO 27 && r != FE_TOWARDZERO 28 #endif 29 ) 30 return -1; 31 return __fesetround(r); 32 } 33