NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Error in returned value of sizeof(long double) in amd64?



Thank you.

We, then, in effect, are carrying around 'dead bytes' on amd64, for, reason?

That is, what is the 'win' in doing this ?  

This is of no consequence for a handful of long doubles, but big arrays of long double....

(This is just curiosity; I have found exactly one scientific calculation I needed to do whose precision improved using long doubles, a satellite orbital prediction over very long times)


-Mike


On Fri, Jul 5, 2024 at 9:35 PM Martin Husemann <martin%duskware.de@localhost> wrote:
On Fri, Jul 05, 2024 at 07:13:05PM -0700, Michael Cheponis wrote:
> sizeof(long double) reports 16 in both amd64 and arm64.  I think that amd64
> uses 80-bit long double floats, and arm64 uses 128-bit long double floats.
> See enclosed code.

The storage size of a long double is one thing, but the exact format
used in calculations may vary.

On amd64:

> cc -dM -E - < /dev/null | fgrep LDBL_MANT
#define __LDBL_MANT_DIG__ 64


On aarch64:

> cc -dM -E - < /dev/null | fgrep LDBL_MAN
#define __LDBL_MANT_DIG__ 113

(use just LDBL in the fgrep to see more exact limits of the format in use)

Martin


Home | Main Index | Thread Index | Old Index