| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | |
| 8 | 7 |
| 9 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 10 | 9 |
| 11 #include <float.h> | 10 #include <float.h> |
| 12 #include <math.h> | 11 #include <math.h> |
| 13 | 12 |
| 14 #if defined(OS_SOLARIS) | 13 #if defined(OS_SOLARIS) |
| 15 #include <ieeefp.h> | 14 #include <ieeefp.h> |
| 16 #endif | 15 #endif |
| 17 | 16 |
| 18 namespace base { | 17 namespace base { |
| 19 | 18 |
| 20 inline bool IsFinite(const double& number) { | 19 inline bool IsFinite(const double& number) { |
| 21 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
| 22 // C99 says isfinite() replaced finite(), and iOS does not provide the | 21 // C99 says isfinite() replaced finite(), and iOS does not provide the |
| 23 // older call. | 22 // older call. |
| 24 return isfinite(number) != 0; | 23 return isfinite(number) != 0; |
| 25 #elif defined(OS_POSIX) | 24 #elif defined(OS_POSIX) |
| 26 return finite(number) != 0; | 25 return finite(number) != 0; |
| 27 #elif defined(OS_WIN) | 26 #elif defined(OS_WIN) |
| 28 return _finite(number) != 0; | 27 return _finite(number) != 0; |
| 29 #endif | 28 #endif |
| 30 } | 29 } |
| 31 | 30 |
| 32 } // namespace base | 31 } // namespace base |
| 33 | 32 |
| 34 #endif // BASE_FLOAT_UTIL_H_ | 33 #endif // BASE_FLOAT_UTIL_H_ |
| OLD | NEW |