[libc] Add implementations for sqrt, sqrtf, and sqrtl.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/math/CMakeLists.txt | ||
---|---|---|
498 | NIT: compile options are altered by CMAKE_BUILD_TYPE parameters. Do we need to specify the compile options for every entry point? | |
libc/test/src/math/sqrt_test.cpp | ||
24 | NIT: constexpr? | |
libc/test/src/math/sqrtf_test.cpp | ||
34 | Do we plan to raise FE_INVALID? | |
libc/utils/FPUtil/SqrtLongDoubleX86.h | ||
130 | Do these clang-tidy go away if we rename this variable to extractedOutput? If we give this variable a better name then the above comment is redundant. |
I need more time to read through the patch. But I have left few comments about the structuring of the code.
libc/utils/FPUtil/Sqrt.h | ||
---|---|---|
23 | Make all functions implemented in header files static inline. | |
64 | Instead of this, use: #if !(defined(__x86_64__) || defined(__i386__)) | |
177 | To keep FPUtil utility like, would it make sense to conditionally include SqrtLongDoubleX86.h. This will also avoid the conditional include in sqrtl.cpp and FPUtil/Sqrt.h will be the only file to include in other places where the square root function will probably be used (say in hypot). |
Please follow up with patches to switch to NormalFloat and a doc explaining the algorithm.
libc/test/src/math/sqrt_test.cpp | ||
---|---|---|
24 | constexpr does not work with floating point yet. | |
libc/test/src/math/sqrtf_test.cpp | ||
34 | Floating point exceptions will be implemented in the future. Currently we prioritize expanding functionality first, unless there are immediate requests/needs. | |
libc/utils/FPUtil/SqrtLongDoubleX86.h | ||
130 | I think clang-tidy wants the variables' initials to be capitalized; it's a bit noisy |
NIT: compile options are altered by CMAKE_BUILD_TYPE parameters. Do we need to specify the compile options for every entry point?