CFLib.org – Common Function Library Project

MathLib

Last updated January 8, 2013 / 146 Released UDF(s)
Acosh

Returns the inverse hyperbolic cosine of a value. | Requires: CF5

Acot

Returns the inverse cotangent of a value. | Requires: CF5

Acoth

Returns the inverse hyperbolic cotangent of a value. | Requires: CF5

Acsc

Returns the inverse cosecant of an angle. | Requires: CF5

Acsch

Returns the inverse hyperbolic cosecant of an angle. | Requires: CF5

AreaCircle

Calculates the area of a circle. | Requires: CF5

AreaEllipse

Calculates the area of an ellipse. | Requires: CF5

AreaParallelogram

Calculates the area of a Parallelogram. | Requires: CF5

AreaRectangle

Calculates the area of a rectangle. | Requires: CF5

AreaRhombus

Calculates the area of a rhombus. | Requires: CF5

AreaSquare

Calculates the area of a square. | Requires: CF5

AreaTrapezoid

Calculates the area of a trapezoid. | Requires: CF5

AreaTriangle

Calculates the area of a triangle. | Requires: CF5

Asec

Returns the inverse secant of an angle. | Requires: CF5

Asech

Returns the inverse hyperbolic secant of a value. | Requires: CF5

Asinh

Returns the inverse hyberbolic sine of a value. | Requires: CF5

atan2

Calculates the arc tangent of the two variables, x and y. | Requires: CF5

Atanh

Returns the inverse hyberbolic tangent of a value. | Requires: CF5

averageWithoutZeros

Calculates the average of a set of numbers omitting values less than 1 from that average. | Requires: CF5

baseMToBaseN

Converts a number from one arbitrary base to another arbitrary base. | Requires: CF10

Bin2Hex

Converts binary data to hexadecimal format. | Requires: CF5

BinToDec

Converts from binary (base2) to decimal (base10). | Requires: CF5

calcDistance

Calculate direct distance and angle between two decimal coordinates. | Requires: CF9

CalcPolygonArea

Calculates the area of an irregular N sided Polygon. | Requires: CF5

CircumferenceCircle

Calculates the circumference of a circle | Requires: CF5

CND

Cumulative Normal Distribution | Requires: CF5

CoDistance

Calculates the distance between two sets of coordinates. | Requires: CF5

Combination

Returns the Combination of n elements taken p at a time. | Requires: CF5

CoMidpoint

Returns the coordinates of the midpoint between two points on a line. | Requires: CF5

ComplexNum

Create a complex number as a structure. | Requires: CF5

ComplexNumAbs

Absolute value |z| of a complex number. | Requires: CF5

ComplexNumAdd

Adds two complex numbers. | Requires: CF5

ComplexNumMultiply

Multiply two complex numbers. | Requires: CF5

ComplexNumToString

Convert a stored complex number to a string in the form a + bi. | Requires: CF5

Convert2Number

Converts any numeric string (even ones with currancy symbols to a number). | Requires: CF5

ConvertLength

Convert bewteen standard and metric lengths. | Requires: CF5

Cosh

Returns the hyberbolic cosine of an angle. | Requires: CF5

Cot

Returns the Cotangent of an angle. | Requires: CF5

Coth

Returns the hyperbolic cotangent of an angle. | Requires: CF5

Csc

Returns the cosecant of an angle. | Requires: CF5

Csch

Returns the hyperbolic cosecant of an angle. | Requires: CF5

CVpop

Returns the coefficient of variation for a set of values (entire population). | Requires: CF5

CVsamp

Returns the coefficient of variation for a set of values (populaiton sample). | Requires: CF5

Decimal2Sexagesimal

Converts a decimal Lat/Long coordinate into sexagesimal (degrees, minutes, seconds). | Requires: CF5

decimalRound

Rounds a number to a specific number of decimal places by using Java's math library. | Requires: CF6

DecToBin

Converts from decimal (base10) to binary (base2). | Requires: CF5

DecToHex

Converts from decimal(base10) to hexadecimal (base16). | Requires: CF5

DecToOct

Converts from decimal (base10) to octal (base8). | Requires: CF5

DegToRad

Converts degrees to radians. | Requires: CF5

ErlangB

Calculates the Grade of Service (failure rate) based on Busy Hour Traffic (Erlangs) and number of indepenedent lines | Requires: CF5

Factor

