double
Double-precision arrays
Description
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; whosx
Name Size Bytes Class Attributes x 1x1 8 double
For more information on floating-point values, seeFloating-Point Numbers.
Creation
You can create a double-precision array using the[]
operator, such asA = [1 2 3; 4 5 6]
. In addition, many functions return double-precision arrays, such assin
.
If you have an array of a different type, such assingle
orint8
, then you can convert that array to double precison using thedouble
function.
Syntax
Y = double(X)
Input Arguments
Examples
Tips
When you are creating a class, overload
double
when it makes sense to convert an object of that class to a double-precision value.
Extended Capabilities
Introduced before R2006a
Was this topic helpful?