When I save the float number into MongoDB using csharp driver it is not saved accurately. If my number is 1504.57 I expect the database will have the same number but for some reason it become 1504.56994628906 (with Double type in MongoDB). What's going on? How to keep data accurately?

My object keep all the field as object types and cast them on the fly depending on the type, for example:

```
 this.Values[i] = float.Parse(this.Values[i].ToString());

```

Maybe is it the reason of this strange behavior? But after casting this.Values[i] is pretty accurate and it's spoiled only in database.
Thanks

Update. 
The class that incapsulates data:
public class TransferredData
 {
 [BsonElement("\_id")]
 [ScriptIgnore]
 public ObjectId Id { get; set; }

```
    public class Data
    {
        public List<Object> Values { get; set; }
        public DateTypes DataType { get; set; }
        public void CastToType()
        {
            for (int i = 0; i < this.Values.Count; i++ )
            {
                if (this.DataType == DateTypes.Date)
                {
                    DateTime dt = DateTime.Parse(this.Values[i].ToString());
                    this.Values[i] = dt.ToUniversalTime().Date;
                }
                else if (this.DataType == DateTypes.Other)
                {
                    this.Values[i] = this.Values[i].ToString();
                }
                else if (this.DataType == DateTypes.Reading)
                {
                    this.Values[i] = float.Parse(this.Values[i].ToString());
                }
            }
        }
    }

```

}

I use Object type because I don't know which actual type it could be. So, just before doing upsert I fill up this class by data and then call Cast method.

```
Then I save it into db:
data = new TransferredData();
...
data.Values[1] = "1504.57"; // Because the input is always string
data.CastToType(); // Here data.Values[1] = 1504.57 - cool
TransferredDataCollection.Save<TransferredData>(data, SafeMode.True);

```

After this moment, looking into database... it's 1504.56994628906