Big Decimal

166 views
Skip to first unread message

christkv

unread,
Jun 29, 2011, 10:18:14 AM6/29/11
to BSON
Hi

I'm the maintainer of the mongodb driver for node.js and I'm getting
some requests around representation of values.

Right now there is a 32 bit integer, 64 bit integer and a 64 bit float
type for bson. However some people are trying to store larger numbers
(I expect scientific or something similar) that have a need for a
larger resolution than 64bits. I'm thinking maybe a big decimal or big
integer type would be useful but I might be completely off my rocker
in this case ?

Right now I'm just telling people to store their big decimals in a
serialized form as a string.

Gergely Nagy

unread,
Jun 29, 2011, 10:39:06 AM6/29/11
to bs...@googlegroups.com
> Right now there is a 32 bit integer, 64 bit integer and a 64 bit float
> type for bson. However some people are trying to store larger numbers
> (I expect scientific or something similar) that have a need for a
> larger resolution than 64bits. I'm thinking maybe a big decimal or big
> integer type would be useful but I might be completely off my rocker
> in this case ?
>
> Right now I'm just telling people to store their big decimals in a
> serialized form as a string.

The binary type would be more appropriate, in my opinion.

--
|8]

christkv

unread,
Jun 29, 2011, 10:44:55 AM6/29/11
to BSON
Hi Gergely

Yeah that's true. It would be nice to have a native type though or a
binary subtype that would allow for mapping to some sort of correct
type for calculations on mongodb or on the client side of a driver.
For now I guess I can just tell people to pick their own subtype
number and assign it to BCD for their apps.

On Jun 29, 4:39 pm, Gergely Nagy <alger...@madhouse-project.org>
wrote:

Scott Hernandez

unread,
Jun 29, 2011, 10:45:29 AM6/29/11
to bs...@googlegroups.com
Yes, you can can store it as a binary but without a fixed scale it is
hard to search on; but just for storage it will be just fine.

christkv

unread,
Jun 29, 2011, 11:16:02 AM6/29/11
to BSON
Hi Scott

Do you think it would make sense long term to define a type (or
subtype for binary) for scientific calculations so mongo would be able
to perform calculations? For node there would definitively need to be
a c++ driven extension to make it fast as the current implementations
are pretty slow.

Cheers

Christian

Scott Hernandez

unread,
Jun 29, 2011, 11:20:34 AM6/29/11
to bs...@googlegroups.com
If you want the server to do smart things then yes, but currently
there are no plans to add variable size/scale ints or fp types.

If you read through the archives you will find previous discussions about this.

christkv

unread,
Jun 29, 2011, 11:53:46 AM6/29/11
to BSON
Roger :). Now at least I know how to respond to people asking :)

On Jun 29, 5:20 pm, Scott Hernandez <scotthernan...@gmail.com> wrote:
> If you want the server to do smart things then yes, but currently
> there are no plans to add variable size/scaleintsor fp types.
Reply all
Reply to author
Forward
0 new messages