matlab - rounding to n significant digits -
matlab - rounding to n significant digits -
i'm trying write code in matlab round number (as ask) important digits.
i'm not sure how it. suggestions?
to round d
significant digits:
>> d = 3; %// number of digits >> x = 5.237234; %// illustration number >> d = 10^(d-ceil(log10(x))); >> y = round(x*d)/d y = 5.2400
to round d
decimal digits:
>> d = 3; %// number of digits >> x = 5.237234; %// illustration number >> d = 10^d; >> y = round(x*d)/d y = 5.2370
matlab floating-point digits significant-digits
Comments
Post a Comment