Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added numpy npy format #183

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions common/ieee754_float/f1.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
meta:
id: f1
title: IEEE 754-like Minifloat
license: Unlicense
xref:
wikidata: Q449270
imports:
- ./ieee754_float
doc: "see the doc for `ieee754_float`."
seq:
- id: sign
type: b1
- id: biased_exponent
type: b4
- id: fraction
type: b3
instances:
value:
pos: 0
type: float(-2, 3, 4, sign, biased_exponent, fraction)
24 changes: 24 additions & 0 deletions common/ieee754_float/f10be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta:
id: f10be
title: IEEE 754 Extended-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q5421900
imports:
- ./ieee754_float
doc: "see the doc for `ieee754_float`."
seq:
- id: sign
type: b1
- id: biased_exponent
type: b15
- id: integer
type: b1
- id: fraction
type: b63
instances:
value:
pos: 0
type: float(16383, 63, 15, sign, biased_exponent, fraction)
38 changes: 38 additions & 0 deletions common/ieee754_float/f10le.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
meta:
id: f10le
title: IEEE 754 Extended-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q5421900
imports:
- ./ieee754_float
doc: |
see the doc for `ieee754_float`.
ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ifffffff eeeeeeee seeeeeee
seq:
- id: frac_lo_lo
type: u4le
- id: frac_lo
type: u2le
- id: frac_mid
type: u1
- id: integer
type: b1
- id: frac_hi
type: b7
- id: biased_exponent_lo
type: u1
- id: sign
type: b1
- id: biased_exponent_hi
type: b7
instances:
fraction:
value: ((frac_hi << 8 | frac_mid) << 16 | frac_lo) << 32 | frac_lo_lo
biased_exponent:
value: biased_exponent_hi << 8 | biased_exponent_lo
value:
pos: 0
type: float(16383, 63, 15, sign, biased_exponent, fraction)
16 changes: 16 additions & 0 deletions common/ieee754_float/f12be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
meta:
id: f12be
title: numpy f12 (based on IEEE 754, effectively f10)
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q5421900
imports:
- ./f10be
doc: "see the doc for `ieee754_float`."
seq:
- id: garbage
type: u2
- id: f10
type: f10be
16 changes: 16 additions & 0 deletions common/ieee754_float/f12le.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
meta:
id: f12le
title: numpy f12 (based on IEEE 754, effectively f10)
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q5421900
imports:
- ./f10le
doc: "see the doc for `ieee754_float`."
seq:
- id: f10
type: f10le
- id: garbage
type: u2
22 changes: 22 additions & 0 deletions common/ieee754_float/f16be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
meta:
id: f16be
title: IEEE 754 Quadruple-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q448573
imports:
- ./ieee754_float
doc: "see the doc for `ieee754_float`."
seq:
- id: sign
type: b1
- id: biased_exponent
type: b15
- id: fraction
type: b112
instances:
value:
pos: 0
type: float(262143, 112, 15, sign, biased_exponent, fraction)
34 changes: 34 additions & 0 deletions common/ieee754_float/f16le.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
meta:
id: f16le
title: IEEE 754 Quadruple-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q448573
imports:
- ./ieee754_float
doc: |
see the doc for `ieee754_float`.
64fl 32fm 16fh 8el s7eh
seq:
- id: frac_lo
type: u8le
- id: frac_mid
type: u4le
- id: frac_hi
type: u2le
- id: biased_exponent_lo
type: u1
- id: sign
type: b1
- id: biased_exponent_hi
type: b7
instances:
fraction:
value: (frac_hi << 32 | frac_mid) << 64 | frac_lo
biased_exponent:
value: biased_exponent_hi << 8 | biased_exponent_lo
value:
pos: 0
type: float(262143, 112, 15, sign, biased_exponent, fraction)
22 changes: 22 additions & 0 deletions common/ieee754_float/f2be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
meta:
id: f2be
title: IEEE 754 Half-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q1994657
imports:
- ./ieee754_float
doc: "see the doc for `ieee754_float`."
seq:
- id: sign
type: b1
- id: biased_exponent
type: b5
- id: fraction
type: b10
instances:
value:
pos: 0
type: float(15, 10, 5, sign, biased_exponent, fraction)
30 changes: 30 additions & 0 deletions common/ieee754_float/f2le.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
meta:
id: f2le
title: IEEE 754 Half-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q1994657
imports:
- ./ieee754_float
doc:
See the doc for `ieee754_float`.
ffffffff seeeeeff
seq:
- id: fraction_lo
type: u1

- id: sign
type: b1
- id: biased_exponent
type: b5
- id: fraction_hi
type: b2

instances:
fraction:
value: fraction_hi<<8 | fraction_lo
value:
pos: 0
type: float(15, 10, 5, sign, biased_exponent, fraction)
22 changes: 22 additions & 0 deletions common/ieee754_float/f32be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
meta:
id: f32be
title: IEEE 754 Octuple-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q25109769
imports:
- ./ieee754_float
doc: "see the doc for `ieee754_float`."
seq:
- id: sign
type: b1
- id: biased_exponent
type: b19
- id: fraction
type: b236
instances:
value:
pos: 0
type: float(262143, 236, 19, sign, biased_exponent, fraction)
40 changes: 40 additions & 0 deletions common/ieee754_float/f32le.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
meta:
id: f32le
title: IEEE 754 Octuple-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q25109769
imports:
- ./ieee754_float
doc: "see the doc for `ieee754_float`."
seq:
- id: frac_lo_lo
type: u4le
- id: frac_lo
type: u8le
- id: frac_med_lo
type: u8le
- id: frac_med_hi
type: u8le
- id: frac_hi
type: u1
- id: biased_exponent_lo
type: b4
- id: frac_hi_hi
type: b4
- id: biased_exponent_me
type: u1
- id: sign
type: b1
- id: biased_exponent_hi
type: b7
instances:
fraction:
value: "((((frac_hi_hi << 8 | frac_hi) << 64 | frac_med_hi) << 64 | frac_med_lo) << 64 | frac_lo) << 32 | frac_lo_lo"
biased_exponent:
value: "( biased_exponent_hi << 8 | biased_exponent_me) << 4 | biased_exponent_lo"
value:
pos: 0
type: float(262143, 236, 19, sign, biased_exponent, fraction)
24 changes: 24 additions & 0 deletions common/ieee754_float/f4be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta:
id: f4be
title: IEEE 754 Single-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q1307173
imports:
- ./ieee754_float
doc: |
YOU LIKELY DON'T NEED THIS. `f4` is implemented in all modern hardware and programming languages natively. It is here mainly for testing purposes.
See the doc for `float` on the drawbacks of this impl.
seq:
- id: sign
type: b1
- id: biased_exponent
type: b8
- id: fraction
type: b23
instances:
value:
pos: 0
type: float(127, 23, 8, sign, biased_exponent, fraction)
33 changes: 33 additions & 0 deletions common/ieee754_float/f4le.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
meta:
id: f4le
title: IEEE 754 Single-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q1307173
imports:
- ./ieee754_float
doc: |
YOU LIKELY DON'T NEED THIS. `f4` is implemented in all modern hardware and programming languages natively. It is here mainly for testing purposes.
See the doc for `float` on the drawbacks of this impl.
ffffffff ffffffff efffffff s eeeeeee
seq:
- id: fraction_lo
type: u2le
- id: biased_exponent_lo
type: b1
- id: fraction_hi
type: b7
- id: sign
type: b1
- id: biased_exponent_hi
type: b7
instances:
biased_exponent:
value: biased_exponent_hi<<1 | biased_exponent_lo.to_i
fraction:
value: fraction_hi<<16 | fraction_lo
value:
pos: 0
type: float(127, 23, 8, sign, biased_exponent, fraction)
24 changes: 24 additions & 0 deletions common/ieee754_float/f8be.ksy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta:
id: f8be
title: IEEE 754 Double-precision floating-point
license: Unlicense
endian: be
xref:
iso: "60559:2011"
wikidata: Q1243369
imports:
- ./ieee754_float
doc: |
YOU LIKELY DON'T NEED THIS. `f8` is implemented in all modern PC CPUs and programming languages natively. It is here mainly for testing purposes.
See the doc for `float` on the drawbacks of this impl.
seq:
- id: sign
type: b1
- id: biased_exponent
type: b11
- id: fraction
type: b52
instances:
value:
pos: 0
type: float(1023, 52, 11, sign, biased_exponent, fraction)
Loading