Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to append a bigint number just like 33383002443812481 #69

Closed
sunyaf opened this issue Oct 29, 2020 · 9 comments
Closed

how to append a bigint number just like 33383002443812481 #69

sunyaf opened this issue Oct 29, 2020 · 9 comments

Comments

@sunyaf
Copy link

sunyaf commented Oct 29, 2020

our user_id is very big , number type is bigint,like 33383002443812481
when i excutor
R.APPENDINTARRAY test 33383002443812481
i get is R.GETINTARRAY test result is 4063432321

@aviggiano
Copy link
Owner

Hello @sunyaf thank you for the bug report.

Indeed I believe this is being caused by an integer overflow, since 33383002443812481 % 2^32 = 4063432321

I'll look into this and see if this limitation can be removed, otherwise I'll update the documentation to be explicit about this.

@sunyaf
Copy link
Author

sunyaf commented Oct 29, 2020

thank you,it would be soon to be happy.
because i will use it as soon as possible.
it would be very helpful to me.
thank you very much.

@sunyaf
Copy link
Author

sunyaf commented Oct 29, 2020

Hello @sunyaf thank you for the bug report.

Indeed I believe this is being caused by an integer overflow, since 33383002443812481 % 2^32 = 4063432321

I'll look into this and see if this limitation can be removed, otherwise I'll update the documentation to be explicit about this.
thank you,it would be soon to be happy.
because i will use it as soon as possible.
it would be very helpful to me.
thank you very much.

@aviggiano
Copy link
Owner

Hello

I have confirmed that this issue is due to R.APPENDINTARRAY using internally (1, 2) 32-bit integer arrays, which is the default implementation of the CRoaring build.

From a quick look on their repo it seems that it is possible to create a 64-bit version of the library for C++, but I didn't find anything for C specifically, which could put us in trouble.

In any case, I think this issue won't be very easy to fix.
I'll probably just update the README for now to make it clearer that integers are capped at 32-bits.

I'll keep you updated.

@aviggiano
Copy link
Owner

Update: I have confirmed that CRoaring do not support 64-bit integers: RoaringBitmap/CRoaring#232, RoaringBitmap/CRoaring#1

We'll have to monitor their progress, so there isn't much we can do on this front for now.
I'll update the README.

@sunyaf sunyaf closed this as completed Oct 30, 2020
@sunyaf
Copy link
Author

sunyaf commented Oct 30, 2020

i find this
`
#include
#include "roaring.hh"
#include "roaring.c"
int main() {
Roaring r1;
for (uint32_t i = 100; i < 1000; i++) {
r1.add(i);
}
std::cout << "cardinality = " << r1.cardinality() << std::endl;

Roaring64Map r2;
for (uint64_t i = 18000000000000000100ull; i < 18000000000000001000ull; i++) {
r2.add(i);
}
std::cout << "cardinality = " << r2.cardinality() << std::endl;
return 0;
}
`
https://github.com/RoaringBitmap/CRoaring
you can search 'Roaring64Map'

@lemire
Copy link
Contributor

lemire commented Oct 30, 2020

The C library is 32-bit only but there is a 64-bit extension in C++.

@sunyaf
Copy link
Author

sunyaf commented Oct 30, 2020

i find this
`
#include
#include "roaring.hh"
#include "roaring.c"
int main() {
Roaring r1;
for (uint32_t i = 100; i < 1000; i++) {
r1.add(i);
}
std::cout << "cardinality = " << r1.cardinality() << std::endl;

Roaring64Map r2;
for (uint64_t i = 18000000000000000100ull; i < 18000000000000001000ull; i++) {
r2.add(i);
}
std::cout << "cardinality = " << r2.cardinality() << std::endl;
return 0;
}
`
https://github.com/RoaringBitmap/CRoaring
you can search 'Roaring64Map'

Requirements

  • The library should build on a Linux-like operating system (including MacOS).
  • We also support Microsoft Visual studio.
  • Though most reasonable processors should be supported, we expect a recent Intel processor: Haswell (2013) or better but support all x64/x86 processors. The library builds without problem on ARM processors.
  • Recent C compiler supporting the C11 standard (GCC 4.8 or better or clang), there is also an optional C++ class that requires a C++ compiler supporting the C++11 standard.
  • CMake (to contribute to the project, users can rely on amalgamation/unity builds).
  • clang-format (optional).
  • Serialization on big endian hardware may not be compatible with serialization on little endian hardware.

@sunyaf
Copy link
Author

sunyaf commented Oct 30, 2020

I think C can code with C++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants