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

ASF subversion and git services commented on AVRO-3876:
-------------------------------------------------------

Commit 51851d49af3283cd31caecf6bdc7b3a4e973a5a6 in avro's branch 
refs/heads/master from Christophe Le Saec
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=51851d49a ]

Avro 3876 jackson util (#2529)

* AVRO-3876: Jackson util symmetric

> JacksonUtils is not symmetric
> -----------------------------
>
>                 Key: AVRO-3876
>                 URL: https://issues.apache.org/jira/browse/AVRO-3876
>             Project: Apache Avro
>          Issue Type: Bug
>    Affects Versions: 1.11.3
>            Reporter: Christophe Le Saec
>            Assignee: Christophe Le Saec
>            Priority: Major
>             Fix For: 1.12.0
>
>
> For each json node, you should have
> {code:java}
> Object object = JacksonUtils.toObject(node);
> JsonNode node1 = JacksonUtils.toJsonNode(object);
> Assertions.assertEquals(node, node1);
> {code}
> But, that's not true for
> {code:java}
> JsonNodeFactory.instance.numberNode(33.33000183105469f);
> {code}
> where test give
> {noformat}
> org.opentest4j.AssertionFailedError: 
> Expected :33.33
> Actual   :33.33000183105469
> {noformat}
> because toObject method transform float to double and by default, 
> Float.toString method gives round values, as this code
> {code:java}
>     float x = 33.33000183105469f;
>     System.out.println("value float  = " + x);
>     System.out.println("value double = " + (double) x);
> {code}
> shows
> {noformat}
> value float  = 33.33
> value double = 33.33000183105469
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to