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

ASF GitHub Bot commented on TINKERPOP-1736:
-------------------------------------------

Github user spmallette commented on the issue:

    https://github.com/apache/tinkerpop/pull/682
  
    I've dug into supporting `BigDecimal` directly and it's turning into a mess 
a bit. Python does have `Decimal` class which is like `BigDecimal` but it 
doesn't serialize through the standard JSON processor:
    
    
https://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object
    
    so I coerced to float to match our extended module format:
    
    http://tinkerpop.apache.org/docs/current/dev/io/#_bigdecimal
    
    for a number in the `@value`. That sorta worked, but it then causes a loss 
in precision anyway. I think it's just better to go with what I said before. 
Just coerce the `BigDecimal` groovy pushes on us to double internally and then 
it all just works. The test should not explicitly test `BigDecimal`. It should 
test:
    
    ```groovy
    g.withSack(2).V().sack(Operator.div).by(constant(3.0)).sack()
    ```
    
    which in Java will just test double stuff, but in Groovy it will produce a 
`BigDecimal` and our code gets tested. Does that make sense?


> Sack step evaluated by groovy interprets numbers in an unexpected way
> ---------------------------------------------------------------------
>
>                 Key: TINKERPOP-1736
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1736
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.2.5
>            Reporter: stephen mallette
>            Assignee: Daniel Kuppitz
>             Fix For: 3.3.0, 3.1.8, 3.2.6
>
>
> The issue is discussed to some detail on the dev mailing list:
> https://lists.apache.org/thread.html/6b8060c89f5b3744e7a9d1e421b9de980a3e24eb50563423c7690893@%3Cdev.tinkerpop.apache.org%3E
> but basically, this fails:
> {code}
> gremlin> g.withSack(2).V().sack(div).by(constant(3.0)).sack()
> Non-terminating decimal expansion; no exact representable decimal result.
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to