-
Notifications
You must be signed in to change notification settings - Fork 556
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
Output xsd:double #2918
Comments
Thanks for filing this issue @dukesook When serializing any literal to turtle representation (aka, N3 serialization), a method called Lines 1528 to 1530 in 0b69f4f
I don't know why anyone would want to do that deliberately write incorrect data to the output file. rdflib/rdflib/plugins/serializers/turtle.py Lines 360 to 364 in 0b69f4f
I don't why it does this by default, or why its not configurable, but it seems like RDFLib has operated in this way since before the Turtle serializer was moved into the module in RDFLib codebase in RDFLib v3.0.0 in 2010. |
I found where the 6 decimal places comes from. When you use the "%e" formatting mark (or ":e" in f-strings), it converts the double to scientific notation, with "p" decimal points. Where if "p" is not given, it defaults to 6. We can't simply change it to something higher like |
Making a fix for this would be considered a breaking change, so this is another candidate for something to overhaul for the big RDFLib 8 release later this year. |
@ashleysommer |
I'm trying to write a literal xsd:double in here:
Output
However, instead of "12345.678912345"^^xsd:double, I'm getting 1.234568e+04. I want to explicitly show the datatype and not lose any precision.
The text was updated successfully, but these errors were encountered: