Comments (6)
@dvirsky I agree. The flag for serialization seems to be wrong at this line:
https://github.com/RedisLabsModules/rejson/blob/master/src/json_object.c#L342
I did some experiment for the flags:
(check out this snippet: https://repl.it/GjP1/0)
#include <stdio.h>
#include <math.h>
#include <float.h>
int main ()
{
float a = 1.333333;
printf("Should be: %lf, but losing precision: %g", a, a);
return(0);
}
Output of the above is:
Should be: 1.333333, but losing precision: 1.33333
Supposedly %g
outputs the shorter of %e
or %f
, which in this case it uses %f
and loses precision. See a similar issue here:
I get the need to save space for serialization, but in this case it should either do more detection in terms of precision or use %f
outright.
from redisjson.
@itamarhaber I think it's a serialization issue, internally we shouldn't be losing precision
from redisjson.
And changing %e
to %lf
fixes the problem:
127.0.0.1:6380[7]> JSON.GET world
"1.333333"
Not sure about the implication in terms of the memory footprint, however.
from redisjson.
It shouldn't matter in terms of memory since this is only done when serializing the objects. Maybe make a PR and we'll continue the discussion over there?
from redisjson.
Here you go.
from redisjson.
Apparently, %.17g
is the more correct version:
from redisjson.
Related Issues (20)
- JSON.DEL emits no `del` event when removing the entire value
- not work expiry time for JSON record
- Does version 2.6.6 necessarily require Redis 7.2? HOT 4
- Consistent crash with Redis 6.2.4 HOT 3
- RedisJSON uses more memory than raw dataset size HOT 1
- `json.arrinsert` is not atomic HOT 1
- Revert JSONPath default path value from `$` to `.` under RESP3 HOT 1
- Build error on Windows HOT 5
- [Fix documentation] : go-redis supports JSON
- Is it possible to cross-compile
- cargo make issue: invalid type: map, expected a string for key `package.edition`
- Sort DESC not working on date field.
- [crash] Redis Stack Cluster 7.2.4 with RedisJSON 2.6.7 HOT 3
- not able to build v2.6.9 HOT 1
- Redis 6.2.14 crashing when loading module librejson.so RedisJSON v2.6.9 HOT 1
- Can't Load Module on Rasberry Pi 3. Is Arm64 supported? HOT 7
- stddef.h not found HOT 1
- Add support for aliases in JSON API HOT 4
- [BUG] After creating index Redis Stack 7.2.3 crashed HOT 4
- Disadvantage using old version redis-json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redisjson.