23.06.2015 Views

MATLAB Programming

MATLAB Programming

MATLAB Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Numeric Types<br />

Arithmetic Operations on Floating-Point Numbers<br />

This section describes which data types you can use in arithmetic operations<br />

with floating-point numbers.<br />

Double-Precision. You can perform basic arithmetic operations with double<br />

and any of the following other data types. When one or more operands is an<br />

integer (scalar or array), the double operand must be a scalar. The result is of<br />

type double, except where noted otherwise:<br />

• single — The result is of type single<br />

• double<br />

• int* or uint* — The result has the same data type as the integer operand<br />

• char<br />

• logical<br />

This example performs arithmetic on data of types char and double. The<br />

result is of type double:<br />

c = 'uppercase' - 32;<br />

class(c)<br />

ans =<br />

double<br />

char(c)<br />

ans =<br />

UPPERCASE<br />

Single-Precision. You can perform basic arithmetic operations with single<br />

and any of the following other data types. The result is always single:<br />

• single<br />

• double<br />

• char<br />

• logical<br />

2-17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!