xref: /netbsd-src/external/bsd/ntp/dist/tests/libntp/lfptest.h (revision 200d779b75dbeafa7bc01fd0f60bc61185f6967b)
1 /*	$NetBSD: lfptest.h,v 1.3 2015/07/10 14:20:36 christos Exp $	*/
2 
3 #ifndef NTP_TESTS_LFPTEST_H
4 #define NTP_TESTS_LFPTEST_H
5 
6 #include "ntp_fp.h"
7 
8 int IsEqual(const l_fp expected, const l_fp actual) {
9 	if (L_ISEQU(&expected, &actual)) {
10 		return TRUE;
11 	} else {
12 		//printf(" expected: ...");
13 		/*
14 		<< " expected: " << lfptoa(&expected, FRACTION_PREC)
15 				<< " (" << expected.l_ui << "." << expected.l_uf << ")"
16 				<< " but was: " << lfptoa(&actual, FRACTION_PREC)
17 				<< " (" << actual.l_ui << "." << actual.l_uf << ")";
18 		*/
19 		return FALSE;
20 	}
21 
22 }
23 
24 static const int32 HALF = -2147483647L - 1L;
25 static const int32 HALF_PROMILLE_UP = 2147484; // slightly more than 0.0005
26 static const int32 HALF_PROMILLE_DOWN = 2147483; // slightly less than 0.0005
27 static const int32 QUARTER = 1073741824L;
28 static const int32 QUARTER_PROMILLE_APPRX = 1073742L;
29 
30 #endif
31 
32 
33