Function overview
Prototype
NthRoot (
num; n )
Parameters
num The number you want to take the root of
n The root you're after.
Description
I'm sorry for this function, I really am but it's lack of existence seems moronic especially with the existence of the sqrt function. Plus it's not necessarily all that obvious to some people.
Examples
Sample input
NthRoot(27;3)
Sample output
3
Function code
num^(1/n)
// ===================================
/*
This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports
please visit http://www.fmfunctions.com/fid/215
Prototype: NthRoot( num; n )
Function Author: Genx (http://www.fmfunctions.com/mid/29)
Last updated: 13 April 2009
Version: 1
*/
// ===================================
num^(1/n)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/215__LITBR____LITBR__ Prototype: NthRoot( num; n )__LITBR__ Function Author: Genx (http://www.fmfunctions.com/mid/29)__LITBR__ Last updated: 13 April 2009__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.
Comments
15 April 2009
what if n is negative ?
what if num is negative ?
15 April 2009
Unless my algebra knowledge is way off [and it could be :p], it doesn't matter if n is negative or not. As for the negative number... FileMaker will automatically return a "?" whenever you try to take the fractional exponent of a negative number because it can't calculate it which would be the expected result in any case....
BUT, we could correct for this because technically, provided that number is an odd whole number simply taking the relevant root of the absolute value of that number and making it a negative would technically give you a correct number, but people don't generally correct for that do they?
(Edited by Genx on 15/04/09 )
18 April 2009
10 ^ 3 = 1000 ; NthRoot( 1000 ; 3 ) = 10 ( correct )
10 ^ - 3 = .001 ; NthRoot( .001 ; - 3 ) = 10 ( correct )
- 10 ^ 3 = - 1000 ; NthRoot( - 1000 ; 3 ) = ?
- 10 ^ - 3 = - .001 ; NthRoot( - .001 ; - 3 ) = ?
19 April 2009
Do we just ignore in that case?
(Edited by Genx on 19/04/09 )