fround

fround rounds the elements of a matrix. The number of significant digits can be specified.

rmRound = fround(rmMat)
rmRound = fround(rmMat, nPrec)
rmRound = fround(rmMat, nPrec, bSignificant)
rmRound = fround(rmMat, nPrec, bSignificant, ssOption)

Return Value

rmRound is a real matrix.

Parameters

rmMat

rmMat is a real matrix.

nPrec

nPrec is a number in the range -15 to 15. Default value is 2.

If bSignificant is FALSE (0) or not specified nPrec specifies the number of decimals. If nPrec is smaller than 0, nPrec sets the position left of the decimal point.

If bSignificant is TRUE (1) the absolute value of nPrec specifies the number of significant places.

bSignificant

bSignificant specifies the meaning of nPrec. The default value is FALSE (0).

TRUE nPrec specifies the number of significant places
FALSE nPrec specifies the number of decimals (default)
ssOption

ssOption specifies the rounding method, if the digit behind the significant digit is a 5 and all following digits are zeros. Default value is “even”.

“even” 1.5 => 2, 2.5 => 2, 3.5 => 4 (Banker’s Rounding)
“odd” 1.5 => 1
“up” 1.5 => 2
“down” 1.5 => 1
“rand” 1.5 => 1 oder 2 (random).

Example

* fround(7.045)
    7.0400
* fround(7.045, 2, FALSE, "even")
    7.0400
* fround(1997, 3, TRUE)
    2000.0000
* fround(0.12345, 4, TRUE, "up")
    0.1235
* fround(0.12345, 3, TRUE, "up")
    0.1230
* fround(0.12345, 4, TRUE, "up")
    0.1235
* fround(0.12345, 4, TRUE, "even")
    0.1234
* fround(0.12355, 4, TRUE, "even")
    0.1236
* fround(0.12355, 4, TRUE, "down")
    0.1235
* fround(0.12305, 4, TRUE, "down")
    0.1230
* fround(0.12355, 4, TRUE, "down")
    0.1235

History

Version Description
5.11.0 New.

id-2044751