On Sun, Jun 13, 2010 at 02:11, Robert Newson <robert.new...@gmail.com>wrote:

> Jan also mentioned your new library on IRC, so that was certainly one
> of the candidates for that approach.
>
> While it's true that the Javascript view server is where the 32-bit
> limitation will be most noticeable, I think we want bignum support
> everywhere that the limitation appears.
>

AFAIK the JSON standard does not mandate IEEE-754 floats. All it says is
numbers, a dot, and more numbers. AFAIK this is valid JSON:

    {"num": 123456789112345678921234567893.123456789112345678921234567893}

Certainly the major view server languages support Bignum/BigDecimal
(Javascript is crippled, but hey--story of Javascript's life). If their JSON
parsers choke on the above JSON they have their own bugs.

I hate to sidetrack conversation but I am unclear which Couch component has
a bug.

Hmm, it looks like mochijson2 cannot parse that JSON however it can parse
bigints:

10> {struct, [{_, BigI}]} = mochijson2:decode(<<"{\"foo\":
12345678911234567892123456789312345678941234567895}">>).
{struct,[{<<"foo">>,
          12345678911234567892123456789312345678941234567895}]}
11> BigI + 7.
12345678911234567892123456789312345678941234567902


> B.
>
>
> On Sat, Jun 12, 2010 at 8:06 PM, Jason Smith <j...@couch.io> wrote:
> > On Sun, Jun 13, 2010 at 01:24, Robert Newson (JIRA) <j...@apache.org>
> wrote:
> >
> >>
> >>    [
> >>
> https://issues.apache.org/jira/browse/COUCHDB-796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878298#action_12878298
> ]
> >>
> >> Robert Newson commented on COUCHDB-796:
> >> ---------------------------------------
> >>
> >> Sorry, I pasted a terse summary from #couchdb and was then too busy to
> >> flesh this out.
> >>
> >> I'm actually not sure I like the idea of tweaking mochijson2.erl, though
> it
> >> was suggested (by you iirc ;). Also the notion that numbers magically
> become
> >> strings at some point feels wrong, but so also does the notion that a
> sum()
> >> overflows or goes wrong when you hit that limit too.
> >>
> >> Rather, I think a guarantee that some bignum.js library is always
> available
> >> and some prominent docs about it. Ideally a BigDecimal and BigInteger
> class
> >> like Java has (yes, kill me).
> >>
> >
> > Weird, I just created that exact project the other day.
> > http://github.com/jhs/bigdecimal.js
> >
> > It is indeed the Java class! It is the Apache Harmony
> BigDecimal/BigInteger
> > implementation, compiled to Javascript thanks to GWT. This list isn't the
> > place to debate whether that's wise but a the very least, CouchDB's
> default
> > view server can support BigDecimal. I even put up a demo expression
> > evaluator:
> >
> >
> http://jhs.couchone.com/bigdecimal/_design/bigdecimal_demo/_show/ui?e=5192834791234712811238476129384671293847611923192386479347.1234876123467129384761234%20*%205123412612351263.1123412365123541234
> >
> > What is my point? That CouchDB perhaps does not need bigdecimal support
> in
> > mochijson2 because it is quite straightforward to get things working
> within
> > the view server.
> >
> > --
> > Jason Smith
> > Couchio Hosting
> >
>



-- 
Jason Smith
Couchio Hosting

Reply via email to