t_cbrt.c (272458) | t_cbrt.c (274601) |
---|---|
1/* $NetBSD: t_cbrt.c,v 1.3 2014/03/03 10:39:08 martin Exp $ */ 2 3/*- 4 * Copyright (c) 2011 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jukka Ruohonen. --- 223 unchanged lines hidden (view full) --- 232{ 233 const float x = 0.0L; 234 float y = cbrtf(x); 235 236 if (fabsf(y) > 0.0 || signbit(y) != 0) 237 atf_tc_fail_nonfatal("cbrtf(+0.0) != +0.0"); 238} 239 | 1/* $NetBSD: t_cbrt.c,v 1.3 2014/03/03 10:39:08 martin Exp $ */ 2 3/*- 4 * Copyright (c) 2011 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jukka Ruohonen. --- 223 unchanged lines hidden (view full) --- 232{ 233 const float x = 0.0L; 234 float y = cbrtf(x); 235 236 if (fabsf(y) > 0.0 || signbit(y) != 0) 237 atf_tc_fail_nonfatal("cbrtf(+0.0) != +0.0"); 238} 239 |
240#if !defined(__FreeBSD__) || LDBL_PREC != 53 |
|
240/* 241 * cbrtl(3) 242 */ 243ATF_TC(cbrtl_nan); 244ATF_TC_HEAD(cbrtl_nan, tc) 245{ 246 atf_tc_set_md_var(tc, "descr", "Test cbrtl(NaN) == NaN"); 247} --- 17 unchanged lines hidden (view full) --- 265 const long double x[] = { 0.0, 0.005, 1.0, 99.0, 123.123, 9999.0 }; 266 const long double eps = 1.0e-15; 267 long double y, z; 268 size_t i; 269 270 for (i = 0; i < __arraycount(x); i++) { 271 272 y = cbrtl(x[i]); | 241/* 242 * cbrtl(3) 243 */ 244ATF_TC(cbrtl_nan); 245ATF_TC_HEAD(cbrtl_nan, tc) 246{ 247 atf_tc_set_md_var(tc, "descr", "Test cbrtl(NaN) == NaN"); 248} --- 17 unchanged lines hidden (view full) --- 266 const long double x[] = { 0.0, 0.005, 1.0, 99.0, 123.123, 9999.0 }; 267 const long double eps = 1.0e-15; 268 long double y, z; 269 size_t i; 270 271 for (i = 0; i < __arraycount(x); i++) { 272 273 y = cbrtl(x[i]); |
274#ifdef __FreeBSD__ 275 z = powl(x[i], (long double)1.0 / 3.0); 276#else |
|
273 z = powl(x[i], 1.0 / 3.0); | 277 z = powl(x[i], 1.0 / 3.0); |
278#endif |
|
274 275 if (fabsl(y - z) > eps * fabsl(1 + x[i])) 276 atf_tc_fail_nonfatal("cbrtl(%0.03Lf) != " 277 "powl(%0.03Lf, 1/3)\n", x[i], x[i]); 278 } 279} 280 281ATF_TC(cbrtl_inf_neg); --- 50 unchanged lines hidden (view full) --- 332ATF_TC_BODY(cbrtl_zero_pos, tc) 333{ 334 const long double x = 0.0L; 335 long double y = cbrtl(x); 336 337 if (fabsl(y) > 0.0 || signbit(y) != 0) 338 atf_tc_fail_nonfatal("cbrtl(+0.0) != +0.0"); 339} | 279 280 if (fabsl(y - z) > eps * fabsl(1 + x[i])) 281 atf_tc_fail_nonfatal("cbrtl(%0.03Lf) != " 282 "powl(%0.03Lf, 1/3)\n", x[i], x[i]); 283 } 284} 285 286ATF_TC(cbrtl_inf_neg); --- 50 unchanged lines hidden (view full) --- 337ATF_TC_BODY(cbrtl_zero_pos, tc) 338{ 339 const long double x = 0.0L; 340 long double y = cbrtl(x); 341 342 if (fabsl(y) > 0.0 || signbit(y) != 0) 343 atf_tc_fail_nonfatal("cbrtl(+0.0) != +0.0"); 344} |
345#endif |
|
340 341ATF_TP_ADD_TCS(tp) 342{ 343 344 ATF_TP_ADD_TC(tp, cbrt_nan); 345 ATF_TP_ADD_TC(tp, cbrt_pow); 346 ATF_TP_ADD_TC(tp, cbrt_inf_neg); 347 ATF_TP_ADD_TC(tp, cbrt_inf_pos); 348 ATF_TP_ADD_TC(tp, cbrt_zero_neg); 349 ATF_TP_ADD_TC(tp, cbrt_zero_pos); 350 351 ATF_TP_ADD_TC(tp, cbrtf_nan); 352 ATF_TP_ADD_TC(tp, cbrtf_powf); 353 ATF_TP_ADD_TC(tp, cbrtf_inf_neg); 354 ATF_TP_ADD_TC(tp, cbrtf_inf_pos); 355 ATF_TP_ADD_TC(tp, cbrtf_zero_neg); 356 ATF_TP_ADD_TC(tp, cbrtf_zero_pos); 357 | 346 347ATF_TP_ADD_TCS(tp) 348{ 349 350 ATF_TP_ADD_TC(tp, cbrt_nan); 351 ATF_TP_ADD_TC(tp, cbrt_pow); 352 ATF_TP_ADD_TC(tp, cbrt_inf_neg); 353 ATF_TP_ADD_TC(tp, cbrt_inf_pos); 354 ATF_TP_ADD_TC(tp, cbrt_zero_neg); 355 ATF_TP_ADD_TC(tp, cbrt_zero_pos); 356 357 ATF_TP_ADD_TC(tp, cbrtf_nan); 358 ATF_TP_ADD_TC(tp, cbrtf_powf); 359 ATF_TP_ADD_TC(tp, cbrtf_inf_neg); 360 ATF_TP_ADD_TC(tp, cbrtf_inf_pos); 361 ATF_TP_ADD_TC(tp, cbrtf_zero_neg); 362 ATF_TP_ADD_TC(tp, cbrtf_zero_pos); 363 |
364#if !defined(__FreeBSD__) || LDBL_PREC != 53 |
|
358 ATF_TP_ADD_TC(tp, cbrtl_nan); 359 ATF_TP_ADD_TC(tp, cbrtl_powl); 360 ATF_TP_ADD_TC(tp, cbrtl_inf_neg); 361 ATF_TP_ADD_TC(tp, cbrtl_inf_pos); 362 ATF_TP_ADD_TC(tp, cbrtl_zero_neg); 363 ATF_TP_ADD_TC(tp, cbrtl_zero_pos); | 365 ATF_TP_ADD_TC(tp, cbrtl_nan); 366 ATF_TP_ADD_TC(tp, cbrtl_powl); 367 ATF_TP_ADD_TC(tp, cbrtl_inf_neg); 368 ATF_TP_ADD_TC(tp, cbrtl_inf_pos); 369 ATF_TP_ADD_TC(tp, cbrtl_zero_neg); 370 ATF_TP_ADD_TC(tp, cbrtl_zero_pos); |
371#endif |
|
364 365 return atf_no_error(); 366} | 372 373 return atf_no_error(); 374} |