Borrar filtros
Borrar filtros

incresing the precision of epsilon to 30 digits by symbolic toolbox, i could encounter not enough input arguments error?

1 visualización (últimos 30 días)
function unidec=quad(a,b,r,eps)
a=input('enter a');
b=input('enter b');
r=sym(eps);
digits(30);
vpa(r);
if abs(a-b)< r
unidec=' a & b are equal';
else
unidec='a & b are not equal in double & single precision 3rd loop';
end

Respuestas (1)

Walter Roberson
Walter Roberson el 9 de Feb. de 2018
digits(30) does not increase the precision of the function eps(). The function eps() is a purely numeric function that only operates on single and double.
Your code is inputting a and b as numeric (double precision) . Changing digits() does not affect the result of a double minus a double.
For your code to make any sense, you would need to use
if abs(vpa(a) - vpa(b)) < r

Categorías

Más información sobre Numbers and Precision en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by