MATLAB preemption precision

I need high precision for a project I'm working on. The problem I am having is illustrated here on subtraction:

>> 1-0.9999999999999999

ans = 1.1102e-16

>> 1-0.99999999999999999

ans = 0

      

I know this has to do with double precision. Is there anyway I can get better accuracy? I have checked the "vpa" function but I am unable to get a higher precision. Can anyone help me with this?

Thank you in advance!

+3


source to share


1 answer


Matlab internally uses the 64-bit double system for all of its numbers, which explains the precision issues. There are extensions to matlab that allow you to use arbitrary precision arithmetic. See this question for example .



0


source







All Articles