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;
  }
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson