Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #402613
| From | Michael S <already5chosen@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.c, comp.arch |
| Subject | Re: Taking hypot(3) To The Edge |
| Date | 2026-10-01 14:12 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <20261001141212.00002f20@yahoo.com> (permalink) |
| References | <119kaj9$npbg$1@dont-email.me> <119kd8g$opnp$1@dont-email.me> <119l4vl$t831$2@dont-email.me> |
Cross-posted to 2 groups.
On Thu, 1 Oct 2026 10:17:57 +0200 David Brown <david.brown@hesbynett.no> wrote: > On 01/10/2026 03:33, bart wrote: > > On 01/10/2026 01:47, Lawrence D’Oliveiro wrote: > > > >> A couple of things stand out immediately: one is that the “long > >> double” type doesn’t seem to make use of all the 128 bits it > >> occupies. I was expecting a mantissa length closer to 100 bits, > >> but it’s nowhere near that. > > > > Probably it uses Intel's 80-bit x87 FPU format. That uses a 64-bit > > mantissa (with explicit top bit). > > > > Yes, that's the default for "long double" in the standard x86-64 ABI. > > On 32-bit x86, these 10-byte doubles were often stored in 12-byte > (96-bit) containers for better alignment, but I don't know the ABI > standards here. > > On 64-bit x86, for better alignment they are stored in 16-byte > containers. The rest of the space will be padding. > > gcc supports "-mlong-double-64", "-mlong-double-80" and > "-mlong-double-128" flags. The latter appears to be a default on ARM64 Linux. > With 64-bit long doubles, they are > effectively the same as doubles, and thus faster. 80-bit long > doubles are the standard, while 128-bit long doubles give > quad-precision range and precision, but must be handled in software > through the gcc-provided "libquad" library functions. > It is more complicated than that. libquadmath supplies 128-bit equivalents of of standard C math library functions and functions for conveersion betwen fp128 and strings. But basic arithmetic operations are coming from other source. One would suspect libgcc, but reality is more complicated than just that. It seems that Jakub Jelinek knows details, but I am not sure that there is somebody else that knows all of them for all platforms. > You can also use the _Float128 or _Float128x types, which are > optional types in the C standards (along with 16, 32 and 64-bit > versions). The "x" types are for calculations and might be bigger > than their name applies, while the non-x types are "interchange" > types that have the same format on all systems. > Another name supported on many platforms is __float128. > > > 10 bytes would be an odd size though, so it's rounded up to 16 > > bytes in the implementation. > > > > I don't know if current hardware would directly support a full 128 > > bits, or it needs to be emulated. > > > > IBM's POWER processors are, I think, the only cpus with hardware > quad-precision floating point that are realistic. RISC-V has the Q > extensions specified, but I do not believe anyone actually makes > RISC-V cores with quad floating point. > Don't forget IBM Z. BTW, the next generation of IBM Z chips will run ARM64 natively alongside Z. I wonder if it would mativate IBM to ask ARM Inc to add 128-bit BFP (and may be DFP) as optional extension(s) to Arm ISA. > > However, float limits (in float.h) should give a clue as to the > > actual range and precision. > > > > Yes. > > You can also just write some code in godbolt.org, and see if it calls > library functions like "__multf3" instead of generating hardware > instructions, as you play around with the compiler flags. > >
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-01 00:47 +0000
Re: Taking hypot(3) To The Edge "Steven G. Kargl" <sgk@REMOVEtroutmask.apl.washington.edu> - 2026-10-01 01:02 +0000
Re: Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-01 01:55 +0000
Re: Taking hypot(3) To The Edge "Steven G. Kargl" <sgk@REMOVEtroutmask.apl.washington.edu> - 2026-10-01 03:44 +0000
Re: Taking hypot(3) To The Edge bart <bc@freeuk.com> - 2026-10-01 02:33 +0100
Re: Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-01 02:38 +0000
Re: Taking hypot(3) To The Edge David Brown <david.brown@hesbynett.no> - 2026-10-01 10:17 +0200
Re: Taking hypot(3) To The Edge Michael S <already5chosen@yahoo.com> - 2026-10-01 14:12 +0300
Re: Taking hypot(3) To The Edge David Brown <david.brown@hesbynett.no> - 2026-10-01 13:47 +0200
Re: Taking hypot(3) To The Edge Terje Mathisen <terje.mathisen@tmsw.no> - 2026-10-02 20:35 +0200
Re: Taking hypot(3) To The Edge bart <bc@freeuk.com> - 2026-10-02 21:17 +0100
Re: Taking hypot(3) To The Edge BGB <cr88192@gmail.com> - 2026-10-02 17:13 -0500
Re: Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-03 02:17 +0000
Re: Taking hypot(3) To The Edge BGB <cr88192@gmail.com> - 2026-10-03 15:20 -0500
Re: Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-03 21:46 +0000
Re: Taking hypot(3) To The Edge BGB <cr88192@gmail.com> - 2026-10-03 20:35 -0500
Re: Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-04 23:54 +0000
Re: Taking hypot(3) To The Edge Michael S <already5chosen@yahoo.com> - 2026-10-03 21:06 +0300
Re: Taking hypot(3) To The Edge Terje Mathisen <terje.mathisen@tmsw.no> - 2026-10-03 20:22 +0200
Re: Taking hypot(3) To The Edge Michael S <already5chosen@yahoo.com> - 2026-10-03 22:01 +0300
Re: Taking hypot(3) To The Edge Terje Mathisen <terje.mathisen@tmsw.no> - 2026-10-03 23:20 +0200
Re: Taking hypot(3) To The Edge MitchAlsup <user5857@newsgrouper.org.invalid> - 2026-10-04 17:49 +0000
Re: Taking hypot(3) To The Edge Thomas Koenig <tkoenig@netcologne.de> - 2026-10-03 19:47 +0000
Re: Taking hypot(3) To The Edge bart <bc@freeuk.com> - 2026-10-01 23:05 +0100
Re: Taking hypot(3) To The Edge Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-10-02 02:34 +0000
Re: Taking hypot(3) To The Edge Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-10-01 21:14 -0700
Re: Taking hypot(3) To The Edge bart <bc@freeuk.com> - 2026-10-02 11:39 +0100
csiph-web