double data type error
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jaykishan Solanki
am 9 Jul. 2024
Kommentiert: Jaykishan Solanki
am 9 Jul. 2024
I am using double as data type for my code yet I am only getting values upto four decimal places, I am not sure whether this is correct or not.
0 Kommentare
Akzeptierte Antwort
surya venu
am 9 Jul. 2024
Hi,
In MATLAB, the "double" data type provides floating-point numbers with double precision, which means it can represent numbers with a high degree of accuracy. However, the display format in the MATLAB Command Window might be limiting the number of decimal places you see.
To check if the values are actually stored with higher precision, you can change the display format. MATLAB's default display format is "short", which shows up to four decimal places. You can change this to "long", which shows up to 15 decimal places for "double" precision numbers.
Here is an example MATLAB code:
format long
a = 1.123456789012345;
disp(a)
For more information check out:
Hope it helps.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!