[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

pl.comp.programming

[ASM+FPU] Skad wartosc NaN?

Damian Sobota

4/2/2007 10:26:00 PM

Cze?a.

Pisze program na pracownie. Mam napisaa m.in. funkcje, która konwertuje liczbe
zespolon? w postaci z=a+bi do postaci z=|z|(cos(arg(z))+isin(arg(z))). Oto kod
w C:

extern void c_alg2try(complex a, double *cosarg, double *sinarg, double *r);

int main(int argc, char *argv[])
{
double cosarg=0, sinarg=0, r=0;
complex a={1.3, 2.6};
c_alg2try(a, &cosarg, &sinarg, &r);
printf("a=%f(%f+i%f)\n", r, cosarg, sinarg);
return 0;
}


A oto kod funkcji w assemblerze:

c_alg2try:
fld qword [esp+4] ; laduj a.re
fmul st0, st0
fld qword [esp+12] ; laduj a.im
fmul st0, st0
faddp st1, st0
fsqrt ; w st0 mamy |z|

fld qword [esp+4]
fdiv st0, st1 ; w st0 mamy cosargz

fld qword [esp+12]
fdiv st0, st2 ; w st0 mamy sinargz

mov eax, [esp+24]
fstp qword [eax]
mov eax, [esp+20]
fstp qword [eax]
mov eax, [esp+28]
fstp qword [eax]

xor eax, eax
ret


Niestety powy?sze nie dzia3a... Oto co mi wypisuje program:

a=2.906888(0.447214+inan)

Sk?d to nan? Nie mam pomys3u kompletnie, jak poprawia program (próbowa3em
ró?ne rzeczy, ci?gle dostaje podobne wyniki).

Kompiluje za pomoc? NASM+GCC. System to Ubuntu 6.06. U kolegi pod Windows XP
dzia3a3o wszystko bez zarzutu. Ma kto? jaki? pomys3?


Pozdrawiam,
Damian Sobota.

--
Wys3ano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta....
2 Answers

Damian Sobota

4/2/2007 10:54:00 PM

0

Damian Sobota <damsob.WYTNIJ@gazeta.pl> napisa3(a):
> [ciecie]

Kod jest dobry, problem byl gdzie indziej.

Pozdrawiam,
DS.

--
Wys3ano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta....

Winston Smith, American Patriot

7/1/2010 5:53:00 AM

0

"D. Stussy" <spam+newsgroups@bde-arc.ampr.org> wrote in
talk.politics.misc:

> "SOCIALISM SUCKS" <progressive_libertarian@yahoo.com> wrote in message
> news:e7efd786-89ad-4711-b9e6-a183c236acba@l25g2000prn.googlegroups.com.
> ..
>> If both sides of the aisle decide after all the mudslinging and silly
>> nonsense, that unemployment is going to be extended yet again, then
>> let's change the benefit structure completely - so that unemployment
>> payments SHRINK over time from 100% the first month straight line -
>> down to zero year 3.
>>
>> At which point they're gone.
>>
>> THAT is the way to find the balance, between help, and enabling.
>>
>> Someone getting 100% initially, will be helped when they need it
>> most.
>>
>> Next week - their check is a bit smaller. Noticing that, our
>> protagonist will consider what that means - and think to himself or
>> herself; maybe I should look a bit harder for that next job. This
>> unemployment gig clearly isn't an end in itself.
>>
>> Next week - a bit smaller still. Still 99% of the original, enough
>> surely, for printing resumes, and maybe a haircut. To look for a ...
>> new job. But each week, that check shrinks just a bit, until after 3
>> years - it's gone. Zip. No more handouts - go find another job.
>>
>> 2 years is plenty long enough to find a job. By 2 years it's not
>> assistance with unemployment. It's welfare.
>>
>> Expecting people to pull their own weight, is not heartless.
>>
>> It is the American way.
>
> They're lucky to get 99 weeks. When I was last unemployed, the limit
> was 26 weeks (6 months) - of which I only needed 2 weeks worth.

I am sure that even you would learn that it is no longer easy to get that
job for which you barely qualify---super-sizing fries---within two weeks.
Bush's Great Recession has been that disastrous, as was predicted in posts
to the Usenet well before it happened.

> 3 years, even with diminishing payments, is way too long.

99 weeks is three years to you??

That explains a lot about you now.





--
Estimate the worth of a man by how sincerely he greets you.
Arrive at the worth of a man by how he opens himself to you.
Know the worth of a man by how conscientiously he listens to you.
Verify the worth of a man by how warmly he takes his leave of you.

http://mavigozler.awards...