/
LSICOMP.c,v
85 lines (68 loc) · 1.43 KB
/
LSICOMP.c,v
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
78
79
80
81
82
83
84
85
head 1.2;
access;
symbols;
locks
saclib:1.2; strict;
comment @ * @;
1.2
date 95.09.13.12.47.55; author Chris; state typo;
branches;
next 1.1;
1.1
date 95.07.30.14.53.17; author George; state new;
branches;
next ;
desc
@Logarithmic standard interval comparison test.
@
1.2
log
@ Replaced <-- with <- so sdesc would work right.
@
text
@/*=====================================================================
t <- LSICOMP(I,J)
Logarithmic standard interval comparison test.
Inputs
I,J : logarithmic standard intervals.
Output
t : an integer. t = -2 if I < J, t = -1 if J < I,
t = 0 if I = J, t = +1 if I is properly
contained in J, and t = +2 if J is properly
contained in I.
=====================================================================*/
#include "saclib.h"
Word LSICOMP(I,J)
Word I,J;
{
Word a1,a2,b1,b2,t,t1,t2;
Step1: /* Obtain endpoints. */
FIRST2(I,&a1,&a2);
FIRST2(J,&b1,&b2);
Step2: /* Compare corresponding endpoints. */
t1 = LBRNCOMP(a1,b1);
t2 = LBRNCOMP(a2,b2);
Step3: /* Case analysis. */
if (t1 == 0 && t2 == 0)
t = 0;
else if (t1 >= 0 && t2 <= 0)
t = 1;
else if (t1 <= 0 && t2 >= 0)
t = 2;
else if (LBRNCOMP(b2,a1) <= 0)
t = -1;
else
t = -2;
Return: /* Return t. */
return(t);
}
@
1.1
log
@Initial revision
@
text
@d2 1
a2 1
t <-- LSICOMP(I,J)
@