public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: pete@toyon.com To: gcc-gnats@gcc.gnu.org Cc: bkoz@gcc.gnu.org Subject: libstdc++/3181: Unable to use sqrt,cos,sin,... with int argument. Date: Wed, 13 Jun 2001 16:46:00 -0000 [thread overview] Message-ID: <20010613234142.8626.qmail@sourceware.cygnus.com> (raw) >Number: 3181 >Category: libstdc++ >Synopsis: Unable to use sqrt,cos,sin,... with int argument. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Jun 13 16:46:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Pete Stieber >Release: gcc version 3.1 20010611 (experimental) >Organization: >Environment: i686-pc-linux-gnu Red Hat 7.1 >Description: Error compiling std library math functions with in arguments. Automatic type conversion not working: test.cpp: In function `int main()': test.cpp:11: call of overloaded `sqrt(int&)' is ambiguous /usr/include/bits/mathcalls.h:146: candidates are: double sqrt(double) /usr/local/include/g++-v3/bits/std_cmath.h:461: long double std::sqrt(long double) /usr/local/include/g++-v3/bits/std_cmath.h:455: float std::sqrt(float) >How-To-Repeat: gcc test.cpp >Fix: I have to cast int/long/... instead of automatic conversion. >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="test.cpp" Content-Disposition: inline; filename="test.cpp" #include <iostream> #include <cmath> using namespace std; int main() { int i = -1; double Ans; // All of the functions have the problem, but we will use sqrt to illustrate. Ans = sqrt(i); cout << Ans << endl; // Ans = cos(i); // cout << Ans << endl; // Ans = sin(i); // cout << Ans << endl; // Ans = tan(i); // cout << Ans << endl; // Ans = acos(i); // cout << Ans << endl; // Ans = asin(i); // cout << Ans << endl; // Ans = atan(i); // cout << Ans << endl; return 1; }
next reply other threads:[~2001-06-13 16:46 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-06-13 16:46 pete [this message] 2001-06-13 19:43 bkoz 2001-06-20 9:26 Peter J. Stieber 2002-04-19 12:46 Phil Edwards 2002-11-06 9:16 Wolfgang Bangerth 2002-11-06 9:26 Wolfgang Bangerth 2002-11-06 9:35 bangerth 2002-11-06 9:36 Gabriel Dos Reis 2002-11-06 9:36 Wolfgang Bangerth 2002-11-06 10:06 Gabriel Dos Reis 2002-11-06 10:16 Gabriel Dos Reis 2002-11-06 10:29 bangerth 2002-11-06 14:46 Phil Edwards 2003-05-11 9:16 gdr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20010613234142.8626.qmail@sourceware.cygnus.com \ --to=pete@toyon.com \ --cc=bkoz@gcc.gnu.org \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).