Double from CoreData returns very small number <p>I am working on a diving application, and one of the feature is to store diving's rating as double into CoreData. The interface should be able to retrieve the double value from the coredata object and then display on screen. However, the problem I got from my code is that the double returned from the object is very small (e with the power of -315). I have no idea why this is happening.</p> <pre><code>if let dives = self.diveSite?.logged_dives { for dive in dives { print("######### dive site info ########") rating = Double(dive.rating) + rating print(dive) print("raw dive site rating is \(dive.rating)") print("dive rating is \(rating)") } } else { print("no logged_dives") } </code></pre> <p>Here is what's been printed out on the console...</p> <pre><code>######### dive site info ######## &lt;ScubaDoo.DiveLog: 0x7fe9ea02cbc0&gt; (entity: DiveLog; id: 0xd000000000180002 &lt;x-coredata://2B6F1E6F-1EDA-4910-91FA-0593E05F9EB2/DiveLog/p6&gt; ; data: { current = nil; depth = 0; "dive_at" = "0xd000000000140000 &lt;x-coredata://2B6F1E6F-1EDA-4910-91FA-0593E05F9EB2/DiveSite/p5&gt;"; id = nil; latitude = 0; longitude = 0; rating = 5; "sea_condition" = nil; temperature = 0; time = nil; weather = nil; }) raw dive site rating is 5.35679601527854e-315 dive rating is 1.06203402623994e-314 dive site rating is 1.06203402623994e-314 </code></pre> <p>The DiveLog object in swift is as below. I really do not have a clue about this. It seems that something is out of bound while getting the rating properties?</p> <pre><code>import Foundation import CoreData extension DiveLog { @NSManaged var time: NSDate? @NSManaged var latitude: NSNumber? @NSManaged var id: String? @NSManaged var rating: NSNumber? @NSManaged var depth: NSNumber? @NSManaged var temperature: NSNumber? @NSManaged var weather: String? @NSManaged var current: String? @NSManaged var sea_condition: String? @NSManaged var longitude: NSNumber? @NSManaged var dive_at: DiveSite? } </code></pre>