RoundSigFigs
Function |
RoundSigFigs(value)
RoundSigFigs(value, figures)
|
Use
The RoundSigFigs() function returns a number rounded to have the number signigicant figures specified. It will round the number up or down appropriately.
The number result given by RoundSigFigs() is a new number stored at that value, as opposed to rounding with value formatting, which only changes how a number is displayed.
RoundSigFigs() treats rounding up as rounding away from 0.
For example, RoundSigFigs(-7.9, 1) = -8
and
RoundSigFigs(-7.2, 1) = -7
.
Units
Numbers with units will be rounded based on those units. This means that the unit a number has at the point of calculation will affect the answer.
For example, RoundSigFigs(5.8ft, 1)
and
RoundSigFigs(5.8 ft to mm, 1)
will return values that are not equal.
Examples
RoundSigFigs(23847, 1) = 20000
RoundSigFigs(23847, 3) = 23800
RoundSigFigs(.0002384, 2) = 0.00024
RoundSigFigs(.0002384, 3) = 0.000238
RoundSigFigs(1.8, 1) = 2
RoundSigFigs(1.2, 1) = 1
RoundSigFigs(-1.8, 1) = -2
RoundSigFigs(12.8888, 3) = 12.9
RoundSigFigs(12.8888, 5) = 12.889
RoundSigFigs(45183.1, 3) = 45200
RoundSigFigs(3.2 ft, 1) = 3ft
RoundSigFigs(3.2 ft to cm, 1) = 98cm
RoundSigFigs(3.2 ft to cm, 1) to ft = 3.215 ft
Related functions
RoundSigFigs is included by default in each file as part of the Math library.
See also: