float-formats 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/History.txt +8 -2
- data/README.md +47 -39
- data/Rakefile +2 -0
- data/float-formats.gemspec +4 -5
- data/lib/float-formats/classes.rb +7 -2
- data/lib/float-formats/formats.rb +47 -2
- data/lib/float-formats/version.rb +1 -1
- metadata +16 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a6026d216573d6d4bc1bae38fe5495a26424fb09e306a6ee2abc9d111bc40b0a
|
4
|
+
data.tar.gz: 8dd5a8805026744cf00d40c0b0acbbf06d797b2229de77aacdc10b2e2ebb71e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c9aa4fad90095a7f07ca48d8dc96c1ab0a64e80e57a343a69ae50bb6a65b8aa28e53c71e851d7f6ea809fa2b20206b1c3f847a59efe0908c28976a999eda8a
|
7
|
+
data.tar.gz: 0e49f3bb72c6b21d2ec3c402a175464e8044cae267fcd3d2fcbe45f6536cb472970d2cd18e4a40879cd39012f9195f257eff6ade872898d0f082842d4f68c708
|
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.4.0 2020-04-07
|
2
|
+
|
3
|
+
* New formats: BFLOAT16, MSFP8, MSFP9, MSFP10, MSFP11, KHRONOS_VULKAN_UNSIGNED10, KHRONOS_VULKAN_UNSIGNED11
|
4
|
+
* New aliases: MBF_EXTENDEND, HFP_SINGLE, HFP_DOUBLE, HFP_EXTENDED
|
5
|
+
# Development dependencies updated
|
6
|
+
|
1
7
|
== 0.3.0 2015-04-05
|
2
8
|
|
3
9
|
* Nio dependency replaced by Numerals
|
@@ -10,7 +16,7 @@
|
|
10
16
|
== 0.2.0 2009-08-06
|
11
17
|
|
12
18
|
* New redefined interface
|
13
|
-
* The sign in
|
19
|
+
* The sign in split form (sign, significand, exponent) now
|
14
20
|
have the sign as an integer +1,-1 rather than using the
|
15
21
|
internal representation (0, 1, etc.)
|
16
22
|
* Arithmetic is possible on FP values
|
@@ -26,7 +32,7 @@
|
|
26
32
|
* Allow non-bcd values in fields of BCD formats by passing
|
27
33
|
hex values as Strings; allow such values to be used for
|
28
34
|
nan/infinity exponents.
|
29
|
-
* Nio 0.2.1 is now
|
35
|
+
* Nio 0.2.1 is now required
|
30
36
|
* Handle special values (Infinities and NaN) in #from_fmt, #from_number
|
31
37
|
* Add ulp methods to Value and FP classes and to Float
|
32
38
|
* Bug fixes
|
data/README.md
CHANGED
@@ -1,15 +1,18 @@
|
|
1
|
-
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/float-formats.svg)](http://badge.fury.io/rb/float-formats)
|
2
|
+
[![Build Status](https://travis-ci.org/jgoizueta/float-formats.svg)](https://travis-ci.org/jgoizueta/float-formats)
|
3
|
+
|
4
|
+
# Introduction
|
2
5
|
|
3
6
|
Float-Formats is a Ruby package with methods to handle diverse floating-point formats.
|
4
7
|
These are some of the things that can be done with it:
|
5
8
|
|
6
|
-
*
|
9
|
+
* Encoding and decoding numerical values in specific floating point representations.
|
7
10
|
* Conversion of floating-point data between different formats.
|
8
11
|
* Obtaining properties of floating-point formats (ranges, precision, etc.)
|
9
12
|
* Exploring and learning about floating point representations.
|
10
13
|
* Definition and testing of new floating-point formats.
|
11
14
|
|
12
|
-
#Installation
|
15
|
+
# Installation
|
13
16
|
|
14
17
|
To install the gem manually:
|
15
18
|
|
@@ -19,11 +22,11 @@ You can find the code in GitHub:
|
|
19
22
|
|
20
23
|
* http://github.com/jgoizueta/float-formats/
|
21
24
|
|
22
|
-
#Predefined formats
|
25
|
+
# Predefined formats
|
23
26
|
|
24
27
|
A number of common formats are defined as constants in the Flt module:
|
25
28
|
|
26
|
-
##IEEE 754-2008
|
29
|
+
## IEEE 754-2008
|
27
30
|
|
28
31
|
**Binary** floating point representations in little endian order:
|
29
32
|
|
@@ -44,7 +47,7 @@ A number of common formats are defined as constants in the Flt module:
|
|
44
47
|
Others can be defined with IEEE.interchange_binary and IEEE.interchange_decimal
|
45
48
|
(see the IEEE module).
|
46
49
|
|
47
|
-
##Legacy
|
50
|
+
## Legacy
|
48
51
|
|
49
52
|
Formats of historical interest, some of which are found
|
50
53
|
in file formats still in use.
|
@@ -69,13 +72,17 @@ Borland Pascal: (BORLAND48).
|
|
69
72
|
Formats used in the Intel 8051 by the C51 compiler:
|
70
73
|
(C51_BCD_FLOAT, C51_BCD_DOUBLE and C51_BCD_LONG_DOUBLE).
|
71
74
|
|
72
|
-
|
75
|
+
**Minifloats**:
|
76
|
+
AI Formats: (BFLOAT16, MSFP8, MSFP9, MSFP10, MSFP11)
|
77
|
+
Khronos Vulkan unsigned formats: (KHRONOS_VULKAN_UNSIGNED10, KHRONOS_VULKAN_UNSIGNED11)
|
78
|
+
|
79
|
+
## Calculators
|
73
80
|
|
74
81
|
Formats used in HP RPL calculators: (RPL, RPL_X),
|
75
82
|
HP-71B formats (HP71B, HP71B_X)
|
76
83
|
and classic HP 10 digit calculators: (HP_CLASSIC).
|
77
84
|
|
78
|
-
#Using the pre-defined formats
|
85
|
+
# Using the pre-defined formats
|
79
86
|
|
80
87
|
require 'rubygems'
|
81
88
|
require 'float-formats'
|
@@ -111,7 +118,7 @@ Minimum and maximum decimal exponents:
|
|
111
118
|
puts IEEE_binary32.decimal_min_exp # -> -37
|
112
119
|
puts IEEE_binary32.decimal_max_exp # -> 38
|
113
120
|
|
114
|
-
##Encode and decode numbers
|
121
|
+
## Encode and decode numbers
|
115
122
|
|
116
123
|
For each floating-point format class there is a constructor method with the same
|
117
124
|
name which can build a floating-point value from a variety of parameters:
|
@@ -119,7 +126,7 @@ name which can build a floating-point value from a variety of parameters:
|
|
119
126
|
* Using three integers:
|
120
127
|
the sign (+1 for +, -1 for -), the significand (coefficient or mantissa)
|
121
128
|
and the exponent.
|
122
|
-
* From a text numeral (with an optional
|
129
|
+
* From a text numeral (with an optional `Numerals` format specifier)
|
123
130
|
* From a number : converts a numerical value
|
124
131
|
to a floating point representation.
|
125
132
|
|
@@ -148,24 +155,24 @@ Examples:
|
|
148
155
|
puts v.to_bits # -> 00111111111110111100110011001100110011001100110011001100110011001100110011001101
|
149
156
|
puts v.to_bits_text(16) # -> 3ffbcccccccccccccccd
|
150
157
|
|
151
|
-
##Special values:
|
158
|
+
## Special values:
|
152
159
|
|
153
160
|
Let's show the decimal expression of some interesting values using
|
154
161
|
3 significative digits:
|
155
162
|
|
156
|
-
fmt =
|
157
|
-
puts IEEE_SINGLE.min_value.to_text(fmt) # ->
|
158
|
-
puts IEEE_SINGLE.min_normalized_value.to_text(fmt) # -> 1.
|
159
|
-
puts IEEE_SINGLE.max_value.to_text(fmt) # -> 3.
|
160
|
-
puts IEEE_SINGLE.epsilon.to_text(fmt) # -> 1.
|
163
|
+
fmt = Numerals::Format[mode: :general, rounding: [precision: 3]]
|
164
|
+
puts IEEE_SINGLE.min_value.to_text(fmt) # -> 1e-45
|
165
|
+
puts IEEE_SINGLE.min_normalized_value.to_text(fmt) # -> 1.18e-38
|
166
|
+
puts IEEE_SINGLE.max_value.to_text(fmt) # -> 3.40e38
|
167
|
+
puts IEEE_SINGLE.epsilon.to_text(fmt) # -> 1.19e-7
|
161
168
|
|
162
|
-
##Convert between formats
|
169
|
+
## Convert between formats
|
163
170
|
|
164
171
|
v = IEEE_EXTENDED.from_text('1.1')
|
165
172
|
v = v.convert_to(IEEE_SINGLE)
|
166
173
|
v = v.convert_to(IEEE_DEC64)
|
167
174
|
|
168
|
-
#Tools for the native floating point format
|
175
|
+
# Tools for the native floating point format
|
169
176
|
|
170
177
|
This is an optional module to perform conversions and manipulate the native Float format.
|
171
178
|
|
@@ -182,7 +189,7 @@ This is an optional module to perform conversions and manipulate the native Floa
|
|
182
189
|
puts float_significant_dec(Float::MAX_D) # -> 2.2250738585072009E-308
|
183
190
|
puts float_significant_dec(Float::MIN_N) # -> 2.2250738585072014E-308
|
184
191
|
|
185
|
-
Together with flt/sugar (from Flt) can be use to explore or work with Floats:
|
192
|
+
Together with flt/sugar (from Flt) can be use to explore or work with Floats:
|
186
193
|
|
187
194
|
require 'flt/sugar'
|
188
195
|
|
@@ -196,7 +203,7 @@ Together with flt/sugar (from Flt) can be use to explore or work with Floats:
|
|
196
203
|
puts float_significant_dec(Float::MIN_D.next_plus) # -> 1.0E-323
|
197
204
|
puts float_significant_dec(Float::MAX_D.next_minus) # -> 2.2250738585072004E-308
|
198
205
|
|
199
|
-
#Defining new formats
|
206
|
+
# Defining new formats
|
200
207
|
|
201
208
|
New formats are defined using one of the classes defined in float-formats/classes.rb
|
202
209
|
and passing the necessary parameters in a hash to the constructor.
|
@@ -218,17 +225,18 @@ the first bit, which will be hidden:
|
|
218
225
|
Now we can encode values in this format, decode values, convet to other
|
219
226
|
formats, query it's range, etc:
|
220
227
|
|
221
|
-
|
222
|
-
puts MY_FP.
|
228
|
+
Numerals::Format[mode: :general, rounding: [precision: 3]]
|
229
|
+
puts MY_FP('0.1').to_bits_text(16) # -> 1EE66666
|
230
|
+
puts MY_FP.max_value.to_text # -> 7.8804e115
|
223
231
|
|
224
232
|
You can look at float-formats/formats.rb to see how the built-in formats
|
225
233
|
are defined.
|
226
234
|
|
227
|
-
#License
|
235
|
+
# License
|
228
236
|
|
229
237
|
This code is free to use under the terms of the MIT license.
|
230
238
|
|
231
|
-
#References
|
239
|
+
# References
|
232
240
|
|
233
241
|
[*Floating Point Representations.* C.B. Silio.](http://www.ece.umd.edu/class/enpm607.S2000/fltngpt.pdf)
|
234
242
|
Description of formats used in UNIVAC 1100, CDC 6600/7600, PDP-11, IEEE754, IBM360/370
|
@@ -236,13 +244,13 @@ This code is free to use under the terms of the MIT license.
|
|
236
244
|
[*Floating-Point Formats.* John Savard.](http://www.quadibloc.com/comp/cp0201.htm)
|
237
245
|
Description of formats used in VAX and PDF-11
|
238
246
|
|
239
|
-
###IEEE754 binary formats
|
247
|
+
### IEEE754 binary formats
|
240
248
|
|
241
249
|
[*IEEE-754 References.* Christopher Vickery.](http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html)
|
242
250
|
|
243
251
|
[*What Every Computer Scientist Should Know About Floating-Point Arithmetic.* David Goldberg.](http://docs.sun.com/source/806-3568/ncg_goldberg.html)
|
244
252
|
|
245
|
-
###DPD/IEEE754r decimal formats
|
253
|
+
### DPD/IEEE754r decimal formats
|
246
254
|
|
247
255
|
[*Decimal Arithmetic Encoding. Strawman 4d.* Mike Cowlishaw.](http://www2.hursley.ibm.com/decimal/decbits.pdf)
|
248
256
|
|
@@ -252,9 +260,9 @@ This code is free to use under the terms of the MIT license.
|
|
252
260
|
|
253
261
|
[*DRAFT Standard for Floating-Point Arithmetic P754.* IEEE.](http://www.validlab.com/754R/drafts/archive/2007-10-05.pdf)
|
254
262
|
|
255
|
-
###HP 10 digits calculators
|
263
|
+
### HP 10 digits calculators
|
256
264
|
|
257
|
-
[*HP CPU and Programming*. David G.Hicks.](http://www.hpmuseum.org/techcpu.htm)
|
265
|
+
[*HP CPU and Programming*. David G.Hicks.](http://www.hpmuseum.org/techcpu.htm)
|
258
266
|
Description of calculator CPUs from the Museum of HP Calculators.
|
259
267
|
|
260
268
|
[*HP 35 ROM step by step.* Jacques Laporte](http://www.jacques-laporte.org/HP35%20ROM.htm)
|
@@ -263,7 +271,7 @@ This code is free to use under the terms of the MIT license.
|
|
263
271
|
*Scientific Pocket Calculator Extends Range of Built-In Functions.* Eric A. Evett, Paul J. McClellan, Joseph P. Tanzini.
|
264
272
|
Hewlett Packard Journal 1983-05 pgs 27-28. Describes format used in HP-15C.
|
265
273
|
|
266
|
-
###HP 12 digits calculators
|
274
|
+
### HP 12 digits calculators
|
267
275
|
|
268
276
|
*Software Internal Design Specification Volume I For the HP-71*. Hewlett Packard.
|
269
277
|
Available from http://www.hpmuseum.org/cd/cddesc.htm
|
@@ -272,30 +280,30 @@ This code is free to use under the terms of the MIT license.
|
|
272
280
|
Excerpted from *RPL: A Mathematical Control Language*. by W. C. Wickes.
|
273
281
|
Available at http://www.hpcalc.org/details.php?id=1743
|
274
282
|
|
275
|
-
###HP-3000
|
283
|
+
### HP-3000
|
276
284
|
|
277
285
|
*A Pocket Calculator for Computer Science Professionals.* Eric A. Evett.
|
278
286
|
Hewlett Packard Journal 1983-05 pg 37. Describes format used in HP-3000
|
279
287
|
|
280
|
-
###IBM
|
288
|
+
### IBM
|
281
289
|
|
282
290
|
[*IBM Floating Point Architecture.* Wikipedia.](http://en.wikipedia.org/wiki/IBM_Floating_Point_Architecture)
|
283
291
|
|
284
292
|
[*The IBM eServer z990 floating-point unit*. G. Gerwig, H. Wetter, E. M. Schwarz, J. Haess, C. A. Krygowski, B. M. Fleischer and M. Kroener.](http://www.research.ibm.com/journal/rd/483/gerwig.html)
|
285
293
|
|
286
|
-
###MBF
|
294
|
+
### MBF
|
287
295
|
|
288
296
|
[*Microsoft Knowledbase Article 35826*](http://support.microsoft.com/?scid=kb%3Ben-us%3B35826&x=17&y=12)
|
289
297
|
|
290
298
|
[*Microsoft MBF2IEEE library*](http://download.microsoft.com/download/vb30/install/1/win98/en-us/mbf2ieee.exe)
|
291
299
|
|
292
|
-
###Borland
|
300
|
+
### Borland
|
293
301
|
|
294
302
|
*An Overview of Floating Point Numbers.* Borland Developer Support Staff
|
295
303
|
|
296
304
|
[*Pascal Floating-Point Page.* J R Stockton.](http://www.merlyn.demon.co.uk/pas-real.htm)
|
297
305
|
|
298
|
-
###8-bit micros
|
306
|
+
### 8-bit micros
|
299
307
|
|
300
308
|
This is the MS Basic format (BASIC09 for TRS-80 Color Computer, Dragon),
|
301
309
|
also used in the Sinclair Spectrum.
|
@@ -306,26 +314,26 @@ also used in the Sinclair Spectrum.
|
|
306
314
|
*Sinclair ZX Spectrum / Basic Programming.*. Steven Vickers.
|
307
315
|
Chapter 24. http://www.worldofspectrum.org/ZXBasicManual/zxmanchap24.html
|
308
316
|
|
309
|
-
###Apple II
|
317
|
+
### Apple II
|
310
318
|
|
311
319
|
*Floating Point Routines for the 6502* Roy Rankin and Steve Wozniak.
|
312
320
|
Dr. Dobb's Journal, August 1976, pages 17-19.
|
313
321
|
|
314
|
-
###C51
|
322
|
+
### C51
|
315
323
|
|
316
324
|
[*Advanced Development System* Franklin Software, Inc.](http://www.fsinc.com/reference/html/com9anm.htm)
|
317
325
|
|
318
|
-
###CDC6600
|
326
|
+
### CDC6600
|
319
327
|
|
320
328
|
*CONTROL DATA 6400/6500/6600 COMPUTER SYSTEMS Reference Manual*
|
321
329
|
Manuals available at http://bitsavers.org/
|
322
330
|
|
323
|
-
###Cray
|
331
|
+
### Cray
|
324
332
|
|
325
333
|
*CRAY-1 COMPUTER SYSTEM Hardware Reference Manual*
|
326
334
|
See pg 3-20 from 2240004 or pg 4-30 from HR-0808 or pg 4-21 from HP-0032.
|
327
335
|
Manuals available at http://bitsavers.org/
|
328
336
|
|
329
|
-
###Wang 2200
|
337
|
+
### Wang 2200
|
330
338
|
|
331
339
|
[*Internal Floating Point Representation*](http://www.wang2200.org/fp_format.html)
|
data/Rakefile
CHANGED
data/float-formats.gemspec
CHANGED
@@ -18,12 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'flt', "
|
22
|
-
spec.add_dependency 'numerals', "
|
21
|
+
spec.add_dependency 'flt', "~> 1.5"
|
22
|
+
spec.add_dependency 'numerals', "~> 0.3"
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "
|
25
|
-
spec.add_development_dependency "rake"
|
26
|
-
spec.add_development_dependency 'nio', ">= 0.2.4"
|
24
|
+
spec.add_development_dependency "bundler", ">= 1.9"
|
25
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
27
26
|
|
28
27
|
spec.required_ruby_version = '>= 1.9.3'
|
29
28
|
end
|
@@ -477,6 +477,10 @@ class FormatBase
|
|
477
477
|
# attr_accessor
|
478
478
|
end
|
479
479
|
|
480
|
+
def self.normalized?
|
481
|
+
@normalized
|
482
|
+
end
|
483
|
+
|
480
484
|
# compute a power of the radix (base)
|
481
485
|
def self.radix_power(n)
|
482
486
|
radix**n
|
@@ -579,7 +583,8 @@ class FormatBase
|
|
579
583
|
precision: significand_digits,
|
580
584
|
emin: radix_min_exp(:scientific_significand),
|
581
585
|
emax: radix_max_exp(:scientific_significand),
|
582
|
-
rounding
|
586
|
+
rounding: @round || :half_even,
|
587
|
+
normalized: @normalized
|
583
588
|
)
|
584
589
|
end
|
585
590
|
|
@@ -966,7 +971,7 @@ class FormatBase
|
|
966
971
|
|
967
972
|
def read(numeral, exact_input, approximate_simplified)
|
968
973
|
num = num_conversions.read(numeral, exact_input, approximate_simplified)
|
969
|
-
num = num.normalize(@form_class.context) if exact_input
|
974
|
+
num = num.normalize(@form_class.context) if exact_input && @form_class.normalized?
|
970
975
|
@form_class.num(num)
|
971
976
|
end
|
972
977
|
|
@@ -95,7 +95,6 @@ IEEE.interchange_binary :IEEE_binary256_BE, 256, endianness: :big_endian
|
|
95
95
|
IEEE.interchange_binary :IEEE_binary512_BE, 512, endianness: :big_endian
|
96
96
|
IEEE.interchange_binary :IEEE_binary1024_BE, 1024, endianness: :big_endian
|
97
97
|
|
98
|
-
|
99
98
|
# old names
|
100
99
|
IEEE_binaryx = IEEE_binary80
|
101
100
|
IEEE_HALF = IEEE_binary16
|
@@ -130,6 +129,47 @@ IEEE_DEC32 = IEEE_decimal32
|
|
130
129
|
IEEE_DEC64 = IEEE_decimal64
|
131
130
|
IEEE_DEC128 = IEEE_decimal128
|
132
131
|
|
132
|
+
# Brain Floating Point (bfloat16) - Google Brain 16-bit truncated version of IEEE_binary32
|
133
|
+
# Google Cloud TPUs, TensorFlow
|
134
|
+
# Intel AI processors: Nervana NNP-L1000, Xeon processors (AVX-512 BF16 extensions)
|
135
|
+
# Intel FPGAs
|
136
|
+
# ARMv8.6-A
|
137
|
+
# AMD ROCm libraries
|
138
|
+
|
139
|
+
IEEE.binary :BFLOAT16, significand: 7, exponent: 8, endianness: :little_endian
|
140
|
+
IEEE.binary :BFLOAT16_BE, significand: 7, exponent: 8, endianness: :big_endian
|
141
|
+
|
142
|
+
# MSFP8-11 Microsoft Floating Point (Project Brainwave)
|
143
|
+
|
144
|
+
IEEE.binary :MSFP8, significand: 2, exponent: 5, endianness: :little_endian
|
145
|
+
IEEE.binary :MSFP9, significand: 3, exponent: 5, endianness: :little_endian
|
146
|
+
IEEE.binary :MSFP10, significand: 4, exponent: 5, endianness: :little_endian
|
147
|
+
IEEE.binary :MSFP11, significand: 5, exponent: 5, endianness: :little_endian
|
148
|
+
IEEE.binary :MSFP8_BE, significand: 2, exponent: 5, endianness: :big_endian
|
149
|
+
IEEE.binary :MSFP9_BE, significand: 3, exponent: 5, endianness: :big_endian
|
150
|
+
IEEE.binary :MSFP10_BE, significand: 4, exponent: 5, endianness: :big_endian
|
151
|
+
IEEE.binary :MSFP11_BE, significand: 5, exponent: 5, endianness: :big_endian
|
152
|
+
|
153
|
+
# Khronos Vulkan unsigned minifloat formats
|
154
|
+
|
155
|
+
Flt.define BinaryFormat, :KHRONOS_VULKAN_UNSIGNED11,
|
156
|
+
fields:[:significand, 6, :exponent, 5], # :sign 1
|
157
|
+
bias: 2**(5-1)-1, bias_mode: :scientific_significand,
|
158
|
+
hidden_bit: true,
|
159
|
+
endianness: :little_endian,
|
160
|
+
round: :half_even,
|
161
|
+
gradual_underflow: true,
|
162
|
+
infinity: true, nan: true
|
163
|
+
|
164
|
+
Flt.define BinaryFormat, :KHRONOS_VULKAN_UNSIGNED10,
|
165
|
+
fields:[:significand, 5, :exponent, 5], # :sign 1
|
166
|
+
bias: 2**(5-1)-1, bias_mode: :scientific_significand,
|
167
|
+
hidden_bit: true,
|
168
|
+
endianness: :little_endian,
|
169
|
+
round: :half_even,
|
170
|
+
gradual_underflow: true,
|
171
|
+
infinity: true, nan: true
|
172
|
+
|
133
173
|
# Excess 128 used by Microsoft Basic in 8-bit micros, Spectrum, ...
|
134
174
|
|
135
175
|
Flt.define BinaryFormat, :XS128,
|
@@ -137,7 +177,6 @@ Flt.define BinaryFormat, :XS128,
|
|
137
177
|
bias: 128, bias_mode: :fractional_significand,
|
138
178
|
hidden_bit: true,
|
139
179
|
endianness: :big_endian, round: :half_up,
|
140
|
-
endianness: :big_endian,
|
141
180
|
gradual_underflow: false, infinity: false, nan: false
|
142
181
|
|
143
182
|
# HP-3000 excess 256 format, HP-Tandem...
|
@@ -181,6 +220,8 @@ Flt.define :MBF_DOUBLE, BinaryFormat,
|
|
181
220
|
endianness: :little_endian,
|
182
221
|
gradual_underflow: false, infinity: false, nan: false
|
183
222
|
|
223
|
+
MBF_EXTENDEND = XS128
|
224
|
+
|
184
225
|
# DEC formats (VAX)
|
185
226
|
|
186
227
|
Flt.define :VAX_F, BinaryFormat,
|
@@ -313,6 +354,10 @@ Flt.define :IBMX, HexadecimalFormat,
|
|
313
354
|
bias: 8192, bias_mode: :fractional_significand,
|
314
355
|
endianness: :big_endian
|
315
356
|
|
357
|
+
HFP_SINGLE = IBM32
|
358
|
+
HFP_DOUBLE = IBM64
|
359
|
+
HFP_EXTENDED = IBM128
|
360
|
+
|
316
361
|
# Cray-1
|
317
362
|
Flt.define :CRAY, BinaryFormat,
|
318
363
|
fields:[:significand,48,:exponent,15,:sign,1],
|
metadata
CHANGED
@@ -1,85 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: float-formats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Goizueta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flt
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: numerals
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.3.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
33
|
+
version: '0.3'
|
34
|
+
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '0.3'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: bundler
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
47
|
+
version: '1.9'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
54
|
+
version: '1.9'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: rake
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 12.3.3
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 12.3.3
|
83
69
|
description: Floating-Point Formats
|
84
70
|
email:
|
85
71
|
- jgoizueta@gmail.com
|
@@ -130,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
116
|
- !ruby/object:Gem::Version
|
131
117
|
version: '0'
|
132
118
|
requirements: []
|
133
|
-
|
134
|
-
rubygems_version: 2.2.2
|
119
|
+
rubygems_version: 3.1.2
|
135
120
|
signing_key:
|
136
121
|
specification_version: 4
|
137
122
|
summary: Floating-Point Formats
|