zig
zig copied to clipboard
libc: replace musl's trigonometric functions with compiler_rt's
Part of #2879. According to the instruction, this PR removes some musl files, including the following functions:
- sin
- sinf
- cos
- cosf
- sincos
- sincosf
- tan
- tanf
I confirmed that running zig build test-modules and zig-libc-test raised no errors during the trigonometric function tests.
zig-libc-test revealed some discrepancies between the results of long double trigonometric functions in compiler_rt and musl. Therefore, this PR is restricted to float and double functions.
It seems like we also have
cosfsincos(includessincosl?)sincosfsinftanf
in lib/libc/mingw.
When deleting musl files, I was able to run the deletion after confirming with zig-libc-test that the function behavior did not change.
However, I am not sure what policy I can use to delete MinGW files.
The behavior of compiler_rt's sin function and musl's sin function are consistent, but MinGW's sin function may not be.
Do I need to make sure that the behavior of compiler_rt's sin function and MinGW's sin function match?
Or, even if the behavior does not match, can we assume that musl's sin function (compiler_rt's sin function) behavior is more appropriate and remove MinGW's sin function?
Do I need to make sure that the behavior of compiler_rt's
sinfunction and MinGW'ssinfunction match?
I don't think so. musl tends to be pretty good about math functions, so until we have evidence to the contrary, let's assume that it's a good baseline for math functions for all static libcs.
Thanks, I deleted the MinGW files with relief. (71ff3830)
In lib/libc/mingw/math/arm/sincos.S and lib/libc/mingw/math/arm64/sincos.S, I removed only the sincos symbol.
It will not be too late to remove MinGW's sincosl at the same time as musl.
Nice, thank you
Sorry @alexrp, I didn't notice you had assigned yourself or I would have left it in your hands.
No worries, I'm not calling dibs or anything. :slightly_smiling_face: