How can I define that the data in a vector is all long float?
Tks ;)

답변 (1개)

Star Strider
Star Strider 2019년 6월 6일

1 개 추천

It will automatically be double-precision floating-point (double) unless you specify a different data type (such as single, int8, or other options). It also maintains full internal precision regardless of the format option you use to display it.

댓글 수: 3

Samuel Siqueira
Samuel Siqueira 2019년 6월 6일
Yes I understand. You can not do this? Can you give me an example?
All numeric data is by default IEEE 754 double-precision (8-byte) floating-point (that I assume is what you intend by ‘long float’) unless to specify otherwise.
As for an example:
format long
x = pi
whos('x')
produces:
x =
3.141592653589793
Name Size Bytes Class Attributes
x 1x1 8 double
and similarly:
format short
x
whos('x')
produces:
x =
3.1416
Name Size Bytes Class Attributes
x 1x1 8 double
The format call simply affects how the numbers are written to the Command Window. It has no effect on the internal precision, that is the same regardless of your format option.
Stephen23
Stephen23 2019년 6월 6일
Samuel Siqueira's "Answer" moved here:
Now I understand! Many thanks, really!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2016b

질문:

2019년 6월 6일

댓글:

2019년 6월 6일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by