From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31792 invoked by alias); 23 Apr 2013 02:59:50 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 31762 invoked by uid 48); 23 Apr 2013 02:59:46 -0000 From: "simplyrahul17 at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug math/15388] New: Erroneous output from floating point tan Date: Tue, 23 Apr 2013 02:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simplyrahul17 at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-04/txt/msg00134.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=15388 Bug #: 15388 Summary: Erroneous output from floating point tan Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: math AssignedTo: unassigned@sourceware.org ReportedBy: simplyrahul17@gmail.com Classification: Unclassified On executing the following code (compiled with g++ 4.6.3 on Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz running Ubuntu 12.04.1 LTS): #include #include using namespace std; int main() { float f = 4386557896710122704971697171202048.0; printf("%.16f\n", tan(f)); return 0; } I get the output as 33554432.0 The expected output is 97800744.0 In hex, this means libm says tan(0x77584625) = 0x4C000000 However, the output should be 0x4CBA8A45. The "correct" output was obtained using WolframAlpha (97800745.2669871207241704332677514328806018068212018723832) and one other compiler does produce the right output (in hex 0x4CBA8A45, in decimal 97800744.0) for the same program. I know that the input is a bit strange, but looking at the hex it seems to be a valid representable floating point number. Using double instead of float makes the problem go away. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.