toaruos icon indicating copy to clipboard operation
toaruos copied to clipboard

Implement missing `libm` functions

Open klange opened this issue 2 years ago • 0 comments

The following functions have stub implementations in our libc's integrated libm component:

  • [ ] acos, asin, acosh, asinh, atanh
  • [ ] log, log10, log2, log1p,
  • [ ] expm1
  • [ ] trunc
  • [ ] erf, erfc
  • [ ] ~~gamma~~, lgamma, tgamma
  • [ ] remainder
  • [ ] copysign
  • [ ] ldexp

These functions are provided to resolve compilation and linking issues in third-party packages, and with dynamic linking their availability as stubs allows them to be implemented without recompiling those packages in the future. Some of the stubs have partial implementations that are known to be incorrect or inaccurate, while others return a hardcoded 0.0.

Action items:

  • Study the implementations in musl and newlib to understand the common approaches to their implementation.
  • Examine the x86-64 architecture manuals to see what can be implemented via x87/SSE instructions.

klange avatar Dec 07 '21 02:12 klange