This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, this patch introduces a new wrapper for scalbln functions in order to set errno to ERANGE on overflow and underflow.The existing aliases that uses __scalbln functions are replaced by aliases to the new wrapper. The corresponding tests in libm-test.inc are updated to check for errno via ERRNO_PLUS_OFLOW etc.
This patch only covers the scalbln-part of bug 6803. Tested on s390/s390x/x86_64/ppc64.Please review and test and give feedback, if this is the way to add a new wrapper!
Bye. --- 2014-05-07 Stefan Liebler <stli@linux.vnet.ibm.com> [BZ #6803] * math/libm-test.inc (scalbln_test_date): Add errno expectations. * math/w_scalblnf.c: New File. Add wrapper which checks for setting errno to ERANGE. Add weak_alias for corresponding scalbln function. * math/w_scalbln.c: Likewise. * math/w_scalblnl.c: Likewise. * math/Makefile (libm-calls): Add w_scalbln. * sysdeps/ieee754/flt-32/s_scalblnf.c: Remove weak_alias for corresponding scalbln function. * sysdeps/ieee754/dbl-64/s_scalbln.c: Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_scalbln.c: Likewise. * sysdeps/ieee754/ldbl-96/s_scalblnl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_scalblnl.c: Likewise. * sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c: Likewise. * sysdeps/ieee754/ldbl-64-128/s_scalblnl.c: Remove long_double_symbol for scalblnl function in libm, libc. * sysdeps/ieee754/ldbl-64-128/w_scalblnl.c: New File. Add wrapper which checks for setting errno to ERANGE. Add long_double_symbol for scalblnl function in libm, libc. * sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c: Remove long_double_symbol for scalblnl in libm. * sysdeps/ieee754/ldbl-128ibm/w_scalblnl.c: New File. Add wrapper which checks for setting errno to ERANGE. Add long_double_symbol for scalblnl function in libm. * sysdeps/i386/fpu/w_scalblnf.c: New File. Do not use wrapper because scalbn functions are used as scalbln. * sysdeps/i386/fpu/w_scalbln.c: Likewise. * sysdeps/i386/fpu/w_scalblnl.c: Likewise. * sysdeps/m68k/m680x0/fpu/w_scalblnf.c: Likewise. * sysdeps/m68k/m680x0/fpu/w_scalbln.c: Likewise. * sysdeps/m68k/m680x0/fpu/w_scalblnl.c: Likewise. * sysdeps/ia64/fpu/w_scalblnf.c: New File. Do not use wrapper because of own implementation. * sysdeps/ia64/fpu/w_scalbln.c: Likewise. * sysdeps/ia64/fpu/w_scalblnl.c: Likewise. --- On 04/25/2014 04:35 PM, Joseph S. Myers wrote:
On Wed, 23 Apr 2014, Stefan Liebler wrote:Hi, this patch sets errno to ERANGE on overflow and underflow. The corresponding tests in libm-test.inc are updated to check for errno, too. Tested on S390/S390x. ok to commit?I don't think this is the best approach. Apart from needing lots of architecture-specific versions updated (so you'd need to draw the attention of relevant architecture maintainers to the issue), we already have a scalbn wrapper that checks for overflow/underflow and sets errno, in the form of ldexp. So for scalbn it would be most natural to make scalbn an alias for __ldexp instead of __scalbn; for scalbln you'd need to add a new wrapper, replacing scalbln being an alias for __scalbln. (The tests will then need to use ERRNO_PLUS_OFLOW etc. so the expectations only cover the cases where glibc guarantees errno setting.)
Attachment:
patchglibc_math_scalbln_20140507
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |