Libc: fix ef_exp.s by Bughunter #177

Merged
mxlgv merged 1 commits from libc-fix into main 2025-04-02 21:34:07 +02:00
Member
image.png this bug was fixed by Kirilom (by Bughunter) 5 years ago in another similar file
<img width="650" alt="image.png" src="attachments/e2d58257-9103-49fe-ad2a-868a8cb39982"> this bug was fixed by Kirilom (by Bughunter) 5 years ago in another similar file
IgorA added 1 commit 2025-03-21 22:20:42 +01:00
Libc: fix ef_exp.s by Bughunter
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 28s
Build system / Build (pull_request) Successful in 5m23s
d5c1325b02
Owner

menuetlibc: Fix floating exponent calculation

The fix was initially done by Bughunter in 12a6b7f2 (r7958) for double.
This commit applies the same fix to the float exponent.

menuetlibc: Fix floating exponent calculation The fix was initially done by Bughunter in 12a6b7f2 (r7958) for double. This commit applies the same fix to the float exponent.
Author
Member

The input parameters of the function are in different formats (4 or 8 bytes).
image.png
The algorithm of operation must be the same, because the FPU registers are 80 bits. After exiting the function, the result is converted to 4 or 8 bytes. It is impossible to finally test the correctness of the expf (float) function because the expf function is not exported from the libc library.
image.png

The input parameters of the function are in different formats (4 or 8 bytes). <img width="623" alt="image.png" src="attachments/208e1078-ae3a-4fa1-bb47-7e0c78c8896f"> The algorithm of operation must be the same, because the FPU registers are 80 bits. After exiting the function, the result is converted to 4 or 8 bytes. It is impossible to finally test the correctness of the expf (float) function because the expf function is not exported from the libc library. <img width="125" alt="image.png" src="attachments/c8845d2d-c3ca-4128-864b-d8c141284e4a">
Owner

@IgorA There seems to be no point in this fix since menuetlibc is deprecated.
In libc.obj, the mathematics was taken from here, perhaps there is also a bug there: https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/develop/ktcc/trunk/libc.obj/source/math

@IgorA There seems to be no point in this fix since `menuetlibc` is deprecated. In `libc.obj`, the mathematics was taken from here, perhaps there is also a bug there: https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/develop/ktcc/trunk/libc.obj/source/math
mxlgv added the
PR
Review required
label 2025-03-22 10:00:52 +01:00
Author
Member

I made a test program and found that after revision 9842 the exp function was broken.
image.png
image.png
test in excel:
image.png

I made a test program and found that after revision 9842 the exp function was broken. <img width="443" alt="image.png" src="attachments/ebee91c1-0f9c-4f9a-a193-fca5a227a519"> <img width="443" alt="image.png" src="attachments/ec45fc13-5f84-49dc-bed7-65975e9d3f62"> test in excel: <img width="306" alt="image.png" src="attachments/bd85af4d-fb60-4a0e-9fd1-e649b2fe4807">
Sweetbread force-pushed libc-fix from d5c1325b02 to 3c547b217f 2025-03-30 16:48:17 +02:00 Compare
mxlgv approved these changes 2025-04-02 20:17:39 +02:00
mxlgv added
PR
Ready to merge
and removed
PR
Review required
labels 2025-04-02 20:17:49 +02:00
mxlgv force-pushed libc-fix from 3c547b217f to 2cba153e06 2025-04-02 21:27:23 +02:00 Compare
mxlgv scheduled this pull request to auto merge when all checks succeed 2025-04-02 21:33:29 +02:00
mxlgv merged commit 58cf25fe43 into main 2025-04-02 21:34:07 +02:00
Sweetbread deleted branch libc-fix 2025-04-02 23:52:23 +02:00
Sign in to join this conversation.
No Reviewers
4 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#177
No description provided.