iers 0.3.0 → 0.3.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/iers/time_scale.rb +28 -2
- data/lib/iers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d3826650e5fd3bcabe029c7a531bd3abd53213b06df36135c254875b8d81db9
|
|
4
|
+
data.tar.gz: b3f444b9b216fefa81776e8ea8d11fd872ce153baea1ae780055c66d0431be64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: db698e6202ba685d7a3c0552c97f2dbe0cce5a76e572c985937a52e824b8375b7d6adc4a823a5e7e10ca73f4d4cfc7ec3d3d5a1639ff8af20d88ddf168180a71
|
|
7
|
+
data.tar.gz: e2646d5321100190836f0c8bbd2978a4a352ece96250b549e4dfe351217b7478dbdac9fa98cba51996099b456b4ef46524ac8daca0360b9dd9c9bc3785c23318
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1 - 2026-09-13
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Reading a date too large or too small for a Float no longer writes to the
|
|
8
|
+
caller's stderr. `Kernel#Float` warns "Integer out of Float range" for such
|
|
9
|
+
a magnitude, and for a Rational whose numerator or denominator has one, so a
|
|
10
|
+
query far outside the data announced itself before being refused. An Integer
|
|
11
|
+
or a Rational is measured and converted directly now, which is quiet, while
|
|
12
|
+
everything else still goes through `Kernel#Float`, which is what refuses a
|
|
13
|
+
String or a Symbol. The values are unchanged: a magnitude past the range of
|
|
14
|
+
a Float was an Infinity before and is one now.
|
|
15
|
+
|
|
3
16
|
## 0.3.0 - 2026-09-06
|
|
4
17
|
|
|
5
18
|
### Fixed
|
data/lib/iers/time_scale.rb
CHANGED
|
@@ -28,9 +28,9 @@ module IERS
|
|
|
28
28
|
# @raise [ArgumentError] if no valid input is provided
|
|
29
29
|
def to_mjd(input = nil, jd: nil, mjd: nil)
|
|
30
30
|
if mjd
|
|
31
|
-
|
|
31
|
+
to_float(mjd)
|
|
32
32
|
elsif jd
|
|
33
|
-
|
|
33
|
+
to_float(jd) - JD_MJD_OFFSET
|
|
34
34
|
elsif input.is_a?(Time)
|
|
35
35
|
input.to_datetime.ajd.to_f - JD_MJD_OFFSET
|
|
36
36
|
elsif input.is_a?(Date)
|
|
@@ -41,5 +41,31 @@ module IERS
|
|
|
41
41
|
"got #{input.inspect}"
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
# A date as a Float, without writing to the caller's stderr on the way.
|
|
46
|
+
#
|
|
47
|
+
# +Kernel#Float+ warns "Integer out of Float range" for a magnitude that
|
|
48
|
+
# does not fit one, and for a Rational whose numerator or denominator does
|
|
49
|
+
# not either, so a date far outside the data announced itself before being
|
|
50
|
+
# refused. An Integer or a Rational is measured first and converted
|
|
51
|
+
# directly, which is quiet; everything else still goes through
|
|
52
|
+
# +Kernel#Float+, which is what refuses a String or a nil.
|
|
53
|
+
#
|
|
54
|
+
# The value is unchanged: a magnitude past the range of a Float was an
|
|
55
|
+
# Infinity before and is one now.
|
|
56
|
+
#
|
|
57
|
+
# @param value [Numeric, String] the date to read
|
|
58
|
+
# @return [Float]
|
|
59
|
+
# @raise [ArgumentError, TypeError] if it is not a number
|
|
60
|
+
def to_float(value)
|
|
61
|
+
case value
|
|
62
|
+
when Float then value
|
|
63
|
+
when Integer, Rational
|
|
64
|
+
return value.to_f unless value.abs > Float::MAX
|
|
65
|
+
|
|
66
|
+
value.negative? ? -Float::INFINITY : Float::INFINITY
|
|
67
|
+
else Float(value)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
44
70
|
end
|
|
45
71
|
end
|
data/lib/iers/version.rb
CHANGED