How can increase the precision in matlab to 24 bits after the decimal point?

5 views (last 30 days)
Hi, I want to write a code to produce the 24 bits after the decimal point, but I can't found any instruction in matlab for it. Please help me.
Thanks

Answers (2)

Vahid
Vahid on 6 Apr 2012
Dear Walter I think I can use vpa to use the 24 bits after the decimal point. same as this number: 1.4016050745784331201804207012174
Thank you,
Vahid
  3 Comments
Vahid
Vahid on 7 Apr 2012
Dear Walter
You are right.I want to show a number with 24 bits and then separate 16 bits from these 24 bits.For example this number:0.4999
I thought the vpa can help me to achieve this goal.
Could you help me?
Thanks
Walter Roberson
Walter Roberson on 7 Apr 2012
vpa() works with decimal, not with binary, so NO, vpa cannot be used for your purposes. Perhaps the Fixed Point Toolbox would be appropriate for you.
I am getting a definite impression that we have a terminology difference. A "bit" is, by definition, a Binary digIT, each a single position that can represent only the two values 0 or 1. VPA works with decimal places, which has to do with decimal digits, each a single position that can represent any of the 10 values, 0 1 2 3 4 5 6 7 8 9 .
Slightly more than 3 bits (binary digits) are required to represent each decimal digit. 16 bits of fraction would be able to represent 1 part in 65536, which would get down to about 1.5E-5

Sign in to comment.


Walter Roberson
Walter Roberson on 6 Apr 2012
You need to use a software fixed-point system to work with any particular number of bits after the decimal point.
Please note that "bits" refers to numeric representation in base 2, but "decimal point" refers to numeric representation in base 10. Do you perhaps need a particular number of decimal digits after the decimal point? For example it would seem strange to work with values in the range of 10^200 and then expect 24 bits after those 200 decimal digits.
You might be able to use the Fixed Point Toolbox for your purpose, but note that not all routines support the Fixed Point Toolbox.
MATLAB uses IEEE 754 Double Precision, which has 53 bits of precision total, but that is floating point.
Possibly though all you need at this time is to look at the command
format long g

Community Treasure Hunt

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

Start Hunting!