Weird result when multiplying a number with a comma in it
I know how to get around this, but I thought it was really odd and wonder if anyone can explain it.
<cfoutput>#replace('$1,000','$','','all')*100#</cfoutput>
This was in a system that processes payments. It is just supposed to determine how many cents are in the total. I would expect this to return EITHER 100000 or an error because the comma makes it an invalid number format. Instead, it returns 4273500! What the heck is that?
I confirmed this on CF9, CF10, and CF11. Lucee returns an error ("Can't cast 1,000 to integer"), as I would expect.
Of course, it was poor programming to allow the comma to come through to begin with. That has been resolved, but I am still wondering what CF is even doing to get that number.
By the way, someone donated $1,000 to a charity through this system and was actually charged $42,735!
