public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/15388] New: Erroneous output from floating point tan
@ 2013-04-23  2:59 simplyrahul17 at gmail dot com
  2013-04-23  7:00 ` [Bug math/15388] " aj at suse dot de
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: simplyrahul17 at gmail dot com @ 2013-04-23  2:59 UTC (permalink / raw)
  To: glibc-bugs

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<cmath>
#include<stdio.h>
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/15388] Erroneous output from floating point tan
  2013-04-23  2:59 [Bug math/15388] New: Erroneous output from floating point tan simplyrahul17 at gmail dot com
@ 2013-04-23  7:00 ` aj at suse dot de
  2013-04-23  9:38 ` siddhesh at redhat dot com
  2014-06-13 18:19 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: aj at suse dot de @ 2013-04-23  7:00 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15388

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |aj at suse dot de

--- Comment #1 from Andreas Jaeger <aj at suse dot de> 2013-04-23 07:00:56 UTC ---
Compiling and running the program, I get:
./a.out 
97800744.0000000000000000

Which glibc version and which architecture is your program running on?

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/15388] Erroneous output from floating point tan
  2013-04-23  2:59 [Bug math/15388] New: Erroneous output from floating point tan simplyrahul17 at gmail dot com
  2013-04-23  7:00 ` [Bug math/15388] " aj at suse dot de
@ 2013-04-23  9:38 ` siddhesh at redhat dot com
  2014-06-13 18:19 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-23  9:38 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15388

Siddhesh Poyarekar <siddhesh at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |siddhesh at redhat dot com
         Resolution|                            |DUPLICATE

--- Comment #2 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-23 09:38:19 UTC ---
This was fixed in 2.17 with the following commit:

commit 7a845b2c237434d4aad790aaba3a973e24ea802f
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Tue Jul 3 17:10:42 2012 +0000

    Fix float range reduction problems (bug 14283).

*** This bug has been marked as a duplicate of bug 14283 ***

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug math/15388] Erroneous output from floating point tan
  2013-04-23  2:59 [Bug math/15388] New: Erroneous output from floating point tan simplyrahul17 at gmail dot com
  2013-04-23  7:00 ` [Bug math/15388] " aj at suse dot de
  2013-04-23  9:38 ` siddhesh at redhat dot com
@ 2014-06-13 18:19 ` fweimer at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:19 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15388

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-13 18:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23  2:59 [Bug math/15388] New: Erroneous output from floating point tan simplyrahul17 at gmail dot com
2013-04-23  7:00 ` [Bug math/15388] " aj at suse dot de
2013-04-23  9:38 ` siddhesh at redhat dot com
2014-06-13 18:19 ` fweimer at redhat dot com

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).