Firebase: Saving and Retrieving Floats (Swift)
<p>I'm trying to save and retrieve a float datatype into Firebase. I am able to save just fine and have it structured like below.</p>

<p><a href="https://i.stack.imgur.com/IpBPO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IpBPO.png" alt="Firebase Screenshot"></a></p>

<p>However, when I attempt to retrieve the value using the code</p>

<pre><code>for child in snapshot.children.allObjects as! [FDataSnapshot] {

            let rating = child.value["rating"] as? Float
            print(rating)
</code></pre>

<p>I'm getting the following:</p>

<p>Optional(8.19999981)</p>

<p>Optional(8.69999981)</p>

<p>Optional(9.19999981)</p>

<p>What is the best way to prevent this from occurring?</p>