OSDN Git Service

Use FLT_ROUNDS in LP64 strtold.
authorElliott Hughes <enh@google.com>
Wed, 16 Apr 2014 23:09:41 +0000 (16:09 -0700)
committerElliott Hughes <enh@google.com>
Wed, 16 Apr 2014 23:09:41 +0000 (16:09 -0700)
Change-Id: I75323be6e1cadb00770fcdd08422836b03737416

libc/bionic/strtold.cpp

index 08b2758..5616cf7 100644 (file)
@@ -26,6 +26,7 @@
  * SUCH DAMAGE.
  */
 
+#include <float.h>
 #include <stdlib.h>
 
 extern "C" int __strtorQ(const char*, char**, int, void*);
@@ -33,8 +34,7 @@ extern "C" int __strtorQ(const char*, char**, int, void*);
 long double strtold(const char* s, char** end_ptr) {
 #if __LP64__
   long double result;
-  // TODO: use the current rounding mode?
-  __strtorQ(s, end_ptr, 1 /* FPI_Round_near */, &result);
+  __strtorQ(s, end_ptr, FLT_ROUNDS, &result);
   return result;
 #else
   // This is fine for LP32 where long double is just double.