Math functions need some special cases #2
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: auravulpes/FENIX_libc#2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What is pow(1, INFINITY)? What about sin(NAN)? log(-3)? Right now, my code takes any of those sorts of nonsensical queries and tries to legitimately calculate them, but it shouldn't. It needs special cases for that sort of stuff. I'll come in tomorrow and actually try to list out a bunch of them for the code I've already written.
Okay, so, according to IEEE 754-2019 and the C99 standard...
(nb: k is used for an arbitrary number, +k is arbitrary positive number, -k is an arbitrary negative number, v is an arbitrary even, d is an arbitrary odd, i is an arbitrary integer, r is an arbitrary non-integer, 0 can be either +0 or -0, and rules take priority from top to bottom)
pow():
exp():
log():
sqrt():
I'm not sure this covers everything, but it's definitely a nice start. I'll, like, see what musl does for some other cases (e.g. sin(NaN)) later.