You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Ronald Holshausen (JIRA)" <ji...@apache.org> on 2016/03/18 04:43:33 UTC
[jira] [Updated] (GROOVY-7794) JsonSlurper is dropping precision of
decimal numbers ending in 0 after the decimal point
[ https://issues.apache.org/jira/browse/GROOVY-7794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ronald Holshausen updated GROOVY-7794:
--------------------------------------
Description:
When parsing JSON documents with numbers that end in a zero after the decimal point, JsonSlurper is not correctly setting the scale.
For example, when run in groovysh:
groovy:000> (1234.0).scale
===> 1
groovy:000> import groovy.json.JsonSlurper
===> groovy.json.JsonSlurper
groovy:000> new JsonSlurper().parseText('1234.0').scale
===> 0
groovy:000> (1234.10).scale
===> 2
groovy:000> new JsonSlurper().parseText('1234.10').scale
===> 1
For a result of this, please refer to https://github.com/DiUS/pact-jvm/issues/221
was:
When parsing JSON documents with numbers that end in a zero after the decimal point, JsonSlurper is not correctly setting the scale.
For example, when run in groovysh:
groovy:000> (1234.0).scale
===> 1
groovy:000> import groovy.json.JsonSlurper
===> groovy.json.JsonSlurper
groovy:000> new JsonSlurper().parseText('1234.0').scale
===> 0
groovy:000> (1234.10).scale
===> 2
groovy:000> new JsonSlurper().parseText('1234.10').scale
===> 1
> JsonSlurper is dropping precision of decimal numbers ending in 0 after the decimal point
> ----------------------------------------------------------------------------------------
>
> Key: GROOVY-7794
> URL: https://issues.apache.org/jira/browse/GROOVY-7794
> Project: Groovy
> Issue Type: Bug
> Components: JSON
> Affects Versions: 2.4.6
> Reporter: Ronald Holshausen
>
> When parsing JSON documents with numbers that end in a zero after the decimal point, JsonSlurper is not correctly setting the scale.
> For example, when run in groovysh:
> groovy:000> (1234.0).scale
> ===> 1
> groovy:000> import groovy.json.JsonSlurper
> ===> groovy.json.JsonSlurper
> groovy:000> new JsonSlurper().parseText('1234.0').scale
> ===> 0
> groovy:000> (1234.10).scale
> ===> 2
> groovy:000> new JsonSlurper().parseText('1234.10').scale
> ===> 1
> For a result of this, please refer to https://github.com/DiUS/pact-jvm/issues/221
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)