# 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 Branmuffin Industries http://www.branmuffinindustries.com |

Sample input:

1234 ; 1

1234 ; 2

1234 ; 3

0.0009876 ; 1

0.0009876 ; 2

0.0009876 ; 3

1234 ; 2

1234 ; 3

0.0009876 ; 1

0.0009876 ; 2

0.0009876 ; 3

Sample output:

1000

1200

1230

0.001

0.00099

0.000988

1200

1230

0.001

0.00099

0.000988

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.

## Comments

Henry Olders, Montreal Dec 1, 2015 |
||

because the log function only works with positive numbers, use Round ( number ; sigfigs - 1 - Floor ( Log ( Abs ( number ) ) ) ) |
||

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.