Sat Nov 10 23:04:16 2018 UTC ()
Print the input to cosf on failure too.


(riastradh)
diff -r1.6 -r1.7 src/tests/lib/libm/t_cos.c

cvs diff -r1.6 -r1.7 src/tests/lib/libm/t_cos.c (expand / switch to unified diff)

--- src/tests/lib/libm/t_cos.c 2018/11/07 04:00:13 1.6
+++ src/tests/lib/libm/t_cos.c 2018/11/10 23:04:16 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: t_cos.c,v 1.6 2018/11/07 04:00:13 riastradh Exp $ */ 1/* $NetBSD: t_cos.c,v 1.7 2018/11/10 23:04:16 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2011 The NetBSD Foundation, Inc. 4 * Copyright (c) 2011 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jukka Ruohonen. 8 * by Jukka Ruohonen.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -169,28 +169,28 @@ ATF_TC_BODY(cosf_angles, tc) @@ -169,28 +169,28 @@ ATF_TC_BODY(cosf_angles, tc)
169 const float eps = FLT_EPSILON; 169 const float eps = FLT_EPSILON;
170 size_t i; 170 size_t i;
171 171
172 for (i = 0; i < __arraycount(angles); i++) { 172 for (i = 0; i < __arraycount(angles); i++) {
173 int deg = angles[i].angle; 173 int deg = angles[i].angle;
174 float theta = angles[i].x; 174 float theta = angles[i].x;
175 float cos_theta = angles[i].fy; 175 float cos_theta = angles[i].fy;
176 176
177 if (cos_theta == 999) 177 if (cos_theta == 999)
178 cos_theta = angles[i].y; 178 cos_theta = angles[i].y;
179 179
180 assert(cos_theta != 0); 180 assert(cos_theta != 0);
181 if (!(fabsf((cosf(theta) - cos_theta)/cos_theta) <= eps)) { 181 if (!(fabsf((cosf(theta) - cos_theta)/cos_theta) <= eps)) {
182 atf_tc_fail_nonfatal("cosf(%d deg) = %.8g != %.8g", 182 atf_tc_fail_nonfatal("cosf(%d deg = %.8g) = %.8g"
183 deg, cos(theta), cos_theta); 183 " != %.8g", deg, theta, cos(theta), cos_theta);
184 } 184 }
185 } 185 }
186} 186}
187 187
188ATF_TC(cosf_nan); 188ATF_TC(cosf_nan);
189ATF_TC_HEAD(cosf_nan, tc) 189ATF_TC_HEAD(cosf_nan, tc)
190{ 190{
191 atf_tc_set_md_var(tc, "descr", "Test cosf(NaN) == NaN"); 191 atf_tc_set_md_var(tc, "descr", "Test cosf(NaN) == NaN");
192} 192}
193 193
194ATF_TC_BODY(cosf_nan, tc) 194ATF_TC_BODY(cosf_nan, tc)
195{ 195{
196 const float x = 0.0L / 0.0L; 196 const float x = 0.0L / 0.0L;