Hi Tom, Tom Bannink wrote,
Hi uClibc-ng developers,
I've stumbled across a bug in the implementation of `lrint` in uClibc-ng. I'm not sure where to report this so I'm sending this email. Please let me know if I can submit an issue on a bugtracker somewhere. I tried to post an issue on the gitlab page (https://gogs.waldemar-brodkorb.de/oss/uclibc-ng/issues) but it seems I cannot make an account there.
The bug is simple to reproduce: `lrint(0.5)` and `lrint(-0.5)` should return 0 (or +-1 depending on the rounding mode) but instead they return 2 and -2 respectively.
The faulty code is the block at lines 55-64 of this file: https:// cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libm/s_lrint.c Note that the `lround` function works fine and has very similar code: https:// cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libm/s_lround.c
Let me know if you need more information.
Can you provide a simple test case for the issue?
best regards Waldemar
Hi Waldemar,
Are you looking for unittest code in a specific test-framework? To reproduce the bug, simply print the value of lrint(0.5). It should print 0 but instead it prints 2:
int main() { long x = lrint(0.5); printf("%ld", x); return 0; }
Hi Tom,
can you try: https://mailman.openadk.org/mailman3/hyperkitty/list/devel@uclibc-ng.org/thr...
best regards Waldemar
tombannink@gmail.com wrote,
Hi Waldemar,
Are you looking for unittest code in a specific test-framework? To reproduce the bug, simply print the value of lrint(0.5). It should print 0 but instead it prints 2:
int main() { long x = lrint(0.5); printf("%ld", x); return 0; } _______________________________________________ devel mailing list -- devel@uclibc-ng.org To unsubscribe send an email to devel-leave@uclibc-ng.org
Hi Waldemar,
I confirmed that the patch works, thank you very much!
Best, Tom