フィルターのクリア

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

1 回表示 (過去 30 日間)
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

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 2 月 9 日
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

カテゴリ

Help Center および File ExchangeNumbers and Precision についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by