# NOT RUN {
##
ipv4("192.0.0.1") + 1
ipv6("fd00::1") + 1
ip(c("192.0.0.1", "fd00::1")) + 1
# }
# NOT RUN {
## raises an error
1L - ipv4("192.0.0.1")
## and so will
1 + ipv6("fd00::1")
## as well as
ipv4("192.0.0.1") * 2
# }
# NOT RUN {
##
## Loss of precision in arithmetical operations
##
(2^52 +1)- 2^52
(2^53 +1)- 2^53
##
identical((2^64 +1)- 2^64 , 0 )
## ...and so on
( (2^64 + 2^11 ) - (2^64))
## next representable number with IEEE 754 double precision floats; mind the gap
( (2^64 + 2^12 ) - (2^64))
# }
# NOT RUN {
<!-- % ## -->
# }
# NOT RUN {
<!-- % ( (2^64 + (2^12-1) )- (2^64)) -->
# }
# NOT RUN {
## OTH,
((ipv6('::1') %<<% 53L) + ipv6('::1')) - (ipv6('::1') %<<% 53L)
##
(x <- ( ( ipv6('::1') %<<% 64L ) + ( ipv6('::1') %<<% 11L ) ) - ( ipv6('::1') %<<% 64L ) )
log2(as.numeric(x))
# }
Run the code above in your browser using DataLab