Divide by zero problem
Why does n%3 or n MOD 3 return 'Division by zero is not allowed.', if n == 0? (3 can be any number).
Using CF 9,0,1,274733
Doug
Why does n%3 or n MOD 3 return 'Division by zero is not allowed.', if n == 0? (3 can be any number).
Using CF 9,0,1,274733
Doug
The modulo operator being used with real/double numeric values doesn't make much sense from a maths point of view in the first place as it's really meant to provide you the remainder after an integer division.
ColdFusion still lets you do this, but if the right hand side of the modulo operator is a real/dobule numeric value it will just ignore the fractional part. In your case it will do 3 MOD 0 -> therefore division by zero error.
This particular behaviour is actually documented in the CF documentation as such.
Cheers
Kai
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.