How to float save mongodb?


#1

C# save float
ex) 0.9f
Mongodb > a : 0.8999999761581421

Meteor Js save parseFloat
ex ) 0.9
Mongodb > a : 0.9000000000000000

C# load fail

What should I do?


#2

I think this is a distinction between C# and Javascript as opposed to a distinction imposed by mongodb.

http://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript provides some context and http://floating-point-gui.de/languages/csharp/ vs http://floating-point-gui.de/languages/javascript/ may help you.


#3

thx :smiley:
C# float -> double change