lunation 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,360 +1,60 @@
1
- - moon_mean_elongation: 0
2
- sun_mean_anomaly: 0
3
- moon_mean_anomaly: 1
4
- moon_argument_of_latitude: 0
5
- sine_coefficient: 6288774
6
- cosine_coefficient: -20905355
7
- - moon_mean_elongation: 2
8
- sun_mean_anomaly: 0
9
- moon_mean_anomaly: -1
10
- moon_argument_of_latitude: 0
11
- sine_coefficient: 1274027
12
- cosine_coefficient: -3699111
13
- - moon_mean_elongation: 2
14
- sun_mean_anomaly: 0
15
- moon_mean_anomaly: 0
16
- moon_argument_of_latitude: 0
17
- sine_coefficient: 658314
18
- cosine_coefficient: -2955968
19
- - moon_mean_elongation: 0
20
- sun_mean_anomaly: 0
21
- moon_mean_anomaly: 2
22
- moon_argument_of_latitude: 0
23
- sine_coefficient: 213618
24
- cosine_coefficient: -569925
25
- - moon_mean_elongation: 0
26
- sun_mean_anomaly: 1
27
- moon_mean_anomaly: 0
28
- moon_argument_of_latitude: 0
29
- sine_coefficient: -185116
30
- cosine_coefficient: 48888
31
- - moon_mean_elongation: 0
32
- sun_mean_anomaly: 0
33
- moon_mean_anomaly: 0
34
- moon_argument_of_latitude: 2
35
- sine_coefficient: -114332
36
- cosine_coefficient: -3149
37
- - moon_mean_elongation: 2
38
- sun_mean_anomaly: 0
39
- moon_mean_anomaly: -2
40
- moon_argument_of_latitude: 0
41
- sine_coefficient: 58793
42
- cosine_coefficient: 246158
43
- - moon_mean_elongation: 2
44
- sun_mean_anomaly: -1
45
- moon_mean_anomaly: -1
46
- moon_argument_of_latitude: 0
47
- sine_coefficient: 57066
48
- cosine_coefficient: -152138
49
- - moon_mean_elongation: 2
50
- sun_mean_anomaly: 0
51
- moon_mean_anomaly: 1
52
- moon_argument_of_latitude: 0
53
- sine_coefficient: 53322
54
- cosine_coefficient: -170733
55
- - moon_mean_elongation: 2
56
- sun_mean_anomaly: -1
57
- moon_mean_anomaly: 0
58
- moon_argument_of_latitude: 0
59
- sine_coefficient: 45758
60
- cosine_coefficient: -204586
61
- - moon_mean_elongation: 0
62
- sun_mean_anomaly: 1
63
- moon_mean_anomaly: -1
64
- moon_argument_of_latitude: 0
65
- sine_coefficient: -40923
66
- cosine_coefficient: -129620
67
- - moon_mean_elongation: 1
68
- sun_mean_anomaly: 0
69
- moon_mean_anomaly: 0
70
- moon_argument_of_latitude: 0
71
- sine_coefficient: -34720
72
- cosine_coefficient: 108743
73
- - moon_mean_elongation: 0
74
- sun_mean_anomaly: 1
75
- moon_mean_anomaly: 1
76
- moon_argument_of_latitude: 0
77
- sine_coefficient: -30383
78
- cosine_coefficient: 104755
79
- - moon_mean_elongation: 2
80
- sun_mean_anomaly: 0
81
- moon_mean_anomaly: 0
82
- moon_argument_of_latitude: -2
83
- sine_coefficient: 15327
84
- cosine_coefficient: 10321
85
- - moon_mean_elongation: 0
86
- sun_mean_anomaly: 0
87
- moon_mean_anomaly: 1
88
- moon_argument_of_latitude: 2
89
- sine_coefficient: -12528
90
- cosine_coefficient: null
91
- - moon_mean_elongation: 0
92
- sun_mean_anomaly: 0
93
- moon_mean_anomaly: 1
94
- moon_argument_of_latitude: -2
95
- sine_coefficient: 10980
96
- cosine_coefficient: 79661
97
- - moon_mean_elongation: 4
98
- sun_mean_anomaly: 0
99
- moon_mean_anomaly: -1
100
- moon_argument_of_latitude: 0
101
- sine_coefficient: 10675
102
- cosine_coefficient: -34782
103
- - moon_mean_elongation: 0
104
- sun_mean_anomaly: 0
105
- moon_mean_anomaly: 3
106
- moon_argument_of_latitude: 0
107
- sine_coefficient: 10034
108
- cosine_coefficient: -23210
109
- - moon_mean_elongation: 4
110
- sun_mean_anomaly: 0
111
- moon_mean_anomaly: -2
112
- moon_argument_of_latitude: 0
113
- sine_coefficient: 8548
114
- cosine_coefficient: -21636
115
- - moon_mean_elongation: 2
116
- sun_mean_anomaly: 1
117
- moon_mean_anomaly: -1
118
- moon_argument_of_latitude: 0
119
- sine_coefficient: -7888
120
- cosine_coefficient: 24208
121
- - moon_mean_elongation: 2
122
- sun_mean_anomaly: 1
123
- moon_mean_anomaly: 0
124
- moon_argument_of_latitude: 0
125
- sine_coefficient: -6766
126
- cosine_coefficient: 30824
127
- - moon_mean_elongation: 1
128
- sun_mean_anomaly: 0
129
- moon_mean_anomaly: -1
130
- moon_argument_of_latitude: 0
131
- sine_coefficient: -5163
132
- cosine_coefficient: -8379
133
- - moon_mean_elongation: 1
134
- sun_mean_anomaly: 1
135
- moon_mean_anomaly: 0
136
- moon_argument_of_latitude: 0
137
- sine_coefficient: 4987
138
- cosine_coefficient: -16675
139
- - moon_mean_elongation: 2
140
- sun_mean_anomaly: -1
141
- moon_mean_anomaly: 1
142
- moon_argument_of_latitude: 0
143
- sine_coefficient: 4036
144
- cosine_coefficient: -12831
145
- - moon_mean_elongation: 2
146
- sun_mean_anomaly: 0
147
- moon_mean_anomaly: 2
148
- moon_argument_of_latitude: 0
149
- sine_coefficient: 3994
150
- cosine_coefficient: -10445
151
- - moon_mean_elongation: 4
152
- sun_mean_anomaly: 0
153
- moon_mean_anomaly: 0
154
- moon_argument_of_latitude: 0
155
- sine_coefficient: 3861
156
- cosine_coefficient: -11650
157
- - moon_mean_elongation: 2
158
- sun_mean_anomaly: 0
159
- moon_mean_anomaly: -3
160
- moon_argument_of_latitude: 0
161
- sine_coefficient: 3665
162
- cosine_coefficient: 14403
163
- - moon_mean_elongation: 0
164
- sun_mean_anomaly: 1
165
- moon_mean_anomaly: -2
166
- moon_argument_of_latitude: 0
167
- sine_coefficient: -2689
168
- cosine_coefficient: -7003
169
- - moon_mean_elongation: 2
170
- sun_mean_anomaly: 0
171
- moon_mean_anomaly: -1
172
- moon_argument_of_latitude: 2
173
- sine_coefficient: -2602
174
- cosine_coefficient: null
175
- - moon_mean_elongation: 2
176
- sun_mean_anomaly: -1
177
- moon_mean_anomaly: -2
178
- moon_argument_of_latitude: 0
179
- sine_coefficient: 2390
180
- cosine_coefficient: 10056
181
- - moon_mean_elongation: 1
182
- sun_mean_anomaly: 0
183
- moon_mean_anomaly: 1
184
- moon_argument_of_latitude: 0
185
- sine_coefficient: -2348
186
- cosine_coefficient: 6322
187
- - moon_mean_elongation: 2
188
- sun_mean_anomaly: -2
189
- moon_mean_anomaly: 0
190
- moon_argument_of_latitude: 0
191
- sine_coefficient: 2236
192
- cosine_coefficient: -9884
193
- - moon_mean_elongation: 0
194
- sun_mean_anomaly: 1
195
- moon_mean_anomaly: 2
196
- moon_argument_of_latitude: 0
197
- sine_coefficient: -2120
198
- cosine_coefficient: 5751
199
- - moon_mean_elongation: 0
200
- sun_mean_anomaly: 2
201
- moon_mean_anomaly: 0
202
- moon_argument_of_latitude: 0
203
- sine_coefficient: -2069
204
- cosine_coefficient: null
205
- - moon_mean_elongation: 2
206
- sun_mean_anomaly: -2
207
- moon_mean_anomaly: -1
208
- moon_argument_of_latitude: 0
209
- sine_coefficient: 2048
210
- cosine_coefficient: -4950
211
- - moon_mean_elongation: 2
212
- sun_mean_anomaly: 0
213
- moon_mean_anomaly: 1
214
- moon_argument_of_latitude: -2
215
- sine_coefficient: -1773
216
- cosine_coefficient: 4130
217
- - moon_mean_elongation: 2
218
- sun_mean_anomaly: 0
219
- moon_mean_anomaly: 0
220
- moon_argument_of_latitude: 2
221
- sine_coefficient: -1595
222
- cosine_coefficient: null
223
- - moon_mean_elongation: 4
224
- sun_mean_anomaly: -1
225
- moon_mean_anomaly: -1
226
- moon_argument_of_latitude: 0
227
- sine_coefficient: 1215
228
- cosine_coefficient: -3958
229
- - moon_mean_elongation: 0
230
- sun_mean_anomaly: 0
231
- moon_mean_anomaly: 2
232
- moon_argument_of_latitude: 2
233
- sine_coefficient: -1110
234
- cosine_coefficient: null
235
- - moon_mean_elongation: 3
236
- sun_mean_anomaly: 0
237
- moon_mean_anomaly: -1
238
- moon_argument_of_latitude: 0
239
- sine_coefficient: -892
240
- cosine_coefficient: 3258
241
- - moon_mean_elongation: 2
242
- sun_mean_anomaly: 1
243
- moon_mean_anomaly: 1
244
- moon_argument_of_latitude: 0
245
- sine_coefficient: -810
246
- cosine_coefficient: 2616
247
- - moon_mean_elongation: 4
248
- sun_mean_anomaly: -1
249
- moon_mean_anomaly: -2
250
- moon_argument_of_latitude: 0
251
- sine_coefficient: 759
252
- cosine_coefficient: -1897
253
- - moon_mean_elongation: 0
254
- sun_mean_anomaly: 2
255
- moon_mean_anomaly: -1
256
- moon_argument_of_latitude: 0
257
- sine_coefficient: -713
258
- cosine_coefficient: -2117
259
- - moon_mean_elongation: 2
260
- sun_mean_anomaly: 2
261
- moon_mean_anomaly: -1
262
- moon_argument_of_latitude: 0
263
- sine_coefficient: -700
264
- cosine_coefficient: 2354
265
- - moon_mean_elongation: 2
266
- sun_mean_anomaly: 1
267
- moon_mean_anomaly: -2
268
- moon_argument_of_latitude: 0
269
- sine_coefficient: 691
270
- cosine_coefficient: null
271
- - moon_mean_elongation: 2
272
- sun_mean_anomaly: -1
273
- moon_mean_anomaly: 0
274
- moon_argument_of_latitude: -2
275
- sine_coefficient: 596
276
- cosine_coefficient: null
277
- - moon_mean_elongation: 4
278
- sun_mean_anomaly: 0
279
- moon_mean_anomaly: 1
280
- moon_argument_of_latitude: 0
281
- sine_coefficient: 549
282
- cosine_coefficient: -1423
283
- - moon_mean_elongation: 0
284
- sun_mean_anomaly: 0
285
- moon_mean_anomaly: 4
286
- moon_argument_of_latitude: 0
287
- sine_coefficient: 537
288
- cosine_coefficient: -1117
289
- - moon_mean_elongation: 4
290
- sun_mean_anomaly: -1
291
- moon_mean_anomaly: 0
292
- moon_argument_of_latitude: 0
293
- sine_coefficient: 520
294
- cosine_coefficient: -1571
295
- - moon_mean_elongation: 1
296
- sun_mean_anomaly: 0
297
- moon_mean_anomaly: -2
298
- moon_argument_of_latitude: 0
299
- sine_coefficient: -487
300
- cosine_coefficient: -1739
301
- - moon_mean_elongation: 2
302
- sun_mean_anomaly: 1
303
- moon_mean_anomaly: 0
304
- moon_argument_of_latitude: -2
305
- sine_coefficient: -399
306
- cosine_coefficient: null
307
- - moon_mean_elongation: 0
308
- sun_mean_anomaly: 0
309
- moon_mean_anomaly: 2
310
- moon_argument_of_latitude: -2
311
- sine_coefficient: -381
312
- cosine_coefficient: -4421
313
- - moon_mean_elongation: 1
314
- sun_mean_anomaly: 1
315
- moon_mean_anomaly: 1
316
- moon_argument_of_latitude: 0
317
- sine_coefficient: 351
318
- cosine_coefficient: null
319
- - moon_mean_elongation: 3
320
- sun_mean_anomaly: 0
321
- moon_mean_anomaly: -2
322
- moon_argument_of_latitude: 0
323
- sine_coefficient: -340
324
- cosine_coefficient: null
325
- - moon_mean_elongation: 4
326
- sun_mean_anomaly: 0
327
- moon_mean_anomaly: -3
328
- moon_argument_of_latitude: 0
329
- sine_coefficient: 330
330
- cosine_coefficient: null
331
- - moon_mean_elongation: 2
332
- sun_mean_anomaly: -1
333
- moon_mean_anomaly: 2
334
- moon_argument_of_latitude: 0
335
- sine_coefficient: 327
336
- cosine_coefficient: null
337
- - moon_mean_elongation: 0
338
- sun_mean_anomaly: 2
339
- moon_mean_anomaly: 1
340
- moon_argument_of_latitude: 0
341
- sine_coefficient: -323
342
- cosine_coefficient: 1165
343
- - moon_mean_elongation: 1
344
- sun_mean_anomaly: 1
345
- moon_mean_anomaly: -1
346
- moon_argument_of_latitude: 0
347
- sine_coefficient: 299
348
- cosine_coefficient: null
349
- - moon_mean_elongation: 2
350
- sun_mean_anomaly: 0
351
- moon_mean_anomaly: 3
352
- moon_argument_of_latitude: 0
353
- sine_coefficient: 294
354
- cosine_coefficient: null
355
- - moon_mean_elongation: 2
356
- sun_mean_anomaly: 0
357
- moon_mean_anomaly: -1
358
- moon_argument_of_latitude: -2
359
- sine_coefficient: null
360
- cosine_coefficient: 8752
1
+ - [0, 0, 1, 0, 6288774, -20905355]
2
+ - [2, 0, -1, 0, 1274027, -3699111]
3
+ - [2, 0, 0, 0, 658314, -2955968]
4
+ - [0, 0, 2, 0, 213618, -569925]
5
+ - [0, 1, 0, 0, -185116, 48888]
6
+ - [0, 0, 0, 2, -114332, -3149]
7
+ - [2, 0, -2, 0, 58793, 246158]
8
+ - [2, -1, -1, 0, 57066, -152138]
9
+ - [2, 0, 1, 0, 53322, -170733]
10
+ - [2, -1, 0, 0, 45758, -204586]
11
+ - [0, 1, -1, 0, -40923, -129620]
12
+ - [1, 0, 0, 0, -34720, 108743]
13
+ - [0, 1, 1, 0, -30383, 104755]
14
+ - [2, 0, 0, -2, 15327, 10321]
15
+ - [0, 0, 1, 2, -12528, null]
16
+ - [0, 0, 1, -2, 10980, 79661]
17
+ - [4, 0, -1, 0, 10675, -34782]
18
+ - [0, 0, 3, 0, 10034, -23210]
19
+ - [4, 0, -2, 0, 8548, -21636]
20
+ - [2, 1, -1, 0, -7888, 24208]
21
+ - [2, 1, 0, 0, -6766, 30824]
22
+ - [1, 0, -1, 0, -5163, -8379]
23
+ - [1, 1, 0, 0, 4987, -16675]
24
+ - [2, -1, 1, 0, 4036, -12831]
25
+ - [2, 0, 2, 0, 3994, -10445]
26
+ - [4, 0, 0, 0, 3861, -11650]
27
+ - [2, 0, -3, 0, 3665, 14403]
28
+ - [0, 1, -2, 0, -2689, -7003]
29
+ - [2, 0, -1, 2, -2602, null]
30
+ - [2, -1, -2, 0, 2390, 10056]
31
+ - [1, 0, 1, 0, -2348, 6322]
32
+ - [2, -2, 0, 0, 2236, -9884]
33
+ - [0, 1, 2, 0, -2120, 5751]
34
+ - [0, 2, 0, 0, -2069, null]
35
+ - [2, -2, -1, 0, 2048, -4950]
36
+ - [2, 0, 1, -2, -1773, 4130]
37
+ - [2, 0, 0, 2, -1595, null]
38
+ - [4, -1, -1, 0, 1215, -3958]
39
+ - [0, 0, 2, 2, -1110, null]
40
+ - [3, 0, -1, 0, -892, 3258]
41
+ - [2, 1, 1, 0, -810, 2616]
42
+ - [4, -1, -2, 0, 759, -1897]
43
+ - [0, 2, -1, 0, -713, -2117]
44
+ - [2, 2, -1, 0, -700, 2354]
45
+ - [2, 1, -2, 0, 691, null]
46
+ - [2, -1, 0, -2, 596, null]
47
+ - [4, 0, 1, 0, 549, -1423]
48
+ - [0, 0, 4, 0, 537, -1117]
49
+ - [4, -1, 0, 0, 520, -1571]
50
+ - [1, 0, -2, 0, -487, -1739]
51
+ - [2, 1, 0, -2, -399, null]
52
+ - [0, 0, 2, -2, -381, -4421]
53
+ - [1, 1, 1, 0, 351, null]
54
+ - [3, 0, -2, 0, -340, null]
55
+ - [4, 0, -3, 0, 330, null]
56
+ - [2, -1, 2, 0, 327, null]
57
+ - [0, 2, 1, 0, -323, 1165]
58
+ - [1, 1, -1, 0, 299, null]
59
+ - [2, 0, 3, 0, 294, null]
60
+ - [2, 0, -1, -2, null, 8752]
@@ -40,7 +40,7 @@ module Lunation
40
40
  end
