CFLib.org – Common Function Library Project

IsFactor(a, b)

Last updated July 18, 2001

author

Rob Brooks-Bilson

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Returns True if A is a factor of B.

Return Values:
Returns true or false.

Example:

<CFSET a=25>
  <CFSET b=100>
  <CFOUTPUT>
  Given:
  <UL>
  <LI>a=#a#
  <LI>b=#b#
  </UL>
  Is #a# a factor of #b#? #YesNoFormat(IsFactor(a,b))#
  </CFOUTPUT>

Parameters:

Name Description Required
a Any non negitive integer greater than or equal to 1. Yes
b Any non negitive integer greater than or equal to 1. Yes

Full UDF Source:

/**
 * Returns True if A is a factor of B.
 * 
 * @param a      Any non negitive integer greater than or equal to 1. 
 * @param b      Any non negitive integer greater than or equal to 1. 
 * @return Returns true or false. 
 * @author Rob Brooks-Bilson (rbils@amkor.com) 
 * @version 1, July 18, 2001 
 */
function IsFactor(a,b)
{
  if (Int(b/a) EQ b/a){
    Return True;
    }
  else { 
    Return False;
  }
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson