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

Side by Side Diff: src/win32-math.cc

Issue 14362023: Replace math.h with cmath (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates 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 | « src/win32-math.h ('k') | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 // Extra POSIX/ANSI routines for Win32 when using Visual Studio C++. Please 28 // Extra POSIX/ANSI routines for Win32 when using Visual Studio C++. Please
29 // refer to The Open Group Base Specification for specification of the correct 29 // refer to The Open Group Base Specification for specification of the correct
30 // semantics for these functions. 30 // semantics for these functions.
31 // (http://www.opengroup.org/onlinepubs/000095399/) 31 // (http://www.opengroup.org/onlinepubs/000095399/)
32 #ifdef _MSC_VER 32 #ifdef _MSC_VER
33 33
34 #undef V8_WIN32_LEAN_AND_MEAN 34 #undef V8_WIN32_LEAN_AND_MEAN
35 #define V8_WIN32_HEADERS_FULL 35 #define V8_WIN32_HEADERS_FULL
36 #include "win32-headers.h" 36 #include "win32-headers.h"
37 #include <limits.h> // Required for INT_MAX etc. 37 #include <limits.h> // Required for INT_MAX etc.
38 #include <math.h>
39 #include <float.h> // Required for DBL_MAX and on Win32 for finite() 38 #include <float.h> // Required for DBL_MAX and on Win32 for finite()
39 #include <cmath>
40 #include "win32-math.h" 40 #include "win32-math.h"
41 41
42 #include "checks.h" 42 #include "checks.h"
43 43
44 namespace v8 {
45 44
46 // Test for finite value - usually defined in math.h 45 namespace std {
47 int isfinite(double x) {
48 return _finite(x);
49 }
50
51 } // namespace v8
52
53 46
54 // Test for a NaN (not a number) value - usually defined in math.h 47 // Test for a NaN (not a number) value - usually defined in math.h
55 int isnan(double x) { 48 int isnan(double x) {
56 return _isnan(x); 49 return _isnan(x);
57 } 50 }
58 51
59 52
60 // Test for infinity - usually defined in math.h 53 // Test for infinity - usually defined in math.h
61 int isinf(double x) { 54 int isinf(double x) {
62 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0; 55 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0;
63 } 56 }
64 57
65 58
59 // Test for finite value - usually defined in math.h
60 int isfinite(double x) {
61 return _finite(x);
62 }
63
64
66 // Test if x is less than y and both nominal - usually defined in math.h 65 // Test if x is less than y and both nominal - usually defined in math.h
67 int isless(double x, double y) { 66 int isless(double x, double y) {
68 return isnan(x) || isnan(y) ? 0 : x < y; 67 return isnan(x) || isnan(y) ? 0 : x < y;
69 } 68 }
70 69
71 70
72 // Test if x is greater than y and both nominal - usually defined in math.h 71 // Test if x is greater than y and both nominal - usually defined in math.h
73 int isgreater(double x, double y) { 72 int isgreater(double x, double y) {
74 return isnan(x) || isnan(y) ? 0 : x > y; 73 return isnan(x) || isnan(y) ? 0 : x > y;
75 } 74 }
(...skipping 20 matching lines...) Expand all
96 // Test sign - usually defined in math.h 95 // Test sign - usually defined in math.h
97 int signbit(double x) { 96 int signbit(double x) {
98 // We need to take care of the special case of both positive 97 // We need to take care of the special case of both positive
99 // and negative versions of zero. 98 // and negative versions of zero.
100 if (x == 0) 99 if (x == 0)
101 return _fpclass(x) & _FPCLASS_NZ; 100 return _fpclass(x) & _FPCLASS_NZ;
102 else 101 else
103 return x < 0; 102 return x < 0;
104 } 103 }
105 104
105 } // namespace std
106
106 #endif // _MSC_VER 107 #endif // _MSC_VER
OLDNEW
« no previous file with comments | « src/win32-math.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698