|
1 | 1 | #include "Util.h" |
2 | 2 | #include <math.h> |
3 | 3 | #include <stdio.h> |
4 | | - |
| 4 | +#include "../common.h" |
5 | 5 | namespace colinli{ |
6 | 6 | /* Return the number of digits of 'v' when converted to string in radix 10. |
7 | 7 | * See ll2string() for more information. */ |
@@ -108,23 +108,23 @@ namespace colinli{ |
108 | 108 |
|
109 | 109 | int d2string(char* buf, size_t len, double value) { |
110 | 110 | if (isnan(value)) { |
111 | | - len = _snprintf(buf, len, "nan"); |
| 111 | + len = snprintf(buf, len, "nan"); |
112 | 112 | } |
113 | 113 | else if (isinf(value)) { |
114 | 114 | if (value < 0) |
115 | | - len = _snprintf(buf, len, "-inf"); |
| 115 | + len = snprintf(buf, len, "-inf"); |
116 | 116 | else |
117 | | - len = _snprintf(buf, len, "inf"); |
| 117 | + len = snprintf(buf, len, "inf"); |
118 | 118 | } |
119 | 119 | else if (value == 0) { |
120 | 120 | /* See: http://en.wikipedia.org/wiki/Signed_zero, "Comparisons". */ |
121 | 121 | if (1.0 / value < 0) |
122 | | - len = _snprintf(buf, len, "-0"); |
| 122 | + len = snprintf(buf, len, "-0"); |
123 | 123 | else |
124 | | - len = _snprintf(buf, len, "0"); |
| 124 | + len = snprintf(buf, len, "0"); |
125 | 125 | } |
126 | 126 | else { |
127 | | - len = _snprintf(buf, len, "%.17g", value); |
| 127 | + len = snprintf(buf, len, "%.17g", value); |
128 | 128 | } |
129 | 129 |
|
130 | 130 | return len; |
|
0 commit comments