RoundToSigFigs ( number ; sigfigs )
Rounds a number to the specified number of significant figures.
Average rating: 4.7 (31 votes) Log in to vote
Ryan Brandys - Show more from this author
1234 ; 2
1234 ; 3
0.0009876 ; 1
0.0009876 ; 2
0.0009876 ; 3
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Rounds a number to the specified number of significant figures. Uses a log base ten to gauge the order of magnitude for "number" and uses that to figure out which decimal place is the rounding point. Then it uses filemaker's built in rounding function to round to that point. For > .5, this function rounds up.
|Henry Olders, Montreal
Dec 1, 2015
|because the log function only works with positive numbers, use
Round ( number ; sigfigs - 1 - Floor ( Log ( Abs ( number ) ) ) )
|Scott Merry, EnerG2 Technologies, Inc. - a brand of BASF
Jun 19, 2019
|Henry and Ryan,
This is great! However in cases like input number of 0.500000 and you specify 3 sigfigs, the result is 0.5, not 0.500 as is correct.
Have either of you modified the function so that the result would actually be 0.500?
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.