public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* making double type default to 80 or 128 bytes
@ 2020-08-07 14:59 dave
  2020-08-07 15:38 ` Dallman, John
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: dave @ 2020-08-07 14:59 UTC (permalink / raw)
  To: gcc-help


Is it possible to modify the gcc compiler so that recompiling existing 
code and libraries will produce longer doubles (80 or 128 bytes)

without having to re declare all the double types.  This may be a stupid 
question but I'm looking for a quick fix to see if extra

precision helps with an optimization problem. Thanks.


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

* RE: making double type default to 80 or 128 bytes
  2020-08-07 14:59 making double type default to 80 or 128 bytes dave
@ 2020-08-07 15:38 ` Dallman, John
  2020-08-07 15:59 ` Dennis Clarke
  2020-08-07 18:23 ` Jonathan Wakely
  2 siblings, 0 replies; 5+ messages in thread
From: Dallman, John @ 2020-08-07 15:38 UTC (permalink / raw)
  To: dave; +Cc: gcc-help

I think you mean 80 or 128 bits, surely?

> Is it possible to modify the gcc compiler so that recompiling existing code and
> libraries will produce longer doubles (80 or 128 bytes) without having to re-
> declare all the double types.  This may be a stupid question but I'm looking
> for a quick fix to see if extra precision helps with an optimization problem.

This is not a quick fix. It's way more work than changing declarations in any reasonable-size program.

--
John Dallman
Nullius in verba

> -----Original Message-----
> From: Gcc-help <gcc-help-bounces@gcc.gnu.org> On Behalf Of dave via Gcc-
> help
> Sent: 07 August 2020 16:00
> To: gcc-help@gcc.gnu.org
> Subject: making double type default to 80 or 128 bytes
>
>
> Is it possible to modify the gcc compiler so that recompiling existing code and
> libraries will produce longer doubles (80 or 128 bytes)
>
> without having to re declare all the double types.  This may be a stupid
> question but I'm looking for a quick fix to see if extra
>
> precision helps with an optimization problem. Thanks.

-----------------
Siemens Industry Software Limited is a limited company registered in England and Wales.
Registered number: 3476850.
Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, GU16 8QD.

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

* Re: making double type default to 80 or 128 bytes
  2020-08-07 14:59 making double type default to 80 or 128 bytes dave
  2020-08-07 15:38 ` Dallman, John
@ 2020-08-07 15:59 ` Dennis Clarke
  2020-08-10 23:37   ` Jim Wilson
  2020-08-07 18:23 ` Jonathan Wakely
  2 siblings, 1 reply; 5+ messages in thread
From: Dennis Clarke @ 2020-08-07 15:59 UTC (permalink / raw)
  To: gcc-help

On 8/7/20 2:59 PM, dave via Gcc-help wrote:
> 
> Is it possible to modify the gcc compiler so that recompiling existing
> code and libraries will produce longer doubles (80 or 128 bytes)
> 
> without having to re declare all the double types.  This may be a stupid
> question but I'm looking for a quick fix to see if extra
> 
> precision helps with an optimization problem. Thanks.

There is no such thng as an 80 byte double. The standards state that we
shall use floating point types which are of specific bit widths and all
of those are perfectly aligned on perfect power of two bit widths. These
range from 16 bits to 256 bit width. To date I have not seen hardware
which natively supports the 256-bit floating point type.  The IBM POWER9
processor as well as the RISC-V and Fujitsu SPARC provide hardware for
the 128-bit width and they seem to work very well indeed. The 80-bit
thing to which you refer is a hack put in place by the intel/x86 world
simply because the hardware can not properly handle anything larger. It
should not exist at all in if we use the floating point standards.

You are far better off using gmp and mpfr and mpc ( et. al. ) to attain
a wider degree of floating point precision but you will never get very
far using x86 hardware. It simply can not do that and the 80-bit hack is
just that, a hack.

Dennis

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

* Re: making double type default to 80 or 128 bytes
  2020-08-07 14:59 making double type default to 80 or 128 bytes dave
  2020-08-07 15:38 ` Dallman, John
  2020-08-07 15:59 ` Dennis Clarke
@ 2020-08-07 18:23 ` Jonathan Wakely
  2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2020-08-07 18:23 UTC (permalink / raw)
  To: dave; +Cc: gcc-help

On Fri, 7 Aug 2020 at 16:03, dave via Gcc-help <gcc-help@gcc.gnu.org> wrote:
>
>
> Is it possible to modify the gcc compiler so that recompiling existing
> code and libraries will produce longer doubles (80 or 128 bytes)

On some processor types, yes. For most, no.

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

* Re: making double type default to 80 or 128 bytes
  2020-08-07 15:59 ` Dennis Clarke
@ 2020-08-10 23:37   ` Jim Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Wilson @ 2020-08-10 23:37 UTC (permalink / raw)
  To: Dennis Clarke; +Cc: gcc-help

On Fri, Aug 7, 2020 at 9:00 AM Dennis Clarke via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
> There is no such thng as an 80 byte double. The standards state that we
> shall use floating point types which are of specific bit widths and all
> of those are perfectly aligned on perfect power of two bit widths. These
> range from 16 bits to 256 bit width. To date I have not seen hardware
> which natively supports the 256-bit floating point type.  The IBM POWER9
> processor as well as the RISC-V and Fujitsu SPARC provide hardware for
> the 128-bit width and they seem to work very well indeed. The 80-bit
> thing to which you refer is a hack put in place by the intel/x86 world
> simply because the hardware can not properly handle anything larger. It
> should not exist at all in if we use the floating point standards.

The IEEE FP standard defines some basic formats which have fixed
bit-widths, and extended formats which have implementation defined bit
widths.  The 80-bit x86 format meets the definition of extended
binary64 in the 2008 standard, and extended double in the 1985
standard.  Likewise the similar 96 bit (with 16-bits of zero padding)
format used on 68k systems.  Nowadays though, I think most people
would rather have a proper 128-bit long double than an 80/96-bit
extended double.  But there is nothing hackish about the 80/96 bit
extended doubles on x86/68k.  They have just outlived their
usefulness.

Jim

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

end of thread, other threads:[~2020-08-10 23:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 14:59 making double type default to 80 or 128 bytes dave
2020-08-07 15:38 ` Dallman, John
2020-08-07 15:59 ` Dennis Clarke
2020-08-10 23:37   ` Jim Wilson
2020-08-07 18:23 ` Jonathan Wakely

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