Demo entry 6361869

1

   

Submitted by anonymous on May 05, 2017 at 15:45
Language: Matlab. Code size: 358 Bytes.

s=0;
s1=s;
s2=s;
sum1=single(s);
sum2=single(s);
for i= 1:10000
    j1=single(1/i^4);
     s1=s1+(1/i^4);%双精度顺向相加
   sum1=sum1+j1;%单精度顺向相加
end
for i= 10000:-1:1
    j2=single(1/i^4);
    s2=s2+(1/i^4);%双精度逆向相加
   sum2=sum2+j2;%单精度逆向相加

end
sum1
sum2
s1
s2

sum1 =1.0823221
sum2 =1.0823232
s1 =1.082323233710861
s2 =1.082323233710805

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).