You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Matt Frantz (JIRA)" <ji...@apache.org> on 2015/09/03 19:37:45 UTC

[jira] [Commented] (TINKERPOP3-824) Do we need runtime BigDecimal in more places?

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

Matt Frantz commented on TINKERPOP3-824:
----------------------------------------

Scenario that fails due to {{SumGlobalStep}}'s conversion of {{Number}} to {{double}}:

{noformat}
gremlin> g.V().values('age').
map{it -> new BigInteger(it.get()).pow(1000)}.
sum()
==>Infinity
{noformat}

Scenario that fails due to {{Operator.sum}}'s lack of support for {{BigInteger}}:

{noformat}
gremlin> g.V().values('age').
map{it -> new BigInteger(it.get()).pow(1000)}.
fold(BigInteger.ZERO, sum)
This operator only supports int, long, float, or double: class java.math.BigInteger
{noformat}

Scenario that fails due to {{SackFunctions.Barrier.normSack}}'s conversion of {{Number}} to {{double}}:

{noformat}
gremlin> g.withSack(BigInteger.TEN.pow(1000), assign).
V().local(out('knows').barrier(normSack)).
in('knows').barrier().sack()
==>NaN
==>NaN
{noformat}


> Do we need runtime BigDecimal in more places?
> ---------------------------------------------
>
>                 Key: TINKERPOP3-824
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-824
>             Project: TinkerPop 3
>          Issue Type: Improvement
>            Reporter: Marko A. Rodriguez
>
> [~mhfrantz] recently made {{Compare}} use {{BigDecimal}} so we don't destroy the precision of the underlying {{Number}} object.
> I think we might need this sort of conversion in more places: {{Operator}} and {{SackFunctions}}.
> Perhaps a {{NumberHelper}} might be a nice class to have that does the dirty work so that future work with numbers is easy and consistently patterned.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)