41
41
 
42
42
  def decimal_hours
43
- @decimal_hours ||= decimal_degrees / 15.0
43
+ @decimal_hours ||= decimal_degrees.fdiv(15)
44
44
  end
45
45
 
46
46
  def decimal_minutes
@@ -95,7 +95,9 @@ module Lunation
95
95
 
96
96
  def from_decimal_degrees(decimal_degrees, normalize: true)
97
97
  new(
98
- decimal_degrees: (normalize ? decimal_degrees % 360 : decimal_degrees).round(9),
98
+ decimal_degrees: (
99
+ normalize ? decimal_degrees % 360 : decimal_degrees
100
+ ).round(9),
99
101
  radians: decimal_degrees_to_radians(decimal_degrees, normalize: normalize)
100
102
  )
101
103
  end
@@ -149,7 +151,8 @@ module Lunation
149
151
  end
150
152
 
151
153
  private def decimal_degrees_to_radians(decimal_degrees, normalize: true)
152
- result = (normalize ? decimal_degrees % 360 : decimal_degrees) * Math::PI / 180.0
154
+ result = (normalize ? decimal_degrees % 360 : decimal_degrees) *
155
+ Math::PI / 180.0
153
156
  result.round(9)
154
157
  end
155
158
 
@@ -159,7 +162,7 @@ module Lunation
159
162
  decimal_arcseconds,
160
163
  normalize: true
161
164
  )
162
- result = degrees + arcminutes / 60.0 + decimal_arcseconds / 3600.0
165
+ result = degrees + arcminutes.fdiv(60) + decimal_arcseconds.fdiv(3600)
163
166
  (normalize ? result % 360 : result).round(9)
164
167
  end
165
168
 
@@ -169,7 +172,7 @@ module Lunation
169
172
  decimal_seconds,
170
173
  normalize: true
171
174
  )
172
- result = hours * 15.0 + minutes / 4.0 + decimal_seconds / 240.0
175
+ result = hours * 15.0 + minutes.fdiv(4.0) + decimal_seconds.fdiv(240.0)
173
176
  (normalize ? result % 360 : result).round(9)
174
177
  end
175
178
 
@@ -177,7 +180,7 @@ module Lunation
177
180
  decimal_arcseconds,
178
181
  normalize: true
179
182
  )
180
- result = decimal_arcseconds / 3600.0
183
+ result = decimal_arcseconds.fdiv(3600.0)
181
184
  (normalize ? result % 360 : result).round(9)
182
185
  end
183
186
  end
@@ -2,19 +2,32 @@ module Lunation
2
2
  class Calculation
3
3
  module EarthPositionVSOP87
4
4
  # rubocop:disable Layout/LineLength
