matlab - Set mantissa length and cut off digits -


i want matlab behave floating point unit (let's say) 5 digits, meaning mantissa set 5 digits. therefore want write function converts number desired format, can apply after every arithmetical operation.

what should normalizing number zero-point-something-times-ten-power-something, cutting off left on digits , not rounding them.

important number not shown way, stored limited significant digits.

examples:

d = 5; % 5 significant digits, meaning 5 digits mantissa 0.12345 = foo(0.123456, d) 0.12345e-1 = foo(0.0123456, d) 0.12345e+3 = foo(123.456789, d) 

how 1 that? there built-in matlab functionality allows it?


Comments