-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtest-ops64.R
More file actions
480 lines (411 loc) · 19.4 KB
/
Copy pathtest-ops64.R
File metadata and controls
480 lines (411 loc) · 19.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
test_that("basic math ops works", {
x = as.integer64(1:10)
y = as.integer64(10:1)
expect_identical(x + y, as.integer64(rep(11L, 10L)))
expect_identical(y - x, as.integer64(seq(9L, -9L, by=-2L)))
expect_identical(x * y, as.integer64(c(10L, 18L, 24L, 28L, 30L, 30L, 28L, 24L, 18L, 10L)))
# output is double even though it fits in integer [and integer64]
expect_identical(x[seq(2L, 10L, by=2L)] / 2L, as.double(1:5))
expect_identical(x^2L, as.integer64((1:10)^2L))
expect_identical(-x, as.integer64(-(1:10)))
expect_identical(x %/% 2L, as.integer64(c(0L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L)))
expect_identical(x %% 2L, as.integer64(rep_len(c(1L, 0L), 10L)))
x32 = c(10L, 10L, -10L, -10L, 7L, 10L, -10L)
y32 = c(3L, -3L, 3L, -3L, -10L, 0L, 0L)
x64 = as.integer64(x32)
y64 = as.integer64(y32)
expect_warning(
expect_identical(x64 %/% y64, as.integer64(x32 %/% y32)),
"NAs produced due to division by zero"
)
expect_warning(
expect_identical(x64 %% y64, as.integer64(x32 %% y32)),
"NAs produced due to division by zero"
)
expect_identical(
suppressWarnings((x64 %/% y64) * y64 + x64 %% y64 == x64),
c(rep(TRUE, 5L), rep(NA, 2L))
)
# regression snuck through, caught by #149
expect_identical(as.integer64(1L) * 1:5, as.integer64(1:5))
expect_identical(1:5 * as.integer64(1L), as.integer64(1:5))
})
test_that("empty inputs give empty outputs for ops", {
x = integer64(1L)
empty = integer64(0L)
expect_identical(x + empty, integer64())
expect_identical(empty + x, integer64())
expect_identical(x - empty, integer64())
expect_identical(empty - x, integer64())
expect_identical(+empty, integer64())
expect_identical(-empty, integer64())
expect_identical(x * empty, integer64())
expect_identical(empty * x, integer64())
expect_identical(x / empty, double())
expect_identical(empty / x, double())
expect_identical(x^empty, integer64())
expect_identical(empty^x, integer64())
expect_identical(x %/% empty, integer64())
expect_identical(empty %/% x, integer64())
expect_identical(x %% empty, integer64())
expect_identical(empty %% x, integer64())
expect_identical(x == empty, logical())
expect_identical(empty == x, logical())
expect_identical(x != empty, logical())
expect_identical(empty != x, logical())
expect_identical(x >= empty, logical())
expect_identical(empty >= x, logical())
expect_identical(x <= empty, logical())
expect_identical(empty <= x, logical())
expect_identical(x > empty, logical())
expect_identical(empty > x, logical())
expect_identical(x < empty, logical())
expect_identical(empty < x, logical())
expect_identical(x & empty, logical())
expect_identical(empty & x, logical())
expect_identical(x | empty, logical())
expect_identical(empty | x, logical())
expect_identical(xor(x, empty), logical())
expect_identical(xor(empty, x), logical())
})
test_that("semantics about mixed types for multiplication are respected", {
int = 5L
i64 = as.integer64(2L)
dbl = 3.5
# default: "old" semantics, to be deprecated
expect_identical(i64 * dbl, as.integer64(7L))
expect_identical(dbl * i64, as.integer64(6L))
expect_identical(i64 * int, as.integer64(10L))
expect_identical(int * i64, as.integer64(10L))
expect_identical(i64 * i64, as.integer64(4L))
withr::with_options(list(integer64_semantics = "new"), {
expect_identical(i64 * dbl, as.integer64(7L))
expect_identical(dbl * i64, as.integer64(7L))
expect_identical(i64 * int, as.integer64(10L))
expect_identical(int * i64, as.integer64(10L))
expect_identical(i64 * i64, as.integer64(4L))
})
})
test_that("semantics about mixed types for division are respected", {
int = 10L
i64 = as.integer64(5L)
dbl = 2.5
# default: "old" semantics, to be deprecated
expect_identical(i64 / dbl, 2.0)
expect_identical(dbl / i64, 0.4)
expect_identical(i64 / int, 0.5)
expect_identical(int / i64, 2.0)
expect_identical(i64 / i64, 1.0)
withr::with_options(list(integer64_semantics = "new"), {
expect_identical(i64 / dbl, 2.0)
expect_identical(dbl / i64, 0.5)
expect_identical(i64 / int, 0.5)
expect_identical(int / i64, 2.0)
expect_identical(i64 / i64, 1.0)
})
})
test_that("Minus and plus", {
d64 = c(
-.Machine$double.base^.Machine$double.digits,
-.Machine$integer.max,
-1.0, 0.0, 1.0,
.Machine$integer.max,
.Machine$double.base^.Machine$double.digits
)
i64 = as.integer64(d64)
expect_true(identical.integer64(i64 - 1.0 + 1.0, i64))
expect_true(identical.integer64(i64 + 1.0 - 1.0, i64))
})
test_that("Minus and plus edge cases and 'rev'", {
expect_warning(
expect_true(identical.integer64(
lim.integer64() + 1.0 - 1.0,
c(lim.integer64()[1L], NA)
)),
"NAs produced by integer64 overflow",
fixed = TRUE
)
expect_warning(
expect_true(identical.integer64(
rev(lim.integer64()) - 1.0 + 1.0,
c(lim.integer64()[2L], NA)
)),
"NAs produced by integer64 overflow",
fixed = TRUE
)
})
test_that("Overflow edge cases for arithmetic and summary functions", {
max_val = lim.integer64()[2L]
min_val = lim.integer64()[1L]
half_min = as.integer64("-4611686018427387904") # -2^62
half_max = as.integer64("4611686018427387904") # 2^62
overflow_warning = "NAs produced by integer64 overflow"
# True C-level overflow (above LLONG_MAX or below LLONG_MIN)
expect_warning(expect_identical(max_val + 1L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(min_val + (-2L), NA_integer64_), overflow_warning)
expect_warning(expect_identical(max_val - (-1L), NA_integer64_), overflow_warning)
expect_warning(expect_identical(min_val - 2L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(max_val * 2L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(min_val * 2L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(min_val * (-2L), NA_integer64_), overflow_warning)
expect_warning(expect_identical(diff(c(max_val, min_val - 1L)), NA_integer64_), overflow_warning)
# R-specific overflow (result is exactly LLONG_MIN == NA_INTEGER64, so C arithmetic
# works, but overflow is nevertheless reported as R's integer64 class has narrower range
expect_warning(expect_identical(min_val + (-1L), NA_integer64_), overflow_warning)
expect_warning(expect_identical(half_min + half_min, NA_integer64_), overflow_warning)
expect_warning(expect_identical(min_val - 1L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(as.integer64(-2L) * half_max, NA_integer64_), overflow_warning)
expect_warning(
expect_identical(as.integer64("-2147483648") * as.integer64("4294967296"), NA_integer64_),
overflow_warning
)
expect_warning(expect_identical(diff(c(as.integer64(1L), min_val)), NA_integer64_), overflow_warning)
expect_warning(expect_identical(sum(min_val, -1L), NA_integer64_), overflow_warning)
expect_warning(expect_identical(sum(c(half_min, half_min)), NA_integer64_), overflow_warning)
expect_warning(expect_identical(prod(as.integer64(-2L), half_max), NA_integer64_), overflow_warning)
expect_warning(expect_identical(cumsum(c(min_val, -1L)), c(min_val, NA_integer64_)), overflow_warning)
expect_warning(
expect_identical(cumprod(c(as.integer64(-2L), half_max)), c(as.integer64(-2L), NA_integer64_)),
overflow_warning
)
# Boundary cases that _don't_ overflow
expect_identical(min_val + 0L, min_val)
expect_identical(min_val + 1L, as.integer64("-9223372036854775806"))
expect_identical(half_min + (half_min + 1L), min_val)
expect_identical(min_val - 0L, min_val)
expect_identical(max_val - 0L, max_val)
expect_identical(min_val * 1L, min_val)
expect_identical(min_val * (-1L), max_val)
expect_identical(max_val * (-1L), min_val)
expect_identical(sum(min_val, 0L), min_val)
expect_identical(prod(min_val, 1L), min_val)
# If NA is present, NA is returned without overflow
expect_no_warning(expect_identical(NA_integer64_ + 1L, NA_integer64_))
expect_no_warning(expect_identical(1L + NA_integer64_, NA_integer64_))
expect_no_warning(expect_identical(NA_integer64_ - 1L, NA_integer64_))
expect_no_warning(expect_identical(1L - NA_integer64_, NA_integer64_))
expect_no_warning(expect_identical(NA_integer64_ * 2L, NA_integer64_))
expect_no_warning(expect_identical(2L * NA_integer64_, NA_integer64_))
expect_no_warning(expect_identical(sum(NA_integer64_), NA_integer64_))
expect_no_warning(expect_identical(sum(c(as.integer64(1L), NA_integer64_), na.rm = FALSE), NA_integer64_))
expect_no_warning(expect_identical(sum(c(as.integer64(1:2), NA_integer64_), na.rm = TRUE), as.integer64(3L)))
expect_warning(
expect_identical(sum(c(max_val, as.integer64(1L), NA_integer64_), na.rm = TRUE), NA_integer64_),
overflow_warning
)
expect_no_warning(expect_identical(prod(NA_integer64_), NA_integer64_))
expect_no_warning(expect_identical(prod(c(as.integer64(1L), NA_integer64_), na.rm = FALSE), NA_integer64_))
expect_no_warning(expect_identical(prod(c(as.integer64(2:3), NA_integer64_), na.rm = TRUE), as.integer64(6L)))
expect_warning(
expect_identical(prod(c(max_val, as.integer64(2L), NA_integer64_), na.rm = TRUE), NA_integer64_),
overflow_warning
)
expect_no_warning(expect_identical(cumsum(c(NA_integer64_, 1L)), c(NA_integer64_, NA_integer64_)))
expect_no_warning(expect_identical(cumprod(c(NA_integer64_, 1L)), c(NA_integer64_, NA_integer64_)))
expect_no_warning(expect_identical(diff(c(NA_integer64_, as.integer64(1L))), NA_integer64_))
expect_no_warning(expect_identical(diff(c(as.integer64(1L), NA_integer64_)), NA_integer64_))
# Vectorized operations with partial overflow
expect_warning(
expect_identical(c(max_val, as.integer64(1L)) + 1L, c(NA_integer64_, as.integer64(2L))),
overflow_warning
)
expect_warning(
expect_identical(c(min_val, as.integer64(1L)) - 1L, c(NA_integer64_, as.integer64(0L))),
overflow_warning
)
expect_warning(
expect_identical(c(max_val, as.integer64(1L)) * 2L, c(NA_integer64_, as.integer64(2L))),
overflow_warning
)
})
test_that("Logical operators", {
expect_true(identical.integer64(
!c(NA, -1:1),
!c(as.integer64(NA), -1:1)
))
xi = rep(c(NA, -1:1), 4L)
xi64 = as.integer64(xi)
yi = rep(c(NA, -1:1), each=4L)
yi64 = as.integer64(yi)
expect_true(identical.integer64(xi64 & yi64, xi & yi))
expect_true(identical.integer64(xi64 | yi64, xi | yi))
expect_true(identical.integer64(xor(xi64, yi64), xor(xi, yi)))
})
test_that("Comparison operators", {
xi = rep(c(NA, -1:1), 4L)
xi64 = as.integer64(xi)
yi = rep(c(NA, -1:1), each=4L)
yi64 = as.integer64(yi)
expect_true(identical.integer64(xi64 == yi64, xi == yi))
expect_true(identical.integer64(xi64 != yi64, xi != yi))
expect_true(identical.integer64(xi64 > yi64, xi > yi))
expect_true(identical.integer64(xi64 >= yi64, xi >= yi))
expect_true(identical.integer64(xi64 < yi64, xi < yi))
expect_true(identical.integer64(xi64 <= yi64, xi <= yi))
})
with_parameters_test_that("{operator} with integer64 vs {class} (returning integer64):", {
withr::local_seed(42L)
if (getRversion() <= "3.6.0" && operator == "^")
x32 = 1:10 # there seems to be an issue with negative values with the `^` operator in ancient
else
x32 = c(-10:-1, 1:10)
x64 = as.integer64(x32)
y = sample(x32)
eval(parse(text=paste0("y = as.", class, "(y)")))
op = match.fun(operator)
maybe_cast = if (operator %in% c("+", "-", "*", "^", "%%", "%/%")) as.integer64 else identity
expected = tryCatch(maybe_cast(op(x32, y)), error=conditionMessage)
actual = tryCatch(op(x64, y), error=conditionMessage)
expect_identical(actual, expected)
expected = tryCatch(maybe_cast(op(y, x32)), error=conditionMessage)
actual = tryCatch(op(y, x64), error=conditionMessage)
expect_identical(actual, expected)
},
.cases = expand.grid(
operator=c("+", "-", "*", "/", "^", "%%", "%/%", "<", "<=", "==", ">=", ">", "!=", "&", "|", "xor"),
class=c("integer", "double", "logical"),
stringsAsFactors=FALSE
)
)
with_parameters_test_that("{operator} with integer64 vs. {class} (not returning integer64):", {
skip_unless_r(">= 4.3.0")
withr::local_seed(42L)
x32 = c(-10:-1, 1:10)
x64 = as.integer64(x32)
y = sample(x32)
eval(parse(text=paste0("y = as.", class, "(as.double(y)", if (class == "difftime") ', units = "secs"', ")")))
op = match.fun(as.character(operator))
test_e = tryCatch(op(x32, y), error=conditionMessage)
test_a = tryCatch(op(x64, y), error=conditionMessage)
expect_identical(test_a, test_e)
test_e = tryCatch(op(y, x32), error=conditionMessage)
test_a = tryCatch(op(y, x64), error=conditionMessage)
expect_identical(test_a, test_e)
},
.cases = expand.grid(
operator = c("+", "-", "*", "/", "^", "%%", "%/%", "<", "<=", "==", ">=", ">", "!=", "&", "|", "xor"),
class = c("complex", "Date", "POSIXct", "POSIXlt", "difftime")
)
)
with_parameters_test_that(
"integer64 vs character/factor comparisons work",
{
x32 = c(1L, 2L, 10L)
x64 = as.integer64(x32)
y = c("1", "2", "10")
if (type == "factor") y = as.factor(y)
op = match.fun(operator)
if (type == "factor" && operator %in% c("<", "<=", ">", ">=")) {
expect_warning(
expect_identical(op(x64, y), rep(NA, 3L)),
"not meaningful for factors", fixed = TRUE
)
expect_warning(
expect_identical(op(y, x64), rep(NA, 3L)),
"not meaningful for factors", fixed = TRUE
)
} else {
expected_xy = op(x32, y)
actual_xy = op(x64, y)
expect_identical(actual_xy, expected_xy)
expected_yx = op(y, x32)
actual_yx = op(y, x64)
expect_identical(actual_yx, expected_yx)
}
},
.cases = expand.grid(
operator = c("==", "!=", "<", "<=", ">", ">="),
type = c("character", if (getRversion() >= "4.3.0") "factor"),
stringsAsFactors = FALSE
)
)
test_that("Edge cases for character/factor comparisons work", {
# nolint next: expect_comparison_linter. Checking '==' method
expect_true(as.integer64("999999999999999") == "999999999999999")
skip_unless_r(">= 4.3.0")
# nolint next: expect_comparison_linter. Checking '==' method
expect_true(as.integer64("999999999999999999") == as.factor("999999999999999999"))
})
test_that("power with integer64", {
overflow_warning = "NAs produced by integer64 overflow"
# within integer range
x = as.integer(sqrt(.Machine$integer.max))
x = seq(-x, x)
expect_identical(as.integer64(x)^2L, as.integer64(x^2L))
expect_identical(as.integer64(x)^2.0, as.integer64(x^2.0))
# within integer64 range, which fails with double exponent
expect_identical(as.integer64(2147483650)^2L, as.integer64("4611686027017322500"))
expect_identical(as.integer64(-2147483650)^2L, as.integer64("4611686027017322500"))
expect_identical(as.integer64(94906267L)^2L, as.integer64(94906267L) * as.integer64(94906267L))
# integer64 base with integer64 exponent
expect_identical(as.integer64(10L) ^ as.integer64(3L), as.integer64(1000L))
expect_identical(as.integer64(2147483650) ^ as.integer64(2L), as.integer64("4611686027017322500"))
expect_identical(as.integer64(2L) ^ 62L, as.integer64("4611686018427387904"))
expect_identical(as.integer64(2L) ^ as.integer64(62L), as.integer64("4611686018427387904"))
expect_identical(as.integer64(3L) ^ 39L, as.integer64("4052555153018976267"))
# Special bases: 0, 1, -1
expect_identical(as.integer64(0L) ^ 0L, as.integer64(1L))
expect_identical(as.integer64(0L) ^ 1L, as.integer64(0L))
expect_identical(as.integer64(0L) ^ 5L, as.integer64(0L))
expect_warning(expect_identical(as.integer64(0L) ^ (-1L), NA_integer64_), overflow_warning)
expect_identical(as.integer64(1L) ^ 0L, as.integer64(1L))
expect_identical(as.integer64(1L) ^ 100L, as.integer64(1L))
expect_identical(as.integer64(1L) ^ (-5L), as.integer64(1L))
expect_identical(as.integer64(1L) ^ lim.integer64()[2L], as.integer64(1L))
expect_identical(as.integer64(1L) ^ NA_integer64_, as.integer64(1L))
expect_identical(as.integer64(1L) ^ NA_integer_, as.integer64(1L))
expect_identical(as.integer64(-1L) ^ 0L, as.integer64(1L))
expect_identical(as.integer64(-1L) ^ 1L, as.integer64(-1L))
expect_identical(as.integer64(-1L) ^ 2L, as.integer64(1L))
expect_identical(as.integer64(-1L) ^ 3L, as.integer64(-1L))
expect_identical(as.integer64(-1L) ^ (-1L), as.integer64(-1L))
expect_identical(as.integer64(-1L) ^ (-2L), as.integer64(1L))
expect_identical(as.integer64(-1L) ^ (-3L), as.integer64(-1L))
expect_identical(as.integer64(-1L) ^ lim.integer64()[1L], as.integer64(-1L))
expect_identical(as.integer64(-1L) ^ lim.integer64()[2L], as.integer64(-1L))
# Negative exponents with |base| >= 2
expect_identical(as.integer64(2L) ^ (-1L), as.integer64(0L))
expect_identical(as.integer64(2L) ^ (-5L), as.integer64(0L))
expect_identical(as.integer64(-2L) ^ (-1L), as.integer64(0L))
expect_identical(as.integer64(-2L) ^ (-2L), as.integer64(0L))
# Boundary base values with exponent 1
expect_identical(lim.integer64()[1L] ^ 1L, lim.integer64()[1L])
expect_identical(lim.integer64()[2L] ^ 1L, lim.integer64()[2L])
# Overflow detection with both odd and even exponents
expect_warning(expect_identical(as.integer64(2147483650) ^ 3L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(as.integer64(100000L) ^ 8L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(as.integer64(2L) ^ 63L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(as.integer64(2L) ^ 64L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(as.integer64(3L) ^ 40L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(as.integer64(3L) ^ 64L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(lim.integer64()[1L] ^ 2L, NA_integer64_), overflow_warning)
expect_warning(expect_identical(lim.integer64()[2L] ^ 2L, NA_integer64_), overflow_warning)
# Missing values and empty inputs
expect_no_warning(expect_identical(NA_integer64_ ^ 0L, as.integer64(1L)))
expect_no_warning(expect_identical(NA_integer64_ ^ 2L, NA_integer64_))
expect_identical(NA_integer64_ ^ 2L, NA_integer64_)
expect_no_warning(expect_identical(NA_integer64_ ^ (-1L), NA_integer64_))
expect_identical(NA_integer64_ ^ (-1L), NA_integer64_)
expect_no_warning(expect_identical(NA_integer64_ ^ NA_integer64_, NA_integer64_))
expect_identical(NA_integer64_ ^ NA_integer64_, NA_integer64_)
expect_no_warning(expect_identical(as.integer64(0L) ^ NA_integer64_, NA_integer64_))
expect_identical(as.integer64(0L) ^ NA_integer64_, NA_integer64_)
expect_no_warning(expect_identical(as.integer64(-1L) ^ NA_integer64_, NA_integer64_))
expect_identical(as.integer64(-1L) ^ NA_integer64_, NA_integer64_)
expect_no_warning(expect_identical(as.integer64(2L) ^ NA_integer_, NA_integer64_))
expect_identical(as.integer64(2L) ^ NA_integer_, NA_integer64_)
expect_no_warning(expect_identical(as.integer64(2L) ^ NA_integer64_, NA_integer64_))
expect_identical(as.integer64(2L) ^ NA_integer64_, NA_integer64_)
expect_no_warning(expect_identical(as.integer64(2L) ^ NA_real_, NA_integer64_))
expect_identical(as.integer64(2L) ^ NA_real_, NA_integer64_)
expect_identical(integer64() ^ 2L, integer64())
expect_identical(as.integer64(2L) ^ integer(), integer64())
expect_identical(integer64() ^ integer(), integer64())
# Vectorization and recycling
expect_identical(c(as.integer64(2L), as.integer64(3L)) ^ 2L, as.integer64(c(4L, 9L)))
expect_identical(as.integer64(2L) ^ c(1L, 2L, 3L), as.integer64(c(2L, 4L, 8L)))
expect_warning(
expect_identical(c(as.integer64(2L), as.integer64(2L)) ^ c(2L, 64L), c(as.integer64(4L), NA_integer64_)),
overflow_warning
)
})