-
Notifications
You must be signed in to change notification settings - Fork 8
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
BSON should convert Rat to Num where possible #23
Comments
lefth
pushed a commit
to lefth/BSON
that referenced
this issue
Sep 27, 2017
See: MARTIMM#23 Note: Rakudo sometimes detects this incorrectly.
lefth
pushed a commit
to lefth/BSON
that referenced
this issue
Sep 27, 2017
See: MARTIMM#23 Note: Rakudo sometimes detects this incorrectly.
lefth
pushed a commit
to lefth/BSON
that referenced
this issue
Oct 20, 2017
See: MARTIMM#23 Note: Rakudo sometimes detects this incorrectly.
lefth
pushed a commit
to lefth/BSON
that referenced
this issue
Oct 20, 2017
See: MARTIMM#23 Note: Rakudo sometimes detects this incorrectly.
lefth
pushed a commit
to lefth/BSON
that referenced
this issue
Oct 20, 2017
See: MARTIMM#23 Note: Rakudo sometimes detects this incorrectly.
PR is merged, thanks Dan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When floats/doubles are serialized to JSON then converted to Perl numbers, they're re-interpreted as Rat. Rat can't be handled by the database and gives an error.
Suggested solution: if Rat can be converted to Num without loss of data, do it. This will let BSON work with data that has been serialized without truncating data. (Verify that
$n.Num.Rat == $n
first.)It would also be nice if BSON had an option that enabled truncating all floating point types to a type that is allowed in the database, even if some precision is lost. Perhaps
$doc.accept-numbers
, analogous toaccept-hash
which permits order information loss.#23
The text was updated successfully, but these errors were encountered: