On Thu, 11 Aug 2022 14:18:20 -0400 Greg Troxel <[email protected]> wrote:
> Has anyone else been having this problem? It's a known defect in NetBSD's libm. > Any reason I shouldn't just define it and call log1p, not worrying about > those extra bits, to get around this (in my local build)? If you want to lose less precision I believe it is better to do "logl(1.0l + x)" than "(long double)log1p(x)". But with homeassistant not being a scientific software I guess it don't matter much. Are you sure the issue is with numpy and not scipy? There is a patch for this issue in pkgsrc scipy. > Anyone up for doing it right? Does FreeBSD have an implementation in their libm? POSIX permits to just use the naive logl(1+x) implementation but the existence of log1p implies there exists a better precision numerical algorithm for x near 0. -Tobias
