trouble loading FloatProperties that are integral numbers (but cast to floats when saving the Document )

13 views
Skip to first unread message

Doug Snyder

unread,
Mar 24, 2014, 12:46:32 AM3/24/14
to couch...@googlegroups.com
I'm working with float data on the interval [-1,1]
So most of the time the data is not integral but sometimes it is ( -1,0,1)
I am using  FloatProperty to store these values.
Even if the data are integral they are cast to floats when storing the vals in my Document's FloatProperty
I am sure of this. There is only one section in my code that creates my Document
But when I load the data and use it to instantiate my Document subclass,
I get this error in some cases:
Property max0 must be float instance, not a int
but this only occurs if max0 is -1,0, or 1
it seems like the Document class is not able to handle a float from the json
coming from CouchDB that is integral even when its stored originally as a float.
Is this what's going on?
is there a work around?
Doug

Nils Breunese

unread,
Mar 24, 2014, 5:52:37 AM3/24/14
to couch...@googlegroups.com
I don't know exactly what's going on here, but if you want to preserve precision as best as possible, I think it's best to store your values as strings in JSON.

Nils.

Benoit Chesneau

unread,
Mar 24, 2014, 10:25:49 AM3/24/14
to couch...@googlegroups.com
mmm how is the document sent and stored on couchdb?
Reply all
Reply to author
Forward
0 new messages