~ubuntu-branches/ubuntu/trusty/lifelines/trusty

« back to all changes in this revision

Viewing changes to reports/st/trigtest.ll

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Augusto van de Wiel (faw)
  • Date: 2007-08-14 00:02:04 UTC
  • mfrom: (1.1.4 upstream) (3.1.4 gutsy)
  • Revision ID: james.westby@ubuntu.com-20070814000204-mpv5faygl0dgq3qi
Tags: 3.0.61-1
* New upstream release. (Closes: #387856).
* Fixing documentation build problems also fixes FTBFS if built twice in a
  row. (Closes: #424543).
* Adding lynx as a build dependency. This is necessary to generate txt files
  from html, discovered while fixing #424543.
* Upstream fix: charset for gedcom file in unicode. (Closes: #396206).
* Upstream fim: updating documentation about desc-tex2. (Closes: #405501).
* Bumping Standards-Version to 3.7.2 without package changes.
* Dropping local debian patches added upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * @progname       trigtest.ll
 
3
 * @version        1.0
 
4
 * @author         Matt Emmerton
 
5
 * @category
 
6
 * @output         Text
 
7
 * @description    Tests functionality of trig-related functions.
 
8
 *
 
9
 * Test trig and spherical distance calculations
 
10
 *
 
11
 */
 
12
 
 
13
options("explicitvars")
 
14
 
 
15
proc main()
 
16
{
 
17
  print("Simple Sine/Cosine/Tangent operations (degree->value)", nl())
 
18
  print(nl())
 
19
 
 
20
  set(angle1,0)
 
21
  set(angle2,45)
 
22
  set(angle3a,89.99)
 
23
  set(angle3b,90)
 
24
  set(angle3c,90.01)
 
25
  set(angle4,135)
 
26
  set(angle5,180)
 
27
  set(angle6,225)
 
28
  set(angle7a,269.99)
 
29
  set(angle7b,270)
 
30
  set(angle7c,270.01)
 
31
  set(angle8,315)
 
32
  set(angle9,360)
 
33
 
 
34
  print("angle\tsin\tcos\ttan", nl())
 
35
  print(f(angle1),  "\t", f(sin(angle1)),  "\t", f(cos(angle1)),  "\t", f(tan(angle1)),  nl())
 
36
  print(f(angle2),  "\t", f(sin(angle2)),  "\t", f(cos(angle2)),  "\t", f(tan(angle2)),  nl())
 
37
  print(f(angle3a), "\t", f(sin(angle3a)), "\t", f(cos(angle3a)), "\t", f(tan(angle3a)), nl())
 
38
  print(f(angle3b), "\t", f(sin(angle3b)), "\t", f(cos(angle3b)), "\t", "N/A",           nl())
 
39
  print(f(angle3c), "\t", f(sin(angle3c)), "\t", f(cos(angle3c)), "\t", f(tan(angle3c)), nl())
 
40
  print(f(angle4),  "\t", f(sin(angle4)),  "\t", f(cos(angle4)),  "\t", f(tan(angle4)),  nl())
 
41
  print(f(angle5),  "\t", f(sin(angle5)),  "\t", f(cos(angle5)),  "\t", f(tan(angle5)),  nl())
 
42
  print(f(angle6),  "\t", f(sin(angle6)),  "\t", f(cos(angle6)),  "\t", f(tan(angle6)),  nl())
 
43
  print(f(angle7a), "\t", f(sin(angle7a)), "\t", f(cos(angle7a)), "\t", f(tan(angle7a)), nl())
 
44
  print(f(angle7b), "\t", f(sin(angle7b)), "\t", f(cos(angle7b)), "\t", "N/A",           nl())
 
45
  print(f(angle7c), "\t", f(sin(angle7c)), "\t", f(cos(angle7c)), "\t", f(tan(angle7c)), nl())
 
46
  print(f(angle8),  "\t", f(sin(angle8)),  "\t", f(cos(angle8)),  "\t", f(tan(angle8)),  nl())
 
47
  print(f(angle9),  "\t", f(sin(angle9)),  "\t", f(cos(angle9)),  "\t", f(tan(angle9)),  nl())
 
48
  print(nl())
 
49
 
 
50
  print("Simple ArcSine/ArcCosine/ArcTangent operations (value->degree)", nl())
 
51
  print(nl())
 
52
 
 
53
  set(value1,-1)
 
54
  set(value2,-0.707)
 
55
  set(value3,-0.3535)
 
56
  set(value4,0.0)
 
57
  set(value5,0.3535)
 
58
  set(value6,0.707)
 
59
  set(value7,1.0)
 
60
 
 
61
  print("value\tarcsin\tarccos\tarctan", nl())
 
62
  print(f(value1), "\t", f(arcsin(value1)), "\t", f(arccos(value1)), "\t", f(arctan(value1)), nl())
 
63
  print(f(value2), "\t", f(arcsin(value2)), "\t", f(arccos(value2)), "\t", f(arctan(value2)), nl())
 
64
  print(f(value3), "\t", f(arcsin(value3)), "\t", f(arccos(value3)), "\t", f(arctan(value3)), nl())
 
65
  print(f(value4), "\t", f(arcsin(value4)), "\t", f(arccos(value4)), "\t", f(arctan(value4)), nl())
 
66
  print(f(value5), "\t", f(arcsin(value5)), "\t", f(arccos(value5)), "\t", f(arctan(value5)), nl())
 
67
  print(f(value6), "\t", f(arcsin(value6)), "\t", f(arccos(value6)), "\t", f(arctan(value6)), nl())
 
68
  print(f(value7), "\t", f(arcsin(value7)), "\t", f(arccos(value7)), "\t", f(arctan(value7)), nl())
 
69
  print(nl())
 
70
 
 
71
  print("Reflexive operations (arcOP(OP(degree)) == degree)", nl())
 
72
  print("NOTE: Due to the periodic nature of these functions, output degree values may be",nl())
 
73
  print("different than the input degree values.", nl())
 
74
  print("NOTE: Due to roundoff, values may be out by a value of one in the least significant place.", nl())
 
75
  print(nl())
 
76
 
 
77
  print("angle\t\tarcsin(sin)\tarccos(cos)\tarctan(tan)", nl())
 
78
  print(f(angle1),   "\t\t", f(arcsin(sin(angle1))),   "\t\t", f(arccos(cos(angle1))),   "\t\t", f(arctan(tan(angle1))),   nl())
 
79
  print(f(angle2),   "\t\t", f(arcsin(sin(angle2))),   "\t\t", f(arccos(cos(angle2))),   "\t\t", f(arctan(tan(angle2))),   nl())
 
80
  print(f(angle3a),  "\t\t", f(arcsin(sin(angle3a))),  "\t\t", f(arccos(cos(angle3a))),  "\t\t", f(arctan(tan(angle3a))),  nl())
 
81
  print(f(angle3c),  "\t\t", f(arcsin(sin(angle3c))),  "\t\t", f(arccos(cos(angle3c))),  "\t\t", f(arctan(tan(angle3c))),  nl())
 
82
  print(f(angle4),   "\t\t", f(arcsin(sin(angle4))),   "\t\t", f(arccos(cos(angle4))),   "\t\t", f(arctan(tan(angle4))),   nl())
 
83
  print(f(angle5),   "\t\t", f(arcsin(sin(angle5))),   "\t\t", f(arccos(cos(angle5))),   "\t\t", f(arctan(tan(angle5))),   nl())
 
84
  print(f(angle6),   "\t\t", f(arcsin(sin(angle6))),   "\t\t", f(arccos(cos(angle6))),   "\t\t", f(arctan(tan(angle6))),   nl())
 
85
  print(f(angle7a),  "\t\t", f(arcsin(sin(angle7a))),  "\t\t", f(arccos(cos(angle7a))),  "\t\t", f(arctan(tan(angle7a))),  nl())
 
86
  print(f(angle7c),  "\t\t", f(arcsin(sin(angle7c))),  "\t\t", f(arccos(cos(angle7c))),  "\t\t", f(arctan(tan(angle7c))),  nl())
 
87
  print(f(angle8),   "\t\t", f(arcsin(sin(angle8))),   "\t\t", f(arccos(cos(angle8))),   "\t\t", f(arctan(tan(angle8))),   nl())
 
88
  print(f(angle9),   "\t\t", f(arcsin(sin(angle9))),   "\t\t", f(arccos(cos(angle9))),   "\t\t", f(arctan(tan(angle9))),   nl())
 
89
  print(nl())
 
90
 
 
91
  print("Decimal Degrees to DMH Conversions", nl())
 
92
  print(nl())
 
93
 
 
94
  set(deg1,44)
 
95
  set(min1,17)
 
96
  set(sec1,29)
 
97
 
 
98
  dms2deg(deg1,min1,sec1,dec1)
 
99
  print(d(deg1), " degrees, ", d(min1), " minutes and ", d(sec1), " seconds = ", f(dec1), " degrees.", nl())
 
100
 
 
101
  deg2dms(dec1,deg1,min1,sec1)
 
102
  print(f(dec1), " degrees = ", d(deg1), " degrees, ", d(min1), " minutes and ", d(sec1), " seconds.", nl())
 
103
  print(nl())
 
104
 
 
105
  print("Spherical Distance Calculations", nl())
 
106
  print(nl())
 
107
 
 
108
  /* 43.410815 / 43^24'38" is my house (lat) */
 
109
  set(deg1,43)
 
110
  set(min1,24)
 
111
  set(sec1,38)
 
112
  dms2deg(deg1,min1,sec1,dec1)
 
113
 
 
114
  /* -80.508982 / -80^30'32" is my house (lon) */
 
115
  set(deg2,-80)
 
116
  set(min2,30)
 
117
  set(sec2,32)
 
118
  dms2deg(deg2,min2,sec2,dec2)
 
119
 
 
120
  /* 44.101825 / 44^06'06" is my cottage (lat) */
 
121
  set(deg3,44)
 
122
  set(min3,06)
 
123
  set(sec3,06)
 
124
  dms2deg(deg3,min3,sec3,dec3)
 
125
 
 
126
  /* -81.721931 / -81^43'18" is my cottage (lon) */
 
127
  set(deg4,-81)
 
128
  set(min4,43)
 
129
  set(sec4,18)
 
130
  dms2deg(deg4,min4,sec4,dec4)
 
131
 
 
132
  print("House Lat: ", d(deg1), " degrees, ", d(min1), " minutes and ", d(sec1), " seconds = ", f(dec1), " degrees.", nl())
 
133
  print("House Lon: ", d(deg2), " degrees, ", d(min2), " minutes and ", d(sec2), " seconds = ", f(dec2), " degrees.", nl())
 
134
  print("Cottage Lat: ", d(deg3), " degrees, ", d(min3), " minutes and ", d(sec3), " seconds = ", f(dec3), " degrees.", nl())
 
135
  print("Cottage Lon: ", d(deg4), " degrees, ", d(min4), " minutes and ", d(sec4), " seconds = ", f(dec4), " degrees.", nl())
 
136
 
 
137
  print("House to Cottage: ", f(spdist(dec1,dec2,dec3,dec4)), nl())
 
138
  print("House to Cottage (via roads, suggested by Google Maps: ", f(138.2))
 
139
}