Matlab will often display numbers with a given number of decimals based on "formatting" options as opposed to their actual value.

**Note**: While I will differentiate between integers
and doubles, Matlab will treat most numbers (unless it
is explicitly told otherwise) as doubles.

This is because, from a scientific viewpoint, doubles are the most accurate representation the computer can (typically) use. We will talk about the limits of precision on a computer at another time.

Matlab usually only prints a very small number of the digits after the decimal place... This is because to us,

` ````
5.123123123548238
```

is the same as:

` ````
5.123
```

You can change this behavior by using the "format" command

` ````
>> format long
>> a
a =
5.12312312354824
>> format short
>> a
a =
5.1231
```

Back to Topics List