Created
May 1, 2022 17:58
-
-
Save adamcameron/0423682320d2cc1479db23f825c18d46 to your computer and use it in GitHub Desktop.
CF playing silly buggers with doubles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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