Skip to content

Instantly share code, notes, and snippets.

@adamcameron
Created May 1, 2022 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcameron/0423682320d2cc1479db23f825c18d46 to your computer and use it in GitHub Desktop.
Save adamcameron/0423682320d2cc1479db23f825c18d46 to your computer and use it in GitHub Desktop.
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