Returns a list of all factors for a given positive integer. | Requires: CF5

Factorial

Returns the factorial (n!) for a given positive integer. | Requires: CF5

FibCalc

This script Calculates the Fibonacci sequence (each integer is the sum of the two previous integers). | Requires: CF5

FibGen

Returns the Fibonacci sequence to n places given a starting point of x and y. | Requires: CF5

floatToHex

Converts a java float to a 32-bit hexadecimal representation | Requires: CF6

forecast

Performs a number of statistical functions on a set of points. | Requires: CF6

fractionToDecimal

Convert fractions to decimal. | Requires: CF5

GCD

Calculates the GCD (greatest common factor [divisor]) of two positive integers using the Euclidean Algorithm. | Requires: CF5

GCDee

Finds the GCD (greatest common factor [divisor]) of two numbers using the Extended Euclidean Algorithm. | Requires: CF5

getHaversineDistance

Calculates distance between Latitude/Longitude points using haversine formula. | Requires: CF9

GetPrimes

Creates an array of all the prime numbers from 1 to the specified integer. | Requires: CF5

getRandomNumber

This UDF returns a random number of a length passed in by the user. | Requires: CF5

HexToDec

Converts from hexadecimal (base16) to decimal (base10). | Requires: CF5

hexToFloat

Converts a 32-bit hexadecimal floating-point number to a java float | Requires: CF6

histogram

Bins the elements of an array into equally spaced containers and returns the number of elements in each container. | Requires: CF7

hyGetQuantile

Function which returns the value of a certain quantile from a list of numeric values. | Requires: CF5

Hypotenuse

Returns the hypotenuse of a right triangle by Pythagorean theorem, given the lengths of the other two sides. | Requires: CF5

InitialTrueCourse

Calculates the initial true course between two latitudes and longitudes. | Requires: CF5

inPolygon

I check if a point is inside of a polygon. | Requires: CF6

intervalRound

Rounds any real number to a user specified interval. | Requires: CF5

inverseNorms

Calculating the inverse normal cumulative distribution function | Requires: CF5

IsEven

Returns true if the number passed it is even, returns false if it is not. | Requires: CF5

IsFactor

Returns True if A is a factor of B. | Requires: CF5

isFloat

IsFloat() determines if a number is a float or whole number. Returns true for float. | Requires: CF5

IsInt

Checks to see if a var is an integer. | Requires: CF5

IsOdd

Returns true if the number passed it is odd, returns false if it is not. | Requires: CF5

IsPerfectNumber

Returns True if the specified number is a perfect number. | Requires: CF5

isPointInCircle

Determines if a point lies within a circle. | Requires: CF5

IsPrimeNumber

Returns True if the specified number is a prime number. | Requires: CF5

IsRightTriangle

Takes any three numbers, checks to see whether they create a right triangle. | Requires: CF5

IsScientific

Returns true if passed value is formatted in "baseEexp" scientific notation. | Requires: CF5

KilometersToNauticalMiles

Convert kilometers to nautical miles. | Requires: CF5

LatLonDist

Calculates the distance between two latitudes and longitudes. | Requires: CF5

LatLonForCourseAndDistance

Calculates the latitude and longitude for a given latitude, longitude, true course and distance in nautical miles. | Requires: CF5

ListAggregate

Turn a list of numbers into a summation sequence. | Requires: CF5

ListSum

Adds all the numbers in a delimited list returning the sum of the list. | Requires: CF5

Log2

Returns the logarithm to the base 2 of the value. | Requires: CF5

Logic2bit

Converts logic bit constants (TRUE, "Yes", 1,FALSE,"No",0) or logical expressions to bit values (1,0). A non-boolean value returns a -1 value. | Requires: CF5

LogN

Returns the logarithm of a value to the specified base. | Requires: CF5

makeFraction

Turns a decimal number into a reduced fraction. | Requires: CF5

Mean

Returns the mean (average) value for a set of numberic values. | Requires: CF5

Median

Returns the median (middle) value for a set of numberic values. | Requires: CF5

Midrange

Returns the midrange value for a set of numbers. | Requires: CF5

MinMax

Returns the smallest and largest value in a set of values. | Requires: CF5

Mode

Returns the mode and frequency for a given set of values. | Requires: CF5

NauticalMilesToKilometers

Convert Nautical Miles to Kilometers. | Requires: CF5

nBase36

