Revisiting More Complete long double Support

Joel Sherrill joel@rtems.org
Wed Aug 17 22:06:25 GMT 2022


Hi

I'm looking at newlib long double support again when sizeof(long double) !=
sizeof(double).

(1) Merged FreeBSD C code for long double math

FreeBSD has C code for long double math routines as default implementation:

https://github.com/freebsd/freebsd-src/tree/main/lib/msun/src

I **THINK** those will work if LDBL != DBL so that code might need the
ifdef for LDBL_EQ_DBL to pick the current newlib common implementation of
the method which just calls the normal version of the method.  I code even
add the files as XXX_freebsd.c and only add

ifdef _LDBL_EQ_DBL
long double
acosl (long double x)
{
  return acos(x);
}
#else
#include "acosl_freebsd.c"
#endif

which would definitely avoid edits to the FreeBSD source.

(2) More i386 assembly versions

Then there appears to be some long double methods for the i386/87 here
which newlib doesn't currently have:

https://github.com/freebsd/freebsd-src/tree/main/lib/msun/i387

Thoughts on adding this long double code from FreeBSD?

Thanks.

--joel


More information about the Newlib mailing list