Skip to content

Commit 04f3d62

Browse files
is_convertible_without_loss_to_integer
1 parent 2df5613 commit 04f3d62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: inst/include/cpp11/as.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ using enable_if_c_string = enable_if_t<std::is_same<T, const char*>::value, R>;
7373

7474
// https://stackoverflow.com/a/1521682/2055486
7575
//
76-
inline bool is_convertable_without_loss_to_integer(double value) {
76+
inline bool is_convertible_without_loss_to_integer(double value) {
7777
double int_part;
7878
return std::modf(value, &int_part) == 0.0;
7979
}
@@ -100,7 +100,7 @@ enable_if_integral<T, T> as_cpp(SEXP from) {
100100
return NA_INTEGER;
101101
}
102102
double value = REAL_ELT(from, 0);
103-
if (is_convertable_without_loss_to_integer(value)) {
103+
if (is_convertible_without_loss_to_integer(value)) {
104104
return value;
105105
}
106106
}

Diff for: inst/include/cpp11/integers.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ inline integers as_integers(sexp x) {
158158
writable::integers ret = writable::integers(len);
159159
for (size_t i = 0; i < len; ++i) {
160160
double el = xn[i];
161-
if (!is_convertable_without_loss_to_integer(el)) {
161+
if (!is_convertible_without_loss_to_integer(el)) {
162162
throw std::runtime_error("All elements must be integer-like");
163163
}
164164
ret[i] = (static_cast<int>(el));

0 commit comments

Comments
 (0)