incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Narciso GarcĂ­a Revington <p.reving...@gmail.com>
Subject decimal and builtin _sum function
Date Fri, 15 Nov 2013 09:29:40 GMT
Hi,

I want to sum decimals with the builtin _sum function.
My documents look like
{
   "_id": "7a2c5e50dfeb1341d02aa27c7a05f629",
   "_rev": "4-482ff2f6b6e5c2aa079e3e4114d02093",
   "type": "payment",
   "amount": "0.2"
}
I store the numbers as strings because I read this the proper way for
decimals.

If I try to sum them with the builtin _sum I get the following error
"builtin _sum function requires map values to be numbers"

I removed the quotes from the numbers. Now I can sum them but 0.2 + 0.1
equals to 2.99999999

I'm using couchdb 1.3. What can I do?

Best,

Pedro

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message