Demo entry 6361864

数值计算方法

   

Submitted by suzui961228 on May 05, 2017 at 15:41
Language: Matlab. Code size: 376 Bytes.

sum=0;
sum1=single(sum);
for i=1:10000
    item=single(1/i^4);
    sum1=sum1+item;
end
sum=0;
sum2=single(sum);
for i=10000:-1:1
    item=single(1/i^4);
    sum2=sum2+item;
end
sum=0;
sum3=double(sum);
for i=1:10000
    item=double(1/i^4);
    sum3=sum3+item;
end
sum=0;
sum4=double(sum);
for i=10000:-1:1
    item=double(1/i^4);
    sum4=sum4+item;
end

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).