mailing list of musl libc
 help / color / mirror / code / Atom feed
* Looking for a libm suitable for float128 (using softfloat or softfp)
@ 2019-08-31 11:33 ardi
  2019-08-31 12:25 ` Szabolcs Nagy
  2019-08-31 12:25 ` Pascal Cuoq
  0 siblings, 2 replies; 3+ messages in thread
From: ardi @ 2019-08-31 11:33 UTC (permalink / raw)
  To: musl

Hi,

I'm looking for a software implementation of libm that can deal with
the IEEE float128 (float128 as implemented by either the John Hauser's
softfloat or Fabrice Bellard's softfp libraries).

Looking at the musl source in src/math it certainly implements long
double versions of all libm functions, and it seems that the source
code makes checks to confirm whether to use the Intel 80bit long
double, or a 128bit long double, so, at first glance I think musl
could be a great choice for this task.

But I'm wondering if I can rely on the 128bit implementations at
src/math, or if this is untested code.

BTW, yes, I know there's libquadmath, but it's LGPL and I'd prefer to
avoid it because sometimes I need static linking.

Would you recommend me to use musl for this, or would you advice to
use other alternatives?

Thanks!!

ardi


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

* Re: Looking for a libm suitable for float128 (using softfloat or softfp)
  2019-08-31 11:33 Looking for a libm suitable for float128 (using softfloat or softfp) ardi
@ 2019-08-31 12:25 ` Szabolcs Nagy
  2019-08-31 12:25 ` Pascal Cuoq
  1 sibling, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2019-08-31 12:25 UTC (permalink / raw)
  To: musl; +Cc: ardi

* ardi <ardillasdelmonte@gmail.com> [2019-08-31 13:33:48 +0200]:
> I'm looking for a software implementation of libm that can deal with
> the IEEE float128 (float128 as implemented by either the John Hauser's
> softfloat or Fabrice Bellard's softfp libraries).

i think you just want an ieee-754 binary128 libm.

whether the underlying hw has instructions for it or they
are software emulated are not hugely relevant.

(some functions can be implemented more efficiently if you
know there are no fp units, but then usually you would not
use the ieee elementary operations either, e.g. doing plain
int arithmetics can be faster than using a soft fp lib)

> Looking at the musl source in src/math it certainly implements long
> double versions of all libm functions, and it seems that the source
> code makes checks to confirm whether to use the Intel 80bit long
> double, or a 128bit long double, so, at first glance I think musl
> could be a great choice for this task.
> 
> But I'm wondering if I can rely on the 128bit implementations at
> src/math, or if this is untested code.

you can rely on it when there is actual implementation, but
many functions are missing (or just dummy functions calling
the double prec version)

> 
> BTW, yes, I know there's libquadmath, but it's LGPL and I'd prefer to
> avoid it because sometimes I need static linking.
> 
> Would you recommend me to use musl for this, or would you advice to
> use other alternatives?

i don't know of opensource 128bit complete libm implementation
other than the code in glibc (lgpl), but there are arbitrary
precision libraries and they may be good enough if you only
need software implementation anyway.

i think http://arblib.org/ (lgpl) has quite complete coverage
of math functions and should be no more than 2-3x slower than
soft fp code optimized for 128bit floats (mpfr is slower than
that).


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

* Re: Looking for a libm suitable for float128 (using softfloat or softfp)
  2019-08-31 11:33 Looking for a libm suitable for float128 (using softfloat or softfp) ardi
  2019-08-31 12:25 ` Szabolcs Nagy
@ 2019-08-31 12:25 ` Pascal Cuoq
  1 sibling, 0 replies; 3+ messages in thread
From: Pascal Cuoq @ 2019-08-31 12:25 UTC (permalink / raw)
  To: musl


> On 31 Aug 2019, at 13:33, ardi <ardillasdelmonte@gmail.com> wrote:
> 
> Hi,
> 
> I'm looking for a software implementation of libm that can deal with
> the IEEE float128 (float128 as implemented by either the John Hauser's
> softfloat or Fabrice Bellard's softfp libraries).
> 
> Looking at the musl source in src/math it certainly implements long
> double versions of all libm functions, and it seems that the source
> code makes checks to confirm whether to use the Intel 80bit long
> double, or a 128bit long double, so, at first glance I think musl
> could be a great choice for this task.

As far as I know, most functions are not implemented for binary128 in musl.

Yes, there are long double version of everything and #ifdefs for the cases where long double is binary64, double-extended or binary128, but binary128 is not actually implemented. In most cases you will be worse off than if you had opted for double-extended:

https://git.musl-libc.org/cgit/musl/tree/src/math/powl.c?id=6ad514e4e278f0c3b18eb2db1d45638c9af1c07f#n517

#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384
// TODO: broken implementation to make things compile
long double powl(long double x, long double y)
{
	return pow(x, y);
}
#endif




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

end of thread, other threads:[~2019-08-31 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-31 11:33 Looking for a libm suitable for float128 (using softfloat or softfp) ardi
2019-08-31 12:25 ` Szabolcs Nagy
2019-08-31 12:25 ` Pascal Cuoq

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).