OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_FLOAT_UTIL_H_ | 5 #ifndef BASE_FLOAT_UTIL_H_ |
6 #define BASE_FLOAT_UTIL_H_ | 6 #define BASE_FLOAT_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #include <float.h> | 11 #include <float.h> |
12 #include <math.h> | 12 #include <math.h> |
13 | 13 |
14 #if defined(OS_SOLARIS) | 14 #if defined(OS_SOLARIS) |
15 #include <ieeefp.h> | 15 #include <ieeefp.h> |
16 #endif | 16 #endif |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 | 19 |
20 inline bool IsFinite(const double& number) { | 20 inline bool IsFinite(const double& number) { |
21 #if defined(OS_POSIX) | 21 #if defined(OS_MACOSX) |
22 // C99 says isfinite() replaced finite(), and iOS does not provide the | |
23 // older call. | |
24 return isfinite(number) != 0; | |
25 #elif defined(OS_POSIX) | |
22 return finite(number) != 0; | 26 return finite(number) != 0; |
Mark Mentovai
2012/07/10 12:19:29
If you’re afraid to change this, and I’m not, but
| |
23 #elif defined(OS_WIN) | 27 #elif defined(OS_WIN) |
24 return _finite(number) != 0; | 28 return _finite(number) != 0; |
25 #endif | 29 #endif |
26 } | 30 } |
27 | 31 |
28 } // namespace base | 32 } // namespace base |
29 | 33 |
30 #endif // BASE_FLOAT_UTIL_H_ | 34 #endif // BASE_FLOAT_UTIL_H_ |
OLD | NEW |