Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CF playing silly buggers with doubles
<cfscript>
i = 0
f = 0.0
d = createObject("java", "java.lang.Double").init(0)
writeDump([
i = [
i = i,
"i === i" = i === i,
"i.equals(i)" = i.equals(i),
"i.equals(i) === true" = i.equals(i) === true,
"i.getClass().getName()" = i.getClass().getName()
],
f = [
f = f,
"f === f" = f === f,
"f.equals(f)" = f.equals(f), // <------------------------ FALSE???
"f.equals(f) === true" = f.equals(f) === true,
"f.getClass().getName()" = f.getClass().getName()
],
d = [
d = d,
"d === d" = d === d,
"d.equals(d)" = d.equals(d),
"d.equals(d) === true" = d.equals(d) === true,
"d.getClass().getName()" = d.getClass().getName()
]
])
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment