-
Notifications
You must be signed in to change notification settings - Fork 826
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
Bignum support #69
Comments
Bignum support is very much needed !! The CDMI and OCCI cloud standards are using JSON as a data format. Storage devices capacities defined in JSON easily exceed 10 decimal digits. 64bit and possible 128 bit integers are a requirement. |
As a workaround, I converted my big numbers to JSON strings and then converted them back on the server. |
Im using the same solution as watsocd, convering to strings then converting back when the analysis is done. It would be great if some uint64_t, etc, etc, was added. |
I would like to bring this topic up again since I see need for it and also have a solution in mind. I also would like to provide the patch for it, if desired. This would also help to solve #288. I would like to go a different route though compared to the way it was suggested in the patch linked above or the PR #158. I would recommend to store integers and floating point values internally as string values just as how they were extracted from the Json input. This would retain the original value and help in round trip decoding and encoding. The machine representation of the value can be stored alongside the string representation, if performance is a concern. Users of jansson can decide to use the string representation of these values and feed them to libraries like GMP in order to process them. The API provided by jansson can be kept in its current state, the conversion from string to integer and back again would happen on demand and hidden from the user of the API. A new function The biggest upside would be that this eliminates the need for the extra types Please let me know what you think @akheron. I would like to start working on this soon if the changes are desired and there is a chance this can be merged. |
Sounds good. A few notes: You would also need to add a function to extract the original string representation for integers and reals. Storing the string representation should be optional, so that it's only stored if a certain decoding flag is given. This would lower the memory impact for those who don't use the original string.
Looking at the code, |
Of course, the changes would be pointless without access to these values. I'm aware that the internals of the
This is a very good idea, I'll implement it that way. The functions to retrieve the string representation of the stored numbers would do a string conversion on demand in this case then. Is this a good idea?
I'm afraid this is not possible since |
Ah, true. |
How about we use the yajl way:
which allow user generate
|
Anything has been done yet to support Unsigned 64 bit numbers? |
I got this error while parsing a JSON string: too big integer near '15726282638479065023' This number is bigger than LLONG_MAX but is smaller than ULLONG_MAX so it would fit into an unsigned long long... I could definitely benefit from ull support... |
Bump.. this is still needed. Suricata flow ids and session ids in eve.json format exceed formatting specs. If JSON_DECODE_INT_AS_REAL is used, its properly parsed, but all integers are now floats. Be nice to convert this to a float only IF the value size exceeds size of long.
|
The jansson library used by the new JSON support powered by libjansson fails on large integers. A few of the Exercism exercises feature large integers in the expected test data. There is an upstream issue: akheron/jansson#69 The built-in json parsing written in Emacs Lisp doesn't have that problem. Since we won't run into performance issues this is a good solution for this tool. See https://emacs.stackexchange.com/questions/76530/json-parsing-fails-json-parse-error-too-big-integer/ for more info
The jansson library used by the new JSON support powered by libjansson fails on large integers. A few of the Exercism exercises feature large integers in the expected test data. There is an upstream issue: akheron/jansson#69 The built-in json parsing written in Emacs Lisp doesn't have that problem. Since we won't run into performance issues this is a good solution for this tool. See https://emacs.stackexchange.com/questions/76530/json-parsing-fails-json-parse-error-too-big-integer/ for more info
Adds a practice exercise generator called via `bin/generate_practice_exercise`. * adds instruction and configuration files via `configlet` * generates stubs for the solution and test file via Emacs Lisp --- Why does the generator not use the newer libjansson based JSON parser? The jansson library used by the new JSON support powered by libjansson fails on large integers. A few of the Exercism exercises feature large integers in the expected test data. There is an upstream issue: akheron/jansson#69 The built-in json parsing written in Emacs Lisp doesn't have that problem. Since we won't run into performance issues this is a good solution for this tool. See https://emacs.stackexchange.com/questions/76530/json-parsing-fails-json-parse-error-too-big-integer/ for more info
Add bigint/bigfloat types and hooks to allow using external libraries to manage them.
There's an initial patch by Deron Meranda here: http://deron.meranda.us/computing/c/jansson-bignum/
The text was updated successfully, but these errors were encountered: