By default, MATLAB® stores all numeric variables as double-precision floating-point values
that are 8 bytes (64 bits). These variables have data type (class)
double. For example:
x = 10; whos x
Name Size Bytes Class Attributes x 1x1 8 double
For more information on floating-point values, see Floating-Point Numbers.
You can create a double-precision array using the
 operator, such
A = [1 2 3; 4 5 6]. In addition, many functions return
double-precision arrays, such as
If you have an array of a different type, such as
int8, then you can convert that array to double precison using
Y = double(X)
X— Input array
Input array, specified as a scalar, vector, matrix, or multidimensional array.
By default, numbers in MATLAB are of the data type
double. You can use the
class function to verify a variable's type.
x = 100; xtype = class(x)
xtype = 'double'
double function to convert variables that are not double precision to type
y = true
y = logical 1
ydouble = double(y); ynewtype = class(ydouble)
ynewtype = 'double'
When you are creating a class, overload
double when it
makes sense to convert an object of that class to a double-precision
This function fully supports tall arrays. For more information, see Tall Arrays.