Demo entry 6361882

数值计算方法

   

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

x1=100000;
y1=single(x1^2-1);
w1=single(y1^(1/2));
z1=single(log(x1-w1));%z1作为第一个公式的单精度输出结果

x2=100000;
y2=single(x2^2-1);
w2=single(y2^(1/2));
z2=single(-log(x2+w2));%z2作为第一个公式的单精度输出结果


x3=100000;
y3=double(x3^2-1);
w3=double(y3^(1/2));
z3=double(log(x3-w3));%z3作为第一个公式的单精度输出结果

x4=100000;
y4=double(x4^2-1);
w4=double(y4^(1/2));
z4=double(-log(x4+w4));%z4作为第一个公式的单精度输出结果

%输出结果
z1 = -Inf

z2 =-12.2060728

z3 =-12.206073762186564

z4 =-12.206072645505174

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).