You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2021/07/20 13:59:00 UTC

[jira] [Commented] (DAFFODIL-2546) Customizable float/double infoset representation

    [ https://issues.apache.org/jira/browse/DAFFODIL-2546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17384280#comment-17384280 ] 

Mike Beckerle commented on DAFFODIL-2546:
-----------------------------------------

A standard way of representing floating point values in text that preserves values exactly, while allowing for them to still be interpreted, is needed. 

For some floating point values, just converting the IEEE binary representation to base 10 text digits and back loses information due to rounding required for converting base 2 to base 10 fractions, and back. Even values as simple as 0.1 do not "round trip" when parsed and converted to XML or JSON text and back using floating point. 

Just carving up the IEEE representation into its 3 integer parts: sign, signed-exponent, unsigned mantissa, just as bit fields might work. Due to IEEE use of a hidden bit (except for denormalized values), and various special case rules about exponent values such as for +0, -0, +inf, -inf, and NaNs, these are hard to interrpret in any way, and it is unclear if this would have any advantage over just hexBinary for 4 bytes or 8 bytes. 

 

> Customizable float/double infoset representation 
> -------------------------------------------------
>
>                 Key: DAFFODIL-2546
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2546
>             Project: Daffodil
>          Issue Type: New Feature
>            Reporter: Steve Lawrence
>            Priority: Minor
>
> Daffodil's default InfosetOutputters use the Float/Double.toString() function for converting float/doubles to a string to be output to an infoset. For some values, the Java toString implementation will switch to scientific notation, which not all consumers can easily handle. We should add a tunable or some other configuration so that users can have some control over how float/double's are converted to a string so that this can be disable or the range changed.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)