This content has been marked as final.
Show 2 replies

1. Re: "NAN" output of sprintf
userc_40547 Oct 30, 2015 7:12 AM (in response to userc_40547)Fixed the problem, it was neither to way I labeled the variables nor the sqrt(). And also not the size of my values.
Somehow the program can not multiple the values. The fault was by multiplying real_comb*real_comb.By changing this code to magnitude=pow(real_comb,2) it worked. I think calculating the power of 2 or just multiplying with the same value should be same mathematical operation.
But nevertheless it is working, so never mind. ;)

2. Re: "NAN" output of sprintf
BoTa_264741 Oct 30, 2015 9:59 AM (in response to userc_40547)Pay attention that calculating pow(n,2) takes ~5000 CPU ticks, while n*n is only about 100 ticks. Check output precision, you may be getting 'long' instead of 'long long' and that's why sprintf() was able to handle it.