From a15b0711341c0d3eb6c04f63f41104cd6eaca64a Mon Sep 17 00:00:00 2001 From: Dasha Korneichuk Date: Thu, 19 Jul 2018 02:02:14 +0300 Subject: [PATCH] Fix typos (#77) * Fix typo * Update 01_price_of_groceries.swift --- 05_hash_tables/swift/01_price_of_groceries.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/05_hash_tables/swift/01_price_of_groceries.swift b/05_hash_tables/swift/01_price_of_groceries.swift index eee11be..dcecb2e 100644 --- a/05_hash_tables/swift/01_price_of_groceries.swift +++ b/05_hash_tables/swift/01_price_of_groceries.swift @@ -8,9 +8,9 @@ book["milk"] = 1.49 book["avacado"] = 1.49 print(book) // => ["avacado": 1.49, "apple": 0.67000000000000004, "milk": 1.49] -// Qustion: Why is "apple" is 0.67000000000000004 intsted of 0.67? +// Qustion: Why is "apple" is 0.67000000000000004 instead of 0.67? // Answer: Double cannot store the value 0.67 exactly. Swift uses (like many other languages) binary floating point numbers according to the IEEE 754 standard. -// This topic is not related with Algorithms, but you can play with .description and .debugDescription for making workarrounds +// This topic is not related to Algorithms, but you can play with .description and .debugDescription for making workarounds print(book["apple"]?.description ?? "Not exist") // => 0.67 print(book["apple"]?.debugDescription ?? "Not exist") // => 0.67000000000000004