Monday, August 6, 2007

Determining if two numbers are evenly divisible or not

Recently, I have had to validate a couple of entry fields to ensure that the value entered in one field is evenly divisible by the value entered in the other field. The built in function %Rem() worked perfectly for me.

If %Rem(Numerator:Denominator) > 0
// reminder exists, fields not divisible
.......raise error condition - let user know that value is not a multiple
EndIf;

This function returns the reminder from the division operation of its factors -(Numerator/Denominator).

No comments: