Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Side by Side Diff: base/float_util.h

Issue 14188028: Use std::isfinite(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android? Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <float.h> 10 #include <float.h>
11 #include <math.h> 11
12 #include <cmath>
12 13
13 namespace base { 14 namespace base {
14 15
15 inline bool IsFinite(const double& number) { 16 inline bool IsFinite(const double& number) {
16 #if defined(OS_ANDROID) 17 #if defined(OS_POSIX)
17 // isfinite isn't available on Android: http://b.android.com/34793 18 return std::isfinite(number) != 0;
18 return finite(number) != 0;
19 #elif defined(OS_POSIX)
20 return isfinite(number) != 0;
21 #elif defined(OS_WIN) 19 #elif defined(OS_WIN)
22 return _finite(number) != 0; 20 return _finite(number) != 0;
23 #endif 21 #endif
24 } 22 }
25 23
26 } // namespace base 24 } // namespace base
27 25
28 #endif // BASE_FLOAT_UTIL_H_ 26 #endif // BASE_FLOAT_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698