FT_GCD() Calculate greatest common divisor of two numbers FT_NETPV() Calculate net present value FT_RAND1() Generate a random number FT_ROUND() Rounds a number to a specific place

** **

FT_ROUND()Rounds a number to a specific placeSyntaxFT_ROUND( <nNumber> [, <nRoundToAmount> ; [, <cRoundType> [, <cRoundDirection> ; [, <nAcceptableError> ] ] ] ] ) -> nNumberArguments<nNumber>is the number to round<nRoundToAmount>is the fraction to round to or the number of places, default is 2.<cRoundType>is the type of rounding desired "D" for Decimal (3 for thousandth, 1/1000) (default) "F" for Fraction (3 for thirds, 1/3) "W" for Whole numbers (3 for thousand, 1000)<cRoundDirection>is the direction to round the number toward "U" to round Up 1.31 ->1.4-1.31 ->-1.4"D" to round Down 1.36 ->1.3-1.36 ->-1.3"N" to round Normal 1.5 ->2-1.5 ->-21.49 ->1-1.49 ->-1<nAcceptableError>is the amount that is considered acceptable to be within, i.e., if you're within this amount of the number you don't need to roundReturnsThe number, rounded as specified.DescriptionThis function will allow you to round a number. The following can be specified: a. Direction (up, down or normal - normal is 4/5 convention) b. Type (whole, decimal, fraction) c. Amount (100's, 5 decimals, 16th, etc.)Examples// round normal to 2 decimal places nDollars := FT_ROUND(nDollars) // round normal to 6 decimal places nIntRate := FT_ROUND(nIntRate, 6) // round to nearest thousands nPrice := FT_ROUND(nPrice, 3, NEAREST_WHOLE_NUMBER) // round Up to nearest third nAmount := FT_ROUND(nAmount, 3, NEAREST_FRACTION, ROUND_UP) // round down to 3 decimals Within .005 nAvg := FT_ROUND(nAvg, 3, , ROUND_DOWN, .005)Source:ROUND.PRGAuthor:David Husnian

FT_RAND1()Generate a random numberSyntaxFT_RAND1( <nMax> ) -> nRandArguments<nMax>Maximum limit of value to be produced.ReturnsnRand is a random number between 0 (inclusive) and<nMax>(exclusive).DescriptionGenerates a non-integer random number based on the Linear Congruential Method. If you need a random number between 1 and <nMax> inclusive, INT() the result and add 1. If you need a random number between 0 and <nMax> inclusive, then you should ROUND() the result.ExamplesnResult := INT( FT_RAND1(100) ) + 1 // 1 <= nResult <= 100 nResult := ROUND( FT_RAND1(100), 0 ) // 0 <= nResult <= 100 nResult := FT_RAND1( 1 ) // 0 <= nResult < 1Source:RAND1.PRGAuthor:Gary Baren

** **

FT_NETPV()Calculate net present valueSyntaxFT_NETPV( <nInitialInvestment>, <nInterestRate>, <aCashFlow> ; [, <nNoOfCashFlows> ] ) -> nNetPVArguments<nInitialInvestment>is the amount of cash invested for purposes of generating the cash flows.<nInterestRate>is the annual interest rate used to discount expected cash flows (10.5% = 10.5, not .105).<aCashFlow>is an array of the expected cash receipts each year.<nNoOfCashFlows>is the number of years cash flows are expected (optional, Len( aCashFlow ) ).ReturnsThe difference between the initial investment and the discounted cash flow in dollars.DescriptionThis function calculates the net present value, the difference between the cost of an initial investment and the present value of the expected cash flow(s) from the investment. The present value of the expected cashflow(s) is calculated at the specified interest rate, which is often referred to as the "cost of capital". This function can be used to evaluate alternative investments. The larger the NPV, the more profitable the investment. See also the FutureValue and PresentValue for further explanations. The formula to calculate the net present value is: NetPresentValue = SUM(CashFlow[i] / ((1 + InterestRate) ** i)) FOR i = 1 TO NoOfCashFlowsExamplesnNetPresentValue := FT_NETPV(10000, 10, { 10000,15000,16000,17000 } )Source:NETPV.PRGAuthor:David Husnian

** **

FT_GCD()Calculate greatest common divisor of two numbersSyntaxFT_GCD( <nNumber1>, <nNumber2> ) -> nGCDArguments<nNumber1>is the first number to find the GCD of.<nNumber2>is the second number to find the GCD of.ReturnsThe greatest common divisor of the 2 numbers, or 0 if either is 0.DescriptionThis function calculates the greatest common divisor between 2 numbers, i.e., the largest number that will divide into both numbers evenly. It will return zero (0) if either number is zero.Examples? FT_GCD(10,15) // Result: 5 ? FT_GCD(108,54) // Result: 54 ? FT_GCD(102,54) // Result: 6 ? FT_GCD(111,17) // Result: 1Source:GCD.PRGAuthor:David Husnian

** **