This site is developed to XHTML and CSS2 W3C standards.
If you see this paragraph, your browser does not support those standards and you
need to upgrade. Visit WaSP
for a variety of options.
Paste #78
Posted by: BitByByte
Posted on: 2025-11-28 19:10:06
Age: 20 days ago
Views: 16
format longG % вывод: 15 знаков после запятой
clear res;
res=0;
for num=1:10
a=fix(rand(3,1)*256); % вектор из шести байт
st=[0 1 2];
a_10=256.^st*a/10^8; % число-отображение вектора
m=1;
for n=5:1:10^8 % увеличиваем n
while (a_10>double(m/n))
m=m+1;
end
if (abs(a_10-m/n)<=0.5/10^9) % совпало!!1
break;
end
m=m-1;
if (abs(a_10-m/n)<=0.5/10^9) % совпало!!1
break;
end
end
% выведем наш результат:
l=length(res(:, 1))+1;
res(l,1)=a(1);
res(l,2)=a(2);
res(l,3)=a(3);
res(l,4)=a_10;
res(l,5)=m;
res(l,6)=n;
res(l,7)=m/n;
end
Download raw |
Create new paste