mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-08 23:58:31 +08:00
logb (+-0) is a pole error: it returns -Inf and raises the divide-by-zero exception, but it never set errno, even though glibc defines math_errhandling to include MATH_ERRNO. Set errno in the zero branch that already exists in every logb implementation, instead of adding a w_logb wrapper; the USE_LOGB*_BUILTIN paths have no such branch, so add one there. The double and float versions use __math_divzero and __math_divzerof. There is no long double equivalent, so those keep the explicit division and use math_opt_barrier to stop the compiler from folding it away. The i386 fxtract implementations of logb and logbf cannot set errno, and adding the error handling to the assembly is not worthwhile, so they are removed in favour of the generic C ones. s_logbl.c moves to sysdeps/x86/fpu, replacing the x86_64 copy that only included it. The manual described logb (0) as returning +Inf without signalling, which was wrong in both respects. Tested on x86_64-linux-gnu. Signed-off-by: Shamil Abdulaev <ashamil435@gmail.com> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>