5
- PERIODIC_TERMS_B0 = YAML.load_file("config/periodic_terms_earth_position_b0.yml").freeze
6
- PERIODIC_TERMS_B1 = YAML.load_file("config/periodic_terms_earth_position_b1.yml").freeze
7
- PERIODIC_TERMS_L0 = YAML.load_file("config/periodic_terms_earth_position_l0.yml").freeze
8
- PERIODIC_TERMS_L1 = YAML.load_file("config/periodic_terms_earth_position_l1.yml").freeze
9
- PERIODIC_TERMS_L2 = YAML.load_file("config/periodic_terms_earth_position_l2.yml").freeze
10
- PERIODIC_TERMS_L3 = YAML.load_file("config/periodic_terms_earth_position_l3.yml").freeze
11
- PERIODIC_TERMS_L4 = YAML.load_file("config/periodic_terms_earth_position_l4.yml").freeze
12
- PERIODIC_TERMS_L5 = YAML.load_file("config/periodic_terms_earth_position_l5.yml").freeze
13
- PERIODIC_TERMS_R0 = YAML.load_file("config/periodic_terms_earth_position_r0.yml").freeze
14
- PERIODIC_TERMS_R1 = YAML.load_file("config/periodic_terms_earth_position_r1.yml").freeze
15
- PERIODIC_TERMS_R2 = YAML.load_file("config/periodic_terms_earth_position_r2.yml").freeze
16
- PERIODIC_TERMS_R3 = YAML.load_file("config/periodic_terms_earth_position_r3.yml").freeze
17
- PERIODIC_TERMS_R4 = YAML.load_file("config/periodic_terms_earth_position_r4.yml").freeze
5
+ PERIODIC_TERMS_B0_PATH = File.expand_path("../../../config/periodic_terms_earth_position_b0.yml", __dir__).freeze
6
+ PERIODIC_TERMS_B1_PATH = File.expand_path("../../../config/periodic_terms_earth_position_b1.yml", __dir__).freeze
7
+ PERIODIC_TERMS_L0_PATH = File.expand_path("../../../config/periodic_terms_earth_position_l0.yml", __dir__).freeze
8
+ PERIODIC_TERMS_L1_PATH = File.expand_path("../../../config/periodic_terms_earth_position_l1.yml", __dir__).freeze
9
+ PERIODIC_TERMS_L2_PATH = File.expand_path("../../../config/periodic_terms_earth_position_l2.yml", __dir__).freeze
10
+ PERIODIC_TERMS_L3_PATH = File.expand_path("../../../config/periodic_terms_earth_position_l3.yml", __dir__).freeze
11
+ PERIODIC_TERMS_L4_PATH = File.expand_path("../../../config/periodic_terms_earth_position_l4.yml", __dir__).freeze
12
+ PERIODIC_TERMS_L5_PATH = File.expand_path("../../../config/periodic_terms_earth_position_l5.yml", __dir__).freeze
13
+ PERIODIC_TERMS_R0_PATH = File.expand_path("../../../config/periodic_terms_earth_position_r0.yml", __dir__).freeze
14
+ PERIODIC_TERMS_R1_PATH = File.expand_path("../../../config/periodic_terms_earth_position_r1.yml", __dir__).freeze
15
+ PERIODIC_TERMS_R2_PATH = File.expand_path("../../../config/periodic_terms_earth_position_r2.yml", __dir__).freeze
16
+ PERIODIC_TERMS_R3_PATH = File.expand_path("../../../config/periodic_terms_earth_position_r3.yml", __dir__).freeze
17
+ PERIODIC_TERMS_R4_PATH = File.expand_path("../../../config/periodic_terms_earth_position_r4.yml", __dir__).freeze
18
+ PERIODIC_TERMS_B0 = YAML.load_file(PERIODIC_TERMS_B0_PATH).freeze
19
+ PERIODIC_TERMS_B1 = YAML.load_file(PERIODIC_TERMS_B1_PATH).freeze
20
+ PERIODIC_TERMS_L0 = YAML.load_file(PERIODIC_TERMS_L0_PATH).freeze
21
+ PERIODIC_TERMS_L1 = YAML.load_file(PERIODIC_TERMS_L1_PATH).freeze
22
+ PERIODIC_TERMS_L2 = YAML.load_file(PERIODIC_TERMS_L2_PATH).freeze
23
+ PERIODIC_TERMS_L3 = YAML.load_file(PERIODIC_TERMS_L3_PATH).freeze
24
+ PERIODIC_TERMS_L4 = YAML.load_file(PERIODIC_TERMS_L4_PATH).freeze
25
+ PERIODIC_TERMS_L5 = YAML.load_file(PERIODIC_TERMS_L5_PATH).freeze
26
+ PERIODIC_TERMS_R0 = YAML.load_file(PERIODIC_TERMS_R0_PATH).freeze
27
+ PERIODIC_TERMS_R1 = YAML.load_file(PERIODIC_TERMS_R1_PATH).freeze
28
+ PERIODIC_TERMS_R2 = YAML.load_file(PERIODIC_TERMS_R2_PATH).freeze
29
+ PERIODIC_TERMS_R3 = YAML.load_file(PERIODIC_TERMS_R3_PATH).freeze
30
+ PERIODIC_TERMS_R4 = YAML.load_file(PERIODIC_TERMS_R4_PATH).freeze
18
31
  # rubocop:enable Layout/LineLength
