Double-precision arrays
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
as A = [1 2 3; 4 5 6]
. In addition, many functions return
double-precision arrays, such as sin
.
If you have an array of a different type, such as single
or
int8
, then you can convert that array to double precision using
the double
function.
Y = double(X)
When you are creating a class, overload double
when it
makes sense to convert an object of that class to a double-precision
value.
cast
| single
| str2double
| typecast