Creates a base 36 from numbers that don't fit inside an integer. | Requires: CF5

NormDist

Calculates the normal distribution for a given mean and standard deviation with cumulative=true | Requires: CF5

OctToBin

Converts from octal (base8) to decimal (base10). | Requires: CF5

pearsonCorrelation

Calculates the Pearson correlation. | Requires: CF5

Percentage

Returns the percentage of value out of maximum. | Requires: CF5

PercentageChange

Check the percentage change between 2 numbers. | Requires: CF5

Percentile

Function for calculating the percentile of a given number from a population of numbers. | Requires: CF5

Permutation

Returns the Permutation of n elements taken p at a time. | Requires: CF5

PointInPolygon

Determines if the given point is within the given n-sided polygon. | Requires: CF5

Polynomial

Evaluates the Polynomial in the form y = an * x^n + a(n-1) * x^(n-1) + ... + a1 * x + a0 for a given value of x. | Requires: CF5

ProperMod

Computes the mathematical function Mod(y,x). | Requires: CF5

Quadratic

Returns the two real roots of a polynomial in the form: ax^2 + bx + c = 0 | Requires: CF5

quartile

Returns the first, second, or third quartile value for a set of numeric values. | Requires: CF5

RadToDeg

Converts radians to degrees. | Requires: CF5

Range

Returns the range for a set of numbers. | Requires: CF5

rank

Ranks a number within a set. | Requires: CF5

RoundIt

RoundIt will round any number to a specific decimal point. | Requires: CF5

RoundSigFig

Rounds a number to a specified number of significant digits. | Requires: CF5

RoundUpDown

Rounds a number up or down to the nearest specified multiple. | Requires: CF5

scientificFormat

This function formats a big decimal to scientific notation. | Requires: CF6

Sec

Returns the secant of an angle. | Requires: CF5

Sech

Returns the hyperbolic secant of an angle. | Requires: CF5

Sinh

Returns the hyberbolic sine of an angle. | Requires: CF5

splitNumber

Splits a numeric value into integer and decimal parts | Requires: CF8

StdDevPop

Returns the standard deviation calculated using the divisor n method. | Requires: CF5

StdDevSamp

Returns the standard deviation calculated using the divisor n-1 method. | Requires: CF5

SurfaceAreaCone

Calculates the surface area of a cone. | Requires: CF5

SurfaceAreaCube

Calculates the surface area of a cube. | Requires: CF5

SurfaceAreaCylinder

Calculates the surface area of a cylinder. | Requires: CF5

SurfaceAreaRectangularPrism

Calculates the surface area of a rectangular prism. | Requires: CF5

SurfaceAreaSphere

Calculates the surface area of a sphere. | Requires: CF5

SurfaceAreaTorus

Calculates the surface area of a torus. | Requires: CF5

SymRound

Symmetrically rounds any number to a specific decimal point, preventing a common "rounding bias" from skewing results. | Requires: CF5

Tanh

Returns the hyberbolic tangent of an angle. | Requires: CF5

TrailingZeroes

Restores significant trailing zeroes which may have been omitted during calculations. | Requires: CF5

truncNumber

Cuts a number to a certain amount of decimal places without rounding. | Requires: CF5

TwosCompToDec

Decodes a 2's complement base 10 (decimal) value into an unencoded base 10 value. | Requires: CF5

VariancePop

Returns the population variance for a set of numeric values. | Requires: CF5

VarianceSamp

Returns the sample variance for a set of numeric values. | Requires: CF5

VolCone

Calculates the volume of a cone. | Requires: CF5

VolCube

Calculates the volume of a cube. | Requires: CF5

VolCylinder

Calculates the volume of a cylinder. | Requires: CF5

VolEllipsoid

Calculates the volume of an ellipsoid. | Requires: CF5

VolPyramid

Calculates the volume of a pyramid. | Requires: CF5

VolRectangularPrism

Calculates the volume of a rectangular prism. | Requires: CF5

VolSphere

Calculates the volume of a sphere. | Requires: CF5

VolTorus

Calculates the volume of a torus. | Requires: CF5

VolTriangularPrism

Calculates the volume of a triangular prism. | Requires: CF5

WeightWatchersPoints

Returns Weight Watchers Winning Points from calories, fat, and dietary fiber. | Requires: CF5

ZeroMinimum

Returns zero if the value passed into ZeroMinimum() is less than zero. | Requires: CF5

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