Skip to content

Commit f70b77c

Browse files
committed
Consistent format names
1 parent b87990d commit f70b77c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

docs/source/01-decode.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
{
4646
"data": {
4747
"text/plain": [
48-
"FormatInfo(name='ocp_e5m2', k=8, precision=3, emax=15, has_nz=True, has_infs=True, num_high_nans=3, has_subnormals=True, is_signed=True, is_twos_complement=False)"
48+
"FormatInfo(name='format_info_ocp_e5m2', k=8, precision=3, emax=15, has_nz=True, has_infs=True, num_high_nans=3, has_subnormals=True, is_signed=True, is_twos_complement=False)"
4949
]
5050
},
5151
"execution_count": 2,
@@ -288,6 +288,7 @@
288288
"name": "stdout",
289289
"output_type": "stream",
290290
"text": [
291+
"Format ocp_e4m3 ocp_e5m2 p3109_p3\n",
291292
"Max exponent (emax) 8 15 15\n",
292293
"Exponent bias 7 15 16\n",
293294
"Infinities 0 2 2\n",
@@ -306,6 +307,7 @@
306307
"\n",
307308
"\n",
308309
"for prop, probe in (\n",
310+
" (\"Format \", lambda fi: fi.name.replace(\"format_info_\", \"\")),\n",
309311
" (\"Max exponent (emax) \", lambda fi: fi.emax),\n",
310312
" (\"Exponent bias \", lambda fi: fi.expBias),\n",
311313
" (\"Infinities \", lambda fi: 2 * int(fi.has_infs)),\n",

src/gfloat/formats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def format_info_p3109(precision: int) -> FormatInfo:
160160
if precision < 1 or precision > 7:
161161
raise ValueError(f"P3109 format not defined for p={precision}")
162162

163-
name = f"p3109_p{precision}"
163+
name = f"format_info_p3109_p{precision}"
164164
emax = 2 ** (7 - precision) - 1
165165

166166
return FormatInfo(

0 commit comments

Comments
 (0)