19
32
 
20
33
  # (L) Ecliptical longitude of the earth (A.A. p. 219, 32.2)
@@ -45,7 +58,7 @@ module Lunation
45
58
  second_series = reduce_periodic_terms(PERIODIC_TERMS_B1)
46
59
 
47
60
  Angle.from_radians(
48
- (first_series + second_series * time_millennia) / 100_000_000.0,
61
+ (first_series + second_series * time_millennia).fdiv(100_000_000),
49
62
  normalize: false
50
63
  )
51
64
  end
@@ -5,14 +5,15 @@ module Lunation
5
5
  # UNIT: fraction (decimal)
6
6
  def moon_illuminated_fraction
7
7
  @moon_illuminated_fraction ||=
8
- ((1 + moon_phase_angle.cos) / 2.0).round(4)
8
+ (1 + moon_phase_angle.cos).fdiv(2).round(4)
9
9
  end
10
10
 
11
11
  # (i) phase angle of the moon (48.3, A.A. p. 346)
12
12
  # UNIT: Angle
13
13
  def moon_phase_angle
14
14
  @moon_phase_angle ||= begin
15
- numerator = distance_between_earth_and_sun_in_kilometers * moon_elongation_from_sun.sin
15
+ numerator = distance_between_earth_and_sun_in_kilometers *
16
+ moon_elongation_from_sun.sin
16
17
  denominator = distance_between_earth_and_moon -
17
18
  distance_between_earth_and_sun_in_kilometers * moon_elongation_from_sun.cos
18
19
  Angle.from_radians(Math.atan2(numerator, denominator))