crt-test: Test sincos()

This commit is contained in:
Martin Storsjö committed 2019-04-09 12:45:35 +03:00
1 parent 5d969f2a70
commit cb71dfa03b
1 file changed
+18
+18
View File
@@ -16,6 +16,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef __linux__
#define _GNU_SOURCE
#endif
#include <stdio.h>
#include <math.h>
#include <string.h>
@@ -769,6 +772,21 @@ int main(int argc, char* argv[]) {
TEST_FLT_ACCURACY(cos(F(0.0)), 1.0, 0.01);
TEST_FLT_ACCURACY(sin(F(0.0)), 0.0, 0.01);
#if defined(__linux__) || defined(__MINGW32__)
double outSin = 42.0, outCos = 42.0;
sincos(F(0.0), &outSin, &outCos);
TEST_FLT_ACCURACY(outSin, 0.0, 0.01);
TEST_FLT_ACCURACY(outCos, 1.0, 0.01);
float outSinf = 42.0, outCosf = 42.0;
sincosf(F(0.0), &outSinf, &outCosf);
TEST_FLT_ACCURACY(outSinf, 0.0, 0.01);
TEST_FLT_ACCURACY(outCosf, 1.0, 0.01);
long double outSinl = 42.0, outCosl = 42.0;
sincosl(F(0.0), &outSinl, &outCosl);
TEST_FLT_ACCURACY(outSinl, 0.0, 0.01);
TEST_FLT_ACCURACY(outCosl, 1.0, 0.01);
#endif
#ifdef _WIN32
TEST_FLT_ACCURACY(_copysign(F(3.125), F(1)), 3.125, 0.0001);
TEST_FLT_ACCURACY(_copysign(F(3.125), F(-1)), -3.125, 0.0001);