Quantcast

Avoid IEEE-754 precision issues

James Whitehead II [12-06-11 - 21:08]
Avoid IEEE-754 precision issues
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index f820f68..48c4ec1 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -193,7 +193,13 @@ function TomTom:GetKeyArgs(m, f, x, y, title)
         f = floors == 0 and 0 or 1
     end

-    return string.format("%d:%d:%d:%d:%s", m, f, x*10e8, y*10e8, tostring(title))
+	-- Fudge the x/y values so they avoid precision/printf issues
+	local x = x * 10000
+	local y = y * 10000
+
+    local key = string.format("%d:%d:%d:%d:%s", m, f, x*10e4, y*10e4, tostring(title))
+	print(key)
+	return key
 end

 local flipFixFrame = CreateFrame("Frame", "TomTomMapFlipFixFrame", UIParent)