public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107370] New: long double precision is wrong in ARM 64
@ 2022-10-24 6:11 jacob at jacob dot remcomp.fr
2022-10-24 6:22 ` [Bug c/107370] " jacob at jacob dot remcomp.fr
` (25 more replies)
0 siblings, 26 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 6:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
Bug ID: 107370
Summary: long double precision is wrong in ARM 64
Product: gcc
Version: 10.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jacob at jacob dot remcomp.fr
Target Milestone: ---
This program
#include <stdio.h>
#include <math.h>
int main(void) { printf("%.20Lg \n",sqrtl(2.0L)); }
produces the output:
1.4142135623730951455
The four last digits are WRONG. Correct output is:
1.414213562373095048801688724209698
The long double precision is identical to double precision. It should be approx
30 digits but it is only 16.
gcc -v
MACHINE ARM 64 (raspberry pi)
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/10/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-6'
--with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-libquadmath --disable-libquadmath-support --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release
--build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
uname -a
Linux raspi 5.15.61-v8+ #1579 SMP PREEMPT Fri Aug 26 11:16:44 BST 2022 aarch64
GNU/Linux
Thanks in advance for your attention.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug c/107370] long double precision is wrong in ARM 64
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
@ 2022-10-24 6:22 ` jacob at jacob dot remcomp.fr
2022-10-24 15:19 ` [Bug target/107370] " pinskia at gcc dot gnu.org
` (24 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 6:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #1 from jacob navia <jacob at jacob dot remcomp.fr> ---
This program produces correct results:
#include <stdio.h>
#include <math.h>
long double nsqrt(long double x)
{
double m = sqrt(x);
long double r = m;
r = (r+x/r)/2.0L;
r = (r+x/r)/2.0L;
r = (r+x/r)/2.0L;
r = (r+x/r)/2.0L;
r = (r+x/r)/2.0L;
return r;
}
int main(void) { printf("%.30Lg \n",nsqrt(2.0L)); }
produces:
1.41421356237309504880168872421
All digits que OK.
jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug target/107370] long double precision is wrong in ARM 64
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
2022-10-24 6:22 ` [Bug c/107370] " jacob at jacob dot remcomp.fr
@ 2022-10-24 15:19 ` pinskia at gcc dot gnu.org
2022-10-24 18:33 ` jacob at jacob dot remcomp.fr
` (23 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 15:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I get the following output from ubuntu 1804's gcc and the trunk of gcc from
20220808:
ubuntu@ubuntu:~/src/upstream-gcc\# ~/upstream-gcc/bin/gcc t54.c -O2
ubuntu@ubuntu:~/src/upstream-gcc\# ./a.out
1.4142135623730950488
trunk gcc:
.LC1:
.word 325511829
.word -922176773
.word -429395012
.word 1073703433
ubuntu gcc:
.LC0:
.word 325511829
.word 3372790523
.word 3865572284
.word 1073703433
Both of these are the same, just unsigned vs signed output.
As far as I can tell, this is not a GCC issue. It might be a binutils issue or
a glibc issue with printf.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug target/107370] long double precision is wrong in ARM 64
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
2022-10-24 6:22 ` [Bug c/107370] " jacob at jacob dot remcomp.fr
2022-10-24 15:19 ` [Bug target/107370] " pinskia at gcc dot gnu.org
@ 2022-10-24 18:33 ` jacob at jacob dot remcomp.fr
2022-10-24 18:40 ` [Bug middle-end/107370] long double sqrtl constant folding is wrong pinskia at gcc dot gnu.org
` (22 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #3 from jacob navia <jacob at jacob dot remcomp.fr> ---
1 trunk gcc:
2 .LC1:
3 .word 325511829 # 0x1366EA95 <<<--- SHOULD BE 325508205
4 .word -922176773 # 0xC908B2FB OK
5 .word -429395012 # 0xE667F3BC OK
6 .word 1073703433 # 0x3FFF6A09 OK
This data is wrong, I repeat, the first number (line 3) should be 325508205 or
0x1366DC6D.
It CAN'T be a printf issue because when you use my "nsqrt" function IT PRINTS
CORRECTLY.
THEN
printf is able to print correctly when the input is correct. The sqrtl function
under ARM 64 bits produces only double precision, instead of quadruple
precision.
That's all I am saying.
And the intention here (from my side) is to help you correct this problem, not
to minimize the quality of gcc, a great software!
jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (2 preceding siblings ...)
2022-10-24 18:33 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 18:40 ` pinskia at gcc dot gnu.org
2022-10-24 19:27 ` jakub at gcc dot gnu.org
` (21 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Keywords| |wrong-code
Ever confirmed|0 |1
Component|target |middle-end
Summary|long double precision is |long double sqrtl constant
|wrong in ARM 64 |folding is wrong
Last reconfirmed| |2022-10-24
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, this might be a bug in mpfr though. GCC uses MPFR to do constant folding.
Without constant folding libm produces:
1.4142135623730950488
That is:
```
#include <stdio.h>
#include <math.h>
int main(void) { volatile long double a = 2.0L; printf("%.20Lg \n",sqrtl(a)); }
```
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (3 preceding siblings ...)
2022-10-24 18:40 ` [Bug middle-end/107370] long double sqrtl constant folding is wrong pinskia at gcc dot gnu.org
@ 2022-10-24 19:27 ` jakub at gcc dot gnu.org
2022-10-24 19:53 ` jacob at jacob dot remcomp.fr
` (20 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-24 19:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On powerpc64le-linux with -O2 -nostdinc -mlong-double-128 -mabi=ieeelongdouble
int main() { __builtin_printf("%.20Lg \n",__builtin_sqrtl(2.0L)); }
we also emit on the trunk:
.long 325511829
.long -922176773
.long -429395012
.long 1073703433
And similarly for:
long double foo (long double x) { return __builtin_hypotl (x, x); }
with -O2 -nostdinc -mlong-double-128 -mabi=ieeelongdouble -ffast-math where we
optimize the hypotl to fabs(x) * M_PI2l (dconst_sqrt2) it is the same constant.
const REAL_VALUE_TYPE *
dconst_sqrt2_ptr (void)
{
static REAL_VALUE_TYPE value;
/* Initialize mathematical constants for constant folding builtins.
These constants need to be given to at least 160 bits precision. */
if (value.cl == rvc_zero)
{
mpfr_t m;
mpfr_init2 (m, SIGNIFICAND_BITS);
mpfr_sqrt_ui (m, 2, MPFR_RNDN);
real_from_mpfr (&value, m, NULL_TREE, MPFR_RNDN);
mpfr_clear (m);
}
return &value;
}
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (4 preceding siblings ...)
2022-10-24 19:27 ` jakub at gcc dot gnu.org
@ 2022-10-24 19:53 ` jacob at jacob dot remcomp.fr
2022-10-24 19:56 ` jacob at jacob dot remcomp.fr
` (19 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 19:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #6 from jacob navia <jacob at jacob dot remcomp.fr> ---
mpfr_init2 (m, SIGNIFICAND_BITS);
How much is that SIGNIFICAND_BITS? I guess that is the problem.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (5 preceding siblings ...)
2022-10-24 19:53 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 19:56 ` jacob at jacob dot remcomp.fr
2022-10-24 20:00 ` joseph at codesourcery dot com
` (18 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 19:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #7 from jacob navia <jacob at jacob dot remcomp.fr> ---
mpfr_init2 (m, SIGNIFICAND_BITS);
How much is that SIGNIFICAND_BITS? I guess that is the problem.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (6 preceding siblings ...)
2022-10-24 19:56 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:00 ` joseph at codesourcery dot com
2022-10-24 20:01 ` jacob at jacob dot remcomp.fr
` (17 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: joseph at codesourcery dot com @ 2022-10-24 20:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #8 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Mon, 24 Oct 2022, jacob at jacob dot remcomp.fr via Gcc-bugs wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
>
> --- Comment #3 from jacob navia <jacob at jacob dot remcomp.fr> ---
> 1 trunk gcc:
> 2 .LC1:
> 3 .word 325511829 # 0x1366EA95 <<<--- SHOULD BE 325508205
> 4 .word -922176773 # 0xC908B2FB OK
> 5 .word -429395012 # 0xE667F3BC OK
> 6 .word 1073703433 # 0x3FFF6A09 OK
>
> This data is wrong, I repeat, the first number (line 3) should be 325508205 or
> 0x1366DC6D.
Why do you think that number is wrong? If I compute the square root of
2**225 using GMP (so not involving MPFR at all, just integer square root
in GMP), I get 1366ea95 as the low 32 bits (and the next bit is a 0, so
rounding toward 0 is correct in this case).
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (7 preceding siblings ...)
2022-10-24 20:00 ` joseph at codesourcery dot com
@ 2022-10-24 20:01 ` jacob at jacob dot remcomp.fr
2022-10-24 20:08 ` jacob at jacob dot remcomp.fr
` (16 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #9 from jacob navia <jacob at jacob dot remcomp.fr> ---
Actually, this looks that a bug in all versions of gcc!
Using the "GP" calculator I obtain:
1.414213562373095048801688724209698078
Using the "bc" calculator
~ % bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=33
sqrt(2)
1.414213562373095048801688724209698
All agree: gcc is just wrong.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (8 preceding siblings ...)
2022-10-24 20:01 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:08 ` jacob at jacob dot remcomp.fr
2022-10-24 20:09 ` jacob at jacob dot remcomp.fr
` (15 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #10 from jacob navia <jacob at jacob dot remcomp.fr> ---
Please let's use 30 digits after the decimal point not 20. Long double gives 32
digits with 128 bits.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (9 preceding siblings ...)
2022-10-24 20:08 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:09 ` jacob at jacob dot remcomp.fr
2022-10-24 20:21 ` jakub at gcc dot gnu.org
` (14 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #11 from jacob navia <jacob at jacob dot remcomp.fr> ---
Please let's use 30 digits after the decimal point not 20. Long double gives 32
digits with 128 bits.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (10 preceding siblings ...)
2022-10-24 20:09 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:21 ` jakub at gcc dot gnu.org
2022-10-24 20:25 ` jakub at gcc dot gnu.org
` (13 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-24 20:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I have to agree with Joseph (on x86_64-linux I get):
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
int
main ()
{
volatile _Float128 x = __builtin_sqrtf128(2.0f128);
char buf[256];
strfromf128 (buf, 128, "%a", x);
strfromf128 (buf + 128, 128, "%.36f", x);
printf ("%s\t%s\n", buf, buf + 128);
x = x * x;
strfromf128 (buf, 128, "%a", x);
strfromf128 (buf + 128, 128, "%.36f", x);
printf ("%s\t%s\n", buf, buf + 128);
// The value you want to see
x = 0x1.6a09e667f3bcc908b2fb1366dc6dp+0f128;
strfromf128 (buf, 128, "%a", x);
strfromf128 (buf + 128, 128, "%.36f", x);
printf ("%s\t%s\n", buf, buf + 128);
x = x * x;
strfromf128 (buf, 128, "%a", x);
strfromf128 (buf + 128, 128, "%.36f", x);
printf ("%s\t%s\n", buf, buf + 128);
}
0x1.6a09e667f3bcc908b2fb1366ea95p+0 1.414213562373095048801688724209697984
0x1.ffffffffffffffffffffffffffffp+0 1.999999999999999999999999999999999807
0x1.6a09e667f3bcc908b2fb1366dc6dp+0 1.414213562373095048801688724209000027
0x1.ffffffffffffffffffffffffd7f4p+0 1.999999999999999999999999999998025537
Clearly the value GCC uses for sqrtf128(2.0f128) multiplied by itself is 1ulp
smaller than 2.0,
while the value you want to see is 10252ulps smaller than 2.0.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (11 preceding siblings ...)
2022-10-24 20:21 ` jakub at gcc dot gnu.org
@ 2022-10-24 20:25 ` jakub at gcc dot gnu.org
2022-10-24 20:32 ` jakub at gcc dot gnu.org
` (12 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-24 20:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
glibc math.h has:
# define M_SQRT2f128 __f128 (1.414213562373095048801688724209698079) /*
sqrt(2) */
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (12 preceding siblings ...)
2022-10-24 20:25 ` jakub at gcc dot gnu.org
@ 2022-10-24 20:32 ` jakub at gcc dot gnu.org
2022-10-24 20:50 ` jacob at jacob dot remcomp.fr
` (11 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-24 20:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to jacob navia from comment #7)
> mpfr_init2 (m, SIGNIFICAND_BITS);
>
> How much is that SIGNIFICAND_BITS? I guess that is the problem.
160 for 32-bit hosts, 192 for 64-bit hosts.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (13 preceding siblings ...)
2022-10-24 20:32 ` jakub at gcc dot gnu.org
@ 2022-10-24 20:50 ` jacob at jacob dot remcomp.fr
2022-10-24 20:51 ` jacob at jacob dot remcomp.fr
` (10 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #15 from jacob navia <jacob at jacob dot remcomp.fr> ---
> Le 24 oct. 2022 à 22:21, jakub at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> a écrit :
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
>
> --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> I have to agree with Joseph (on x86_64-linux I get):
> #define _GNU_SOURCE
> #include <stdlib.h>
> #include <stdio.h>
>
> int
> main ()
> {
> volatile _Float128 x = __builtin_sqrtf128(2.0f128);
> char buf[256];
> strfromf128 (buf, 128, "%a", x);
> strfromf128 (buf + 128, 128, "%.36f", x);
> printf ("%s\t%s\n", buf, buf + 128);
> x = x * x;
> strfromf128 (buf, 128, "%a", x);
> strfromf128 (buf + 128, 128, "%.36f", x);
> printf ("%s\t%s\n", buf, buf + 128);
> // The value you want to see
> x = 0x1.6a09e667f3bcc908b2fb1366dc6dp+0f128;
> strfromf128 (buf, 128, "%a", x);
> strfromf128 (buf + 128, 128, "%.36f", x);
> printf ("%s\t%s\n", buf, buf + 128);
> x = x * x; places.
> strfromf128 (buf, 128, "%a", x);
> strfromf128 (buf + 128, 128, "%.36f", x);
> printf ("%s\t%s\n", buf, buf + 128);
> }
>
> 0x1.6a09e667f3bcc908b2fb1366ea95p+0 1.414213562373095048801688724209697984
> 0x1.ffffffffffffffffffffffffffffp+0 1.999999999999999999999999999999999807
> 0x1.6a09e667f3bcc908b2fb1366dc6dp+0 1.414213562373095048801688724209000027
> 0x1.ffffffffffffffffffffffffd7f4p+0 1.999999999999999999999999999998025537
>
> Clearly the value GCC uses for sqrtf128(2.0f128) multiplied by itself is 1ulp
> smaller than 2.0,
> while the value you want to see is 10252ulps smaller than 2.0.
>
> --
> You are receiving this mail because:
> You reported the bug.
Sorry but the program I used was compiled with gcc. It suffers from lack of
precision too.
In ANY case, in decimal now, the square root of 2 is
1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator
1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are OK
^^^^^
In ANOTHER example:
#include <stdio.h>
#include <math.h>
int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); }
This produces:
7.34301663720716943338259962711e+33
But bc produces
~/lcc/book/test % bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=32
sqrt(2^225)
7343016637207168931428032607349397.48923080385562326502615381523522
To make things clearer I put now the results side by side
7.34301663720716943338259962711e+33 gcc
734301663720716 8931428032607349397.48923080385562326502615381523522 bc
As you can see, after the 15th digits all others are wrong!!!
Jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (14 preceding siblings ...)
2022-10-24 20:50 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:51 ` jacob at jacob dot remcomp.fr
2022-10-24 20:56 ` jacob at jacob dot remcomp.fr
` (9 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #16 from jacob navia <jacob at jacob dot remcomp.fr> ---
Sorry but the program I used was compiled with gcc. It suffers from lack of
precision too.
In ANY case, in decimal now, the square root of 2 is
1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator
1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are OK
^^^^^
In ANOTHER example:
#include <stdio.h>
#include <math.h>
int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); }
This produces:
7.34301663720716943338259962711e+33
But bc produces
~/lcc/book/test % bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=32
sqrt(2^225)
7343016637207168931428032607349397.48923080385562326502615381523522
To make things clearer I put now the results side by side
7.34301663720716943338259962711e+33 gcc
734301663720716 8931428032607349397.48923080385562326502615381523522 bc
As you can see, after the 15th digits all others are wrong!!!
Jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (15 preceding siblings ...)
2022-10-24 20:51 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:56 ` jacob at jacob dot remcomp.fr
2022-10-24 20:59 ` jacob at jacob dot remcomp.fr
` (8 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #17 from jacob navia <jacob at jacob dot remcomp.fr> ---
Sorry but the program I used was compiled with gcc. It suffers from lack of
precision too.
In ANY case, in decimal now, the square root of 2 is
1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator
1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are OK
^^^^^
In ANOTHER example:
#include <stdio.h>
#include <math.h>
int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); }
This produces:
7.34301663720716943338259962711e+33
But bc produces
~/lcc/book/test % bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=32
sqrt(2^225)
7343016637207168931428032607349397.48923080385562326502615381523522
To make things clearer I put now the results side by side
7.34301663720716943338259962711e+33 gcc
734301663720716 8931428032607349397.48923080385562326502615381523522 bc
As you can see, after the 15th digits all others are wrong!!!
Jacob
> Le 24 oct. 2022 à 22:50, gcc-bugzilla@gcc.gnu.org a écrit :
>
> Attachments with a MIME type of "text/html" are not allowed on this installation.
>
> jacob navia wrote:
>>
>>
>>> Le 24 oct. 2022 à 22:21, jakub at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> a écrit :
>>>
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
>>>
>>> --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>>> I have to agree with Joseph (on x86_64-linux I get):
>>> #define _GNU_SOURCE
>>> #include <stdlib.h>
>>> #include <stdio.h>
>>>
>>> int
>>> main ()
>>> {
>>> volatile _Float128 x = __builtin_sqrtf128(2.0f128);
>>> char buf[256];
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> x = x * x;
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> // The value you want to see
>>> x = 0x1.6a09e667f3bcc908b2fb1366dc6dp+0f128;
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> x = x * x; places.
>>
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> }
>>>
>>> 0x1.6a09e667f3bcc908b2fb1366ea95p+0 1.414213562373095048801688724209697984
>>> 0x1.ffffffffffffffffffffffffffffp+0 1.999999999999999999999999999999999807
>>> 0x1.6a09e667f3bcc908b2fb1366dc6dp+0 1.414213562373095048801688724209000027
>>> 0x1.ffffffffffffffffffffffffd7f4p+0 1.999999999999999999999999999998025537
>>>
>>> Clearly the value GCC uses for sqrtf128(2.0f128) multiplied by itself is 1ulp
>>> smaller than 2.0,
>>> while the value you want to see is 10252ulps smaller than 2.0.
>>>
>>> --
>>> You are receiving this mail because:
>>> You reported the bug.
>>
>> Sorry but the program I used was compiled with gcc. It suffers from lack of precision too.
>>
>> In ANY case, in decimal now, the square root of 2 is
>> 1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator
>> 1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are OK
>> ^^^^^
>> In ANOTHER example:
>> #include <stdio.h>
>> #include <math.h>
>>
>> int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); }
>>
>> This produces:
>> 7.34301663720716943338259962711e+33
>> But bc produces
>> ~/lcc/book/test % bc
>> bc 1.06
>> Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
>> This is free software with ABSOLUTELY NO WARRANTY.
>> For details type `warranty'.
>> scale=32
>> sqrt(2^225)
>> 7343016637207168931428032607349397.48923080385562326502615381523522
>>
>> To make things clearer I put now the results side by side
>> 7.34301663720716943338259962711e+33 gcc
>> 734301663720716 8931428032607349397.48923080385562326502615381523522 bc
>>
>> As you can see, after the 15th digits all others are wrong!!!
>>
>> Jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (16 preceding siblings ...)
2022-10-24 20:56 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 20:59 ` jacob at jacob dot remcomp.fr
2022-10-24 21:01 ` jacob at jacob dot remcomp.fr
` (7 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 20:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #18 from jacob navia <jacob at jacob dot remcomp.fr> ---
I can’t reply you because you do not accept accented characters, just plain
ascii, and my mailer uses a French
Accentuated character to say « You wrote » and the whole message is translated
into mime/html.
I posted my reply in the bug mailer
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370>
Jacob
> Le 24 oct. 2022 à 22:50, gcc-bugzilla@gcc.gnu.org a écrit :
>
> Attachments with a MIME type of "text/html" are not allowed on this installation.
>
> jacob navia wrote:
>>
>>
>>> Le 24 oct. 2022 à 22:21, jakub at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> a écrit :
>>>
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
>>>
>>> --- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
>>> I have to agree with Joseph (on x86_64-linux I get):
>>> #define _GNU_SOURCE
>>> #include <stdlib.h>
>>> #include <stdio.h>
>>>
>>> int
>>> main ()
>>> {
>>> volatile _Float128 x = __builtin_sqrtf128(2.0f128);
>>> char buf[256];
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> x = x * x;
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> // The value you want to see
>>> x = 0x1.6a09e667f3bcc908b2fb1366dc6dp+0f128;
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> x = x * x; places.
>>
>>> strfromf128 (buf, 128, "%a", x);
>>> strfromf128 (buf + 128, 128, "%.36f", x);
>>> printf ("%s\t%s\n", buf, buf + 128);
>>> }
>>>
>>> 0x1.6a09e667f3bcc908b2fb1366ea95p+0 1.414213562373095048801688724209697984
>>> 0x1.ffffffffffffffffffffffffffffp+0 1.999999999999999999999999999999999807
>>> 0x1.6a09e667f3bcc908b2fb1366dc6dp+0 1.414213562373095048801688724209000027
>>> 0x1.ffffffffffffffffffffffffd7f4p+0 1.999999999999999999999999999998025537
>>>
>>> Clearly the value GCC uses for sqrtf128(2.0f128) multiplied by itself is 1ulp
>>> smaller than 2.0,
>>> while the value you want to see is 10252ulps smaller than 2.0.
>>>
>>> --
>>> You are receiving this mail because:
>>> You reported the bug.
>>
>> Sorry but the program I used was compiled with gcc. It suffers from lack of precision too.
>>
>> In ANY case, in decimal now, the square root of 2 is
>> 1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator
>> 1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are OK
>> ^^^^^
>> In ANOTHER example:
>> #include <stdio.h>
>> #include <math.h>
>>
>> int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); }
>>
>> This produces:
>> 7.34301663720716943338259962711e+33
>> But bc produces
>> ~/lcc/book/test % bc
>> bc 1.06
>> Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
>> This is free software with ABSOLUTELY NO WARRANTY.
>> For details type `warranty'.
>> scale=32
>> sqrt(2^225)
>> 7343016637207168931428032607349397.48923080385562326502615381523522
>>
>> To make things clearer I put now the results side by side
>> 7.34301663720716943338259962711e+33 gcc
>> 734301663720716 8931428032607349397.48923080385562326502615381523522 bc
>>
>> As you can see, after the 15th digits all others are wrong!!!
>>
>> Jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (17 preceding siblings ...)
2022-10-24 20:59 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 21:01 ` jacob at jacob dot remcomp.fr
2022-10-24 21:02 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 21:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #19 from jacob navia <jacob at jacob dot remcomp.fr> ---
Sorry but the program I used was compiled with gcc. It suffers from lack of
precision too.
In ANY case, in decimal now, the square root of 2 is
1.414 213 562 373 095 048 801 688 724 209 698 078 GP PARI calculator
1.414 213 562 373 095 145 547 462 185 874 gcc: only the first 15 digits are OK
^^^^^
In ANOTHER example:
#include <stdio.h>
#include <math.h>
int main(void) { printf("%.30Lg \n",sqrtl(powl(2,225))); }
This produces:
7.34301663720716943338259962711e+33
But bc produces
~/lcc/book/test % bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=32
sqrt(2^225)
7343016637207168931428032607349397.48923080385562326502615381523522
To make things clearer I put now the results side by side
7.34301663720716943338259962711e+33 gcc
734301663720716 8931428032607349397.48923080385562326502615381523522 bc
As you can see, after the 15th digits all others are wrong!!!
Jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (18 preceding siblings ...)
2022-10-24 21:01 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 21:02 ` jakub at gcc dot gnu.org
2022-10-24 21:03 ` jacob at jacob dot remcomp.fr
` (5 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-24 21:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
All I'm arguing is that everything I see from gcc seems to be correct.
30 digits precision is not enough for IEEE quad, 36 is enough.
If I try your sqrt (2^255) case on x86_64, I see:
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int
main ()
{
volatile _Float128 x = __builtin_sqrtf128(powf128(2, 225));
char buf[256];
strfromf128 (buf, 128, "%a", x);
strfromf128 (buf + 128, 128, "%.36f", x);
printf ("%s\t%s\n", buf, buf + 128);
x = x * x;
strfromf128 (buf, 128, "%a", x);
strfromf128 (buf + 128, 128, "%.36f", x);
printf ("%s\t%s\n", buf, buf + 128);
}
0x1.6a09e667f3bcc908b2fb1366ea95p+112
7343016637207168931428032607349397.000000000000000000000000000000000000
0x1.ffffffffffffffffffffffffffffp+224
53919893334301279589334030174039256154977430310253516431710891278336.000000000000000000000000000000000000
so again, x * x is 1ulp from 0x1.0p+225.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (19 preceding siblings ...)
2022-10-24 21:02 ` jakub at gcc dot gnu.org
@ 2022-10-24 21:03 ` jacob at jacob dot remcomp.fr
2022-10-24 21:06 ` jacob at jacob dot remcomp.fr
` (4 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 21:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #21 from jacob navia <jacob at jacob dot remcomp.fr> ---
When I post I come to a page
MIDAIR COLLISION DETECTED
and that provokes these repeated messages
Sorry but there is a bug in the bug reporting software...
Gosh!
:-)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (20 preceding siblings ...)
2022-10-24 21:03 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 21:06 ` jacob at jacob dot remcomp.fr
2022-10-24 21:09 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 21:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #22 from jacob navia <jacob at jacob dot remcomp.fr> ---
(In reply to Jakub Jelinek from comment #20)
> All I'm arguing is that everything I see from gcc seems to be correct.
> 30 digits precision is not enough for IEEE quad, 36 is enough.
> If I try your sqrt (2^255) case on x86_64, I see:
> #define _GNU_SOURCE
> #include <stdlib.h>
> #include <stdio.h>
> #include <math.h>
>
> int
> main ()
> {
> volatile _Float128 x = __builtin_sqrtf128(powf128(2, 225));
> char buf[256];
> strfromf128 (buf, 128, "%a", x);
> strfromf128 (buf + 128, 128, "%.36f", x);
> printf ("%s\t%s\n", buf, buf + 128);
> x = x * x;
> strfromf128 (buf, 128, "%a", x);
> strfromf128 (buf + 128, 128, "%.36f", x);
> printf ("%s\t%s\n", buf, buf + 128);
> }
>
> 0x1.6a09e667f3bcc908b2fb1366ea95p+112
> 7343016637207168931428032607349397.000000000000000000000000000000000000
> 0x1.ffffffffffffffffffffffffffffp+224
> 53919893334301279589334030174039256154977430310253516431710891278336.
> 000000000000000000000000000000000000
> so again, x * x is 1ulp from 0x1.0p+225.
OK, but you are NOT RUNNING IN AN ARM 64 do you? Because that's the machine I
am using...
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (21 preceding siblings ...)
2022-10-24 21:06 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 21:09 ` jakub at gcc dot gnu.org
2022-10-24 21:26 ` jacob at jacob dot remcomp.fr
` (2 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-10-24 21:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> OK, but you are NOT RUNNING IN AN ARM 64 do you? Because that's the machine
> I am using...
So that would point to glibc's printf then.
Try to use %a to see the hex values, those are much more easily verifiable (you
can e.g. look at the bytes in memory in a debugger etc.).
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (22 preceding siblings ...)
2022-10-24 21:09 ` jakub at gcc dot gnu.org
@ 2022-10-24 21:26 ` jacob at jacob dot remcomp.fr
2022-10-24 21:29 ` pinskia at gcc dot gnu.org
2022-10-24 21:31 ` pinskia at gcc dot gnu.org
25 siblings, 0 replies; 27+ messages in thread
From: jacob at jacob dot remcomp.fr @ 2022-10-24 21:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #24 from jacob navia <jacob at jacob dot remcomp.fr> ---
Sorry, you are right. This is a terrible mistake FROM MY PART!
I am using the raspberry pi through ssh and I had several shells open, using my
Macintosh ARM 64 as the machine where I started those shells.
But I got confused with the Macintosh shells and thought that I was using the
raspberry pi when I was using the Macintosh instead.
The macintosh compiler also is called "gcc" but actually is calling clang, that
doesn't support long doubles of 128 bits but only 64 bits, what explains the
loss of precision after the 15th bits!!!
The bug was in MY SIDE and I have taken your time for nothing. I am very sorry
about this situation. I do not know how to repair it.
My sincere excuses.
jacob
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (23 preceding siblings ...)
2022-10-24 21:26 ` jacob at jacob dot remcomp.fr
@ 2022-10-24 21:29 ` pinskia at gcc dot gnu.org
2022-10-24 21:31 ` pinskia at gcc dot gnu.org
25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 21:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #25 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the darwin (mac OS X) aarch64 (arm64) ABI says long double is 64bits. It
would be implemented that way even in GCC for Mac OS X ARM64.
clang/llvm for aarch64 other than Mac OS X does support 128bit long double
though as required by the ABI too.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug middle-end/107370] long double sqrtl constant folding is wrong
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
` (24 preceding siblings ...)
2022-10-24 21:29 ` pinskia at gcc dot gnu.org
@ 2022-10-24 21:31 ` pinskia at gcc dot gnu.org
25 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-24 21:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107370
--- Comment #26 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #25)
> Note the darwin (mac OS X) aarch64 (arm64) ABI says long double is 64bits.
> It would be implemented that way even in GCC for Mac OS X ARM64.
> clang/llvm for aarch64 other than Mac OS X does support 128bit long double
> though as required by the ABI too.
PR 107315 records the adding of support of 128bit float for Darwin (as
_Float128).
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2022-10-24 21:31 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 6:11 [Bug c/107370] New: long double precision is wrong in ARM 64 jacob at jacob dot remcomp.fr
2022-10-24 6:22 ` [Bug c/107370] " jacob at jacob dot remcomp.fr
2022-10-24 15:19 ` [Bug target/107370] " pinskia at gcc dot gnu.org
2022-10-24 18:33 ` jacob at jacob dot remcomp.fr
2022-10-24 18:40 ` [Bug middle-end/107370] long double sqrtl constant folding is wrong pinskia at gcc dot gnu.org
2022-10-24 19:27 ` jakub at gcc dot gnu.org
2022-10-24 19:53 ` jacob at jacob dot remcomp.fr
2022-10-24 19:56 ` jacob at jacob dot remcomp.fr
2022-10-24 20:00 ` joseph at codesourcery dot com
2022-10-24 20:01 ` jacob at jacob dot remcomp.fr
2022-10-24 20:08 ` jacob at jacob dot remcomp.fr
2022-10-24 20:09 ` jacob at jacob dot remcomp.fr
2022-10-24 20:21 ` jakub at gcc dot gnu.org
2022-10-24 20:25 ` jakub at gcc dot gnu.org
2022-10-24 20:32 ` jakub at gcc dot gnu.org
2022-10-24 20:50 ` jacob at jacob dot remcomp.fr
2022-10-24 20:51 ` jacob at jacob dot remcomp.fr
2022-10-24 20:56 ` jacob at jacob dot remcomp.fr
2022-10-24 20:59 ` jacob at jacob dot remcomp.fr
2022-10-24 21:01 ` jacob at jacob dot remcomp.fr
2022-10-24 21:02 ` jakub at gcc dot gnu.org
2022-10-24 21:03 ` jacob at jacob dot remcomp.fr
2022-10-24 21:06 ` jacob at jacob dot remcomp.fr
2022-10-24 21:09 ` jakub at gcc dot gnu.org
2022-10-24 21:26 ` jacob at jacob dot remcomp.fr
2022-10-24 21:29 ` pinskia at gcc dot gnu.org
2022-10-24 21:31 ` pinskia at gcc dot gnu.org
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).