On 2020-10-30 09:42, Mark Kettenis wrote:
Date: Fri, 30 Oct 2020 08:34:46 -0700 (PDT) From: j...@bitminer.ca
...snip...
It's a bit more complicated that that. ISO C actually says that ilogb(0) should return FP_ILOGB0, which shall either be INT_MIN or -(INT_MAX). Our <math.h> defines FP_ILOGB0 as: #define FP_ILOGB0 (-INT_MAX) So in that respect the arm64 implementation is correct and this is a documentation bug. That said, the amd64 and i386 implementations use hardware instructions that use the FP_ILOGB0 == INT_MIN convention. So we either have the make FP_ILOGB0 machine dependent, or change some of the implementations.
I don't believe the actual value is important, -INT_MAX or INT_MIN, as long as ilogb/ilogbf use a (any) value per architecture. I'd be in favour of your first option. And adjusting the documentation to read FP_ILOGB0. JMO John