Re: sinf compiler error I don't understand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 April 2011 23:29, les <hlhowell@xxxxxxxxxxx> wrote:
> First let me say, that while I have used C++ I don't normally use it for
> my work and so am not throughly familiar with what it does, so if this
> is due to a C++ error, please be gentle.
>
> I am working on some DSP code I developed a long time ago, and now want
> to port it to 64 bit. ÂI have read several articles on the differences
> in C and C++ between 32 and 64 bit, but this has me stymied.
>
> Here is the smallest sample I have been working with to show the current
> error:
>
> #include <math.h>
> #include <stdlib.h>
> #include <stdio.h>
> #include <string.h>
>
> main()
> {
> Â Âlong double temp;
> Â Âprintf ("M_PI=%e\n",M_PI);
> Â Âprintf ("sin 90 = %e\n",sinf(M_PI/2));
> Â Âtemp=M_PI/2.0;
> // the following line won't compile for temp
> // regardless of how temp is declared (float, double, long double)
> // Â printf ("sin 90 = %e\n",sinf(temp));
> }
>
>
> Clearly sinf is recognized, and compiles and runs. ÂIt returns 1.000 as
> expected for M_PI/2. ÂBut the line that is commented out will not
> compile.
>
> If you can see the issue here, please let me know.
>

> yum info GCC shows:
> Name    Â: gcc
> Arch    Â: x86_64
> Version   : 4.5.1
> Release   : 4.fc14
>

F13 here:
Name        : gcc
Arch        : x86_64
Version     : 4.4.5
Release     : 2.fc13

How are you compiling it? If I uncomment the last printf then compile like:
$ g++ test.cc -Wall -o test

I get:
test.cc:6: warning: ISO C++ forbids declaration of âmainâ with no type

But otherwise compiles and runs as expected. I'd point out that sinf
is float precision, sin is double and sinl long double. With c++ I
might expect type issues (as you did in your comment), but struggling
to see anything wrong with this. Any particular error when it fails to
compile?

-- 
imalone
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux