Aklakan commented on PR #3405: URL: https://github.com/apache/jena/pull/3405#issuecomment-3246097544
Just my two cents: The exponential notation of decimals in BigDecimal seems to be a mere feature of certain "toString" functions. `Decimal.toPlainString` does not generate exponent fields. https://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation > 3.2.3.1 Lexical representation decimal has a lexical representation consisting of a finite-length sequence of decimal digits (#x30-#x39) separated by a period as a decimal indicator. An optional leading sign is allowed. If the sign is omitted, "+" is assumed. Leading and trailing zeroes are optional. If the fractional part is zero, the period and following zero(es) can be omitted. For example: -1.23, 12678967.543233, +100000.00, 210. > 3.2.3.2 Canonical representation The canonical representation for decimal is defined by prohibiting certain options from the [Lexical representation (ยง3.2.3.1)](https://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation). Specifically, the preceding optional "+" sign is prohibited. The decimal point is required. Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero. https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/math/BigDecimal.html#toPlainString() > public [String](https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/lang/String.html) toPlainString() Returns a string representation of this BigDecimal without an exponent field. For values with a positive scale, the number of digits to the right of the decimal point is used to indicate scale. For values with a zero or negative scale, the resulting string is generated as if the value were converted to a numerically equal value with zero scale and as if all the trailing zeros of the zero scale value were present in the result. The entire string is prefixed by a minus sign character '-' ('\u002D') if the unscaled value is less than zero. No sign character is prefixed if the unscaled value is zero or positive. As a side note, perhaps it is desired in TDB2 to use expose non-canonical Decimals directly with `toPlainString` instead of `canonicalDecimalStrNoIntegerDot`. The implication is that legacy stored decimals would be exposed without the trailing `.0`. However, legacy data could then be upgraded with this sparql statement (at least in theory): `DELETE { ?s ?p ?o } INSERT { ?s ?p ?o } WHERE { ?s ?p ?o FILTER(datatype(?o) = <http://www.w3.org/2001/XMLSchema#decimal>) }` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
