public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2
@ 2024-02-27 10:21 www3.spl at gmail dot com
2024-02-27 10:24 ` [Bug libquadmath/114126] " pinskia at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: www3.spl at gmail dot com @ 2024-02-27 10:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114126
Bug ID: 114126
Summary: A not infinite result of tanq of M_PI_2
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libquadmath
Assignee: unassigned at gcc dot gnu.org
Reporter: www3.spl at gmail dot com
Target Milestone: ---
Hi there. I think that this 'bug' was not sent before.
I'm obtaining an incorrect result for tanq( M_PI_2q ):
tanq( M_PI_2q ) = +2.306323558737156172766198381637374e+34
when it should be infinite.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libquadmath/114126] A not infinite result of tanq of M_PI_2
2024-02-27 10:21 [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2 www3.spl at gmail dot com
@ 2024-02-27 10:24 ` pinskia at gcc dot gnu.org
2024-02-27 10:51 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-27 10:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114126
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide a full testcase? And also specify which target are you on?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libquadmath/114126] A not infinite result of tanq of M_PI_2
2024-02-27 10:21 [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2 www3.spl at gmail dot com
2024-02-27 10:24 ` [Bug libquadmath/114126] " pinskia at gcc dot gnu.org
@ 2024-02-27 10:51 ` jakub at gcc dot gnu.org
2024-02-27 11:01 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-27 10:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114126
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Why do you think this is a bug?
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
int
main ()
{
_Float128 f = tanf128 (M_PI_2f128);
volatile _Float128 g = M_PI_2f128;
g = tanf128 (g);
char buf[128];
strfromf128 (buf, 128, "%.34a", f);
printf ("%s\n", buf);
strfromf128 (buf, 128, "%.34a", g);
printf ("%s\n", buf);
}
also prints
0x1.1c46bd57277993a2ee60193c957b000000p+114
0x1.1c46bd57277993a2ee60193c957b000000p+114
M_PI_2q or M_PI_2f128 is
1.5707963267948966192313216916397513987...
while pi/2 with larger precision is I think
1.5707963267948966192313216916397514420...
so M_PI_2{q,f128} is rounded down, not up,
so no wonder tanq/tanf128 is not inf.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libquadmath/114126] A not infinite result of tanq of M_PI_2
2024-02-27 10:21 [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2 www3.spl at gmail dot com
2024-02-27 10:24 ` [Bug libquadmath/114126] " pinskia at gcc dot gnu.org
2024-02-27 10:51 ` jakub at gcc dot gnu.org
@ 2024-02-27 11:01 ` jakub at gcc dot gnu.org
2024-02-27 13:29 ` www3.spl at gmail dot com
2024-02-27 13:32 ` www3.spl at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-27 11:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114126
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Not to mention that if it would be rounded up (like it happens e.g. in the
M_PI_f32 case), you wouldn't get inf either, nor -inf, but some large negative
number.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libquadmath/114126] A not infinite result of tanq of M_PI_2
2024-02-27 10:21 [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2 www3.spl at gmail dot com
` (2 preceding siblings ...)
2024-02-27 11:01 ` jakub at gcc dot gnu.org
@ 2024-02-27 13:29 ` www3.spl at gmail dot com
2024-02-27 13:32 ` www3.spl at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: www3.spl at gmail dot com @ 2024-02-27 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114126
--- Comment #4 from Sergio Peña <www3.spl at gmail dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Why do you think this is a bug?
> #include <math.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> int
> main ()
> {
> _Float128 f = tanf128 (M_PI_2f128);
> volatile _Float128 g = M_PI_2f128;
> g = tanf128 (g);
> char buf[128];
> strfromf128 (buf, 128, "%.34a", f);
> printf ("%s\n", buf);
> strfromf128 (buf, 128, "%.34a", g);
> printf ("%s\n", buf);
> }
> also prints
> 0x1.1c46bd57277993a2ee60193c957b000000p+114
> 0x1.1c46bd57277993a2ee60193c957b000000p+114
>
> M_PI_2q or M_PI_2f128 is
> 1.5707963267948966192313216916397513987...
> while pi/2 with larger precision is I think
> 1.5707963267948966192313216916397514420...
> so M_PI_2{q,f128} is rounded down, not up,
> so no wonder tanq/tanf128 is not inf.
Ok. It is posible I was wrong.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libquadmath/114126] A not infinite result of tanq of M_PI_2
2024-02-27 10:21 [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2 www3.spl at gmail dot com
` (3 preceding siblings ...)
2024-02-27 13:29 ` www3.spl at gmail dot com
@ 2024-02-27 13:32 ` www3.spl at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: www3.spl at gmail dot com @ 2024-02-27 13:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114126
--- Comment #5 from Sergio Peña <www3.spl at gmail dot com> ---
(In reply to Jakub Jelinek from comment #2)
> Why do you think this is a bug?
> #include <math.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> int
> main ()
> {
> _Float128 f = tanf128 (M_PI_2f128);
> volatile _Float128 g = M_PI_2f128;
> g = tanf128 (g);
> char buf[128];
> strfromf128 (buf, 128, "%.34a", f);
> printf ("%s\n", buf);
> strfromf128 (buf, 128, "%.34a", g);
> printf ("%s\n", buf);
> }
> also prints
> 0x1.1c46bd57277993a2ee60193c957b000000p+114
> 0x1.1c46bd57277993a2ee60193c957b000000p+114
>
> M_PI_2q or M_PI_2f128 is
> 1.5707963267948966192313216916397513987...
> while pi/2 with larger precision is I think
> 1.5707963267948966192313216916397514420...
> so M_PI_2{q,f128} is rounded down, not up,
> so no wonder tanq/tanf128 is not inf.
Ok. It is posible I was wrong.
I have found this question:
https://stackoverflow.com/questions/54287492/why-didnt-i-get-tanpi-2-infinty-in-c
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-02-27 13:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 10:21 [Bug libquadmath/114126] New: A not infinite result of tanq of M_PI_2 www3.spl at gmail dot com
2024-02-27 10:24 ` [Bug libquadmath/114126] " pinskia at gcc dot gnu.org
2024-02-27 10:51 ` jakub at gcc dot gnu.org
2024-02-27 11:01 ` jakub at gcc dot gnu.org
2024-02-27 13:29 ` www3.spl at gmail dot com
2024-02-27 13:32 ` www3.spl at gmail 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).