This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
27
unikernel/duniverse/Zarith/tests/setround.c
Normal file
27
unikernel/duniverse/Zarith/tests/setround.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* Auxiliary function to control FP rounding mode. Assumes ISO C99. */
|
||||
|
||||
#include <fenv.h>
|
||||
#include <caml/mlvalues.h>
|
||||
|
||||
#ifndef FE_DOWNWARD
|
||||
#define FE_DOWNWARD (-1)
|
||||
#endif
|
||||
#ifndef FE_TONEAREST
|
||||
#define FE_TONEAREST (-1)
|
||||
#endif
|
||||
#ifndef FE_TOWARDZERO
|
||||
#define FE_TOWARDZERO (-1)
|
||||
#endif
|
||||
#ifndef FE_UPWARD
|
||||
#define FE_UPWARD (-1)
|
||||
#endif
|
||||
|
||||
static int modes[4] = {
|
||||
FE_DOWNWARD, FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD
|
||||
};
|
||||
|
||||
CAMLprim value caml_ztest_setround(value vmode)
|
||||
{
|
||||
int rc = fesetround(modes[Int_val(vmode)]);
|
||||
return Val_bool(rc == 0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue