// SPDX-License-Identifier: Apache-2.0 ; specs/widgets/golden-gft32.t27 -- the infographic of lesson 26 of the GoldenFloat course (specs/course/goldenfloat.t27) ; Source of truth for public/widgets/golden-gft32/ (gHashTag/trinity): scripts/widget-pages-from-spec.mjs compiles ; this file, checks its constants, evaluates the tests below and writes the page. tool.js is one import of ; ../infographic.js, which draws SAY_TABLE_* as a real and SAY_FLOW_* as an SVG diagram with a ; , black and white, and holds no words of its own. ASCII only (L3), English only (LANG-EN). ; The lesson spec it illustrates: public/t27/files/specs/numeric/gft32.t27. ; phi^2 + 1/phi^2 = 3 | TRINITY module widget_golden_gft32; pub const KIND : str = "widget-tool"; pub const ID : str = "golden-gft32"; pub const TITLE : str = "GoldenFloat 26: GF-T32, twelve trits"; pub const DESCRIPTION : str = "GF-T32 as the spec lays it out, read from gft32.t27. Lesson 26 of the GoldenFloat course."; pub const IMAGE_ALT : str = "A black and white table, GF-T32 as the spec lays it out: Sign, 1 bit, SIGN_BITS; Exponent, 12 trits, EXP_TRITS; Mantissa, 19 bits, MANT_BITS; Offset, 265720, EXP_OFFSET; Non-finite offset, 531440, OFFSET_MAX; Exponent values, 531441, exp_values()."; pub const HOOK : str = "Twelve exponent trits give 531441 values around zero."; pub const CATEGORY : str = "compiler"; pub const DATA_SOURCES : [2]str = ["The lesson spec public/t27/files/specs/numeric/gft32.t27, read when the course was authored; every number in the table is a constant, a test value or arithmetic of that file", "Nothing on this page was measured on hardware or timed; a value written into a test is said to be written in, not computed"]; pub const READS_LOCAL_FILES : bool = false; pub const SENDS_NOTHING : bool = true; ; --- The table ----------------------------------------------------------------------------- pub const SAY_TABLE_CAPTION : str = "GF-T32 as the spec lays it out"; pub const SAY_TABLE_HEAD : [3]str = ["Field", "Value", "Spec constant"]; pub const SAY_TABLE_CELLS : [18]str = ["Sign", "1 bit", "SIGN_BITS", "Exponent", "12 trits", "EXP_TRITS", "Mantissa", "19 bits", "MANT_BITS", "Offset", "265720", "EXP_OFFSET", "Non-finite offset", "531440", "OFFSET_MAX", "Exponent values", "531441", "exp_values()"]; pub const K_TABLE_COLS : u8 = 3; pub const K_TABLE_ROWS : u8 = 6; pub const K_TABLE_CELLS : u16 = 18; ; --- The diagram and the note ---------------------------------------------------------------- pub const SAY_NOTE : str = "gft32.t27 tests 1 + 12 + 19 = 32, E / M = 631 thousandths, and OFFSET_MAX = 2 x EXP_OFFSET."; test the_cells_fill_whole_rows { assert K_TABLE_ROWS * K_TABLE_COLS == K_TABLE_CELLS; } test the_table_has_a_body { assert K_TABLE_ROWS > 0; assert K_TABLE_COLS > 0; }