mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-06 23:02:10 +03:00
fix FLT_ROUNDS to reflect the current rounding mode
Implemented as a wrapper around fegetround introducing a new function to the ABI: __flt_rounds. (fegetround cannot be used directly from float.h)
This commit is contained in:
parent
bd67959f3a
commit
559de8f5f0
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#ifdef __FLT_EVAL_METHOD__
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#else
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EVAL_METHOD 0
|
||||
|
||||
#define LDBL_TRUE_MIN 4.94065645841246544177e-324L
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#ifdef __FLT_EVAL_METHOD__
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#else
|
||||
|
@ -1,4 +1,3 @@
|
||||
#define FLT_ROUNDS 1
|
||||
#ifdef __FLT_EVAL_METHOD__
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#else
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef _FLOAT_H
|
||||
#define _FLOAT_H
|
||||
|
||||
int __flt_rounds(void);
|
||||
#define FLT_ROUNDS (__flt_rounds())
|
||||
|
||||
#define FLT_RADIX 2
|
||||
|
||||
#define FLT_TRUE_MIN 1.40129846432481707092e-45F
|
||||
|
19
src/fenv/__flt_rounds.c
Normal file
19
src/fenv/__flt_rounds.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <float.h>
|
||||
#include <fenv.h>
|
||||
|
||||
int __flt_rounds()
|
||||
{
|
||||
switch (fegetround()) {
|
||||
#ifdef FE_TOWARDZERO
|
||||
case FE_TOWARDZERO: return 0;
|
||||
#endif
|
||||
case FE_TONEAREST: return 1;
|
||||
#ifdef FE_UPWARD
|
||||
case FE_UPWARD: return 2;
|
||||
#endif
|
||||
#ifdef FE_DOWNWARD
|
||||
case FE_DOWNWARD: return 3;
|
||||
#endif
|
||||
}
|
||||
return -1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user