aboutsummaryrefslogtreecommitdiff
path: root/ic-reals-6.3/base/boolLib.c
blob: d6af0837baad1d3c858dbd93963e921b9414acf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 * Copyright (C) 2000, Imperial College
 *
 * This file is part of the Imperial College Exact Real Arithmetic Library.
 * See the copyright notice included in the distribution for conditions
 * of use.
 */

#include <stdio.h>
#include "real.h"
#include "real-impl.h"

/*
 * A collection of convenient boolean predicates written in terms of
 * more primitive functions defined elsewhere.
 */

Bool
gt_R_QInt(Real x, int a, int b)
{
	return gt_R_0(sub_R_QInt(x, a, b));
}

Bool
ltEq_R_0(Real x)
{
	return not_B(gt_R_0(x));
}

Bool
ltEq_R_R(Real x, Real y)
{
	return ltEq_R_0(sub_R_R(x, y));
}

Bool
lt_R_R(Real x, Real y)
{
	return lt_R_0(sub_R_R(x, y));
}

Bool
lt_R_QInt(Real x, int a, int b)
{
	return gt_R_0(sub_QInt_R(a, b, x));
}

Bool
lt_R_0(Real x)
{
	return not_B(gtEq_R_0(x));
}

Bool
gtEq_R_QInt(Real x, int a, int b)
{
	return gtEq_R_0(sub_R_QInt(x, a, b));
}

Bool
ltEq_R_QInt(Real x, int a, int b)
{
	return gtEq_R_0(sub_QInt_R(a, b, x));
}

Bool
gtEq_R_R(Real x, Real y)
{
	return gtEq_R_0(sub_R_R(x, y));
}

Bool
gt_R_R(Real x, Real y)
{
	return gt_R_0(sub_R_R(x, y));
}