> On Aug 14, 2014, at 6:38 AM, James Norman <[email protected]> wrote:
> 
> I'm storing a long in the properties map of a local database and syncing that 
> with others.  In the local database it is returned as a Long which is 
> correct, but when synced to other databases it is returned as a Double. 

That's expected behavior. The JSON format doesn't distinguish between integer 
and floating-point; it just has a single "number" type. It's up to the parser 
code how that's converted to a platform data type.  Sounds like the JSON parser 
used by Java parses all JSON numbers to Doubles. If you want the number in some 
other form, you'll need to cast it.

(In case you're worried about round-off error: double-precision floating point 
can exactly represent all integers up to about ±2^50.)

—Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/34318027-961C-4E73-A9A6-615CA31FBC7B%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to