flt 1.5.3 → 1.5.4
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/History.txt +7 -0
- data/lib/flt/num.rb +16 -6
- data/lib/flt/trigonometry.rb +4 -2
- data/lib/flt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 884a9616a37e6a5ff27ccd739aad4ad825b04c89b00fc9ff888111b9e386f96a
|
4
|
+
data.tar.gz: 00f414c95fb04488487b1ffc020b35cc0fa9d0e162ffa8cffd7f9ae76cac936b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80fd95e11624c2e89789a9bd67cb530b9cde332d2f57b21603dfaa78ce43317032bf0aaf40bda33c2783cb2ef53dc381531d5daf1f3815b57b43511fe72f6895
|
7
|
+
data.tar.gz: 3d1c0e0c41a4b71e875eb0e4af7e285049b5775cec8537c7d06a60ef7ad22aed4f6810a99d5b22e3b0211c47881f65137a6e000e43c205f386c08149c7923802
|
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.5.4 2020-04-08
|
2
|
+
|
3
|
+
* Bugfix
|
4
|
+
- Allow scaleb when result is valid, e.g. now these are not invalid results (using float-formats):
|
5
|
+
+ IEEE_binary256.context.minimum_normal.log10
|
6
|
+
+ IEEE_binary256.context.maximum_finite.log10
|
7
|
+
|
1
8
|
== 1.5.3 2020-04-07
|
2
9
|
|
3
10
|
* Bugfix
|
data/lib/flt/num.rb
CHANGED
@@ -2470,21 +2470,25 @@ class Num < Numeric
|
|
2470
2470
|
|
2471
2471
|
# Adds a value to the exponent.
|
2472
2472
|
def scaleb(other, context=nil)
|
2473
|
-
|
2474
2473
|
context = define_context(context)
|
2475
2474
|
other = _convert(other)
|
2476
2475
|
ans = _check_nans(context, other)
|
2477
2476
|
return ans if ans
|
2478
2477
|
return context.exception(InvalidOperation) if other.infinite? || other.exponent != 0
|
2478
|
+
exp_inc = other.to_i
|
2479
2479
|
unless context.exact?
|
2480
2480
|
liminf = -2 * (context.emax + context.precision)
|
2481
2481
|
limsup = 2 * (context.emax + context.precision)
|
2482
|
-
|
2483
|
-
|
2482
|
+
if finite?
|
2483
|
+
# Allow scaling a finite number which is originally out of the range
|
2484
|
+
# of the context if the end result is within it
|
2485
|
+
liminf = [context.etiny - @exp, liminf].min
|
2486
|
+
limsup = [context.etop - @exp, limsup].max
|
2487
|
+
end
|
2488
|
+
return context.exception(InvalidOperation) if !((liminf <= exp_inc) && (exp_inc <= limsup))
|
2484
2489
|
end
|
2485
2490
|
return Num(self) if infinite?
|
2486
|
-
return Num(@sign, @coeff, @exp+
|
2487
|
-
|
2491
|
+
return Num(@sign, @coeff, @exp + exp_inc)._fix(context)
|
2488
2492
|
end
|
2489
2493
|
|
2490
2494
|
# Naive implementation of exponential and logarithm functions; should be replaced
|
@@ -2706,7 +2710,13 @@ class Num < Numeric
|
|
2706
2710
|
@sign*0.0
|
2707
2711
|
else
|
2708
2712
|
f = nil
|
2709
|
-
|
2713
|
+
if num_class.radix == 10
|
2714
|
+
# to_f can emit verbose warnings on overflow/underflow
|
2715
|
+
old_verbose, $VERBOSE = $VERBOSE, nil
|
2716
|
+
# very precise, but slow
|
2717
|
+
f ||= to_s.to_f
|
2718
|
+
$VERBOSE = old_verbose
|
2719
|
+
end
|
2710
2720
|
unless f
|
2711
2721
|
c = @coeff.to_f
|
2712
2722
|
if c.finite?
|
data/lib/flt/trigonometry.rb
CHANGED
@@ -134,8 +134,9 @@ module Flt
|
|
134
134
|
rev_sign = false
|
135
135
|
s = nil
|
136
136
|
num_class.context(self) do |local_context|
|
137
|
-
local_context.precision +=
|
137
|
+
local_context.precision += 2 # extra digits for intermediate steps
|
138
138
|
x,k,pi_2 = local_context.reduce_angle2(x,2)
|
139
|
+
local_context.precision += 2
|
139
140
|
rev_sign = true if k>1
|
140
141
|
if k % 2 == 0
|
141
142
|
x = pi_2 - x
|
@@ -161,9 +162,10 @@ module Flt
|
|
161
162
|
sign = x.sign
|
162
163
|
s = nil
|
163
164
|
num_class.context(self) do |local_context|
|
164
|
-
local_context.precision +=
|
165
|
+
local_context.precision += 2 # extra digits for intermediate steps
|
165
166
|
x = x.copy_sign(+1) if sign<0
|
166
167
|
x,k,pi_2 = local_context.reduce_angle2(x,2)
|
168
|
+
local_context.precision += 2
|
167
169
|
sign = -sign if k>1
|
168
170
|
x = pi_2 - x if k % 2 == 1
|
169
171
|
x = local_context.to_rad(x)
|
data/lib/flt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Goizueta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|