// SPDX-License-Identifier: Apache-2.0 ; specs/course/goldenfloat.t27 -- the t27 course on GoldenFloat: a family of floats split by phi ; Source of truth for apps/website/scripts/course-from-spec.mjs (gHashTag/trinity), which reads ; it the way it reads specs/course/ai-numbers.t27: the constant schema, every test block below, ; every widget in specs/widgets/gallery.t27, every lesson spec compiled clean, the Russian bundle ; named by specs/course/goldenfloat-ru.t27. It writes this course into src/lib/course.generated.ts ; (the page at #/goldenfloat) and a byte-identical copy of this file at public/learn/goldenfloat.t27. ; ASCII only (L3), English only (LANG-EN). The Russian words live in the bundle. ; WHAT THE COURSE IS: course 3 of specs/course/courses.t27, 9 modules of 3 lessons each, on the ; GoldenFloat family of arXiv:2606.05017. Modules 1 and 2 (lessons 1 to 6) give the rule and the ; numbers behind it: E = round((N - 1) / phi^2), the Lucas identities, the self-similarity ; argument, radix economy, phi kept in 16 bits. Modules 3 to 8 (lessons 7 to 23) walk the family ; rung by rung from GF4 to GF1024, with a dot product in GF-T16 after GF16. Lessons 24 to 27 put ; the exponent in trits (GF-T8, GF-T16, GF-T32) and count the decode steps. ; WHAT THE COURSE DOES NOT DO: it says no number of its own. Every lesson quotes only the ; constants and test values of the spec it opens, and arithmetic of them. No lesson claims a ; speed, an accuracy on a model or a result on hardware. Where a test writes its value in rather ; than computing it, the lesson says so. ; WHAT THE BROWSER RUNS: the browser compiler evaluates the constant asserts of a spec, not its ; function tests. Where a lesson quotes a function (max_value of gf8.t27, phi_split of ; phi_ratio.t27), it says what the spec states or does the arithmetic of the constants in the open. ; Where a comment in a spec disagrees with its own code or with the family table, the lesson says so. ; WHY 27: 3 cubed lessons, 9 modules of 3, the size of a TRI-27 word. Changing the shape changes the tests. ; phi^2 + 1/phi^2 = 3 | TRINITY module goldenfloat; pub const KIND : str = "course"; pub const ID : str = "goldenfloat"; pub const SCHEMA_VERSION : u8 = 1; ; The derived files the generator rewrites (relative to apps/website). pub const GENERATED : [2]str = ["src/lib/course.generated.ts", "public/learn/goldenfloat.t27"]; pub const ROUTE : str = "goldenfloat"; ; Share pages: learn/ for course 1, learn// for the next (specs/course/courses.t27). pub const SHARE_PATH : str = "learn/goldenfloat/"; pub const GALLERY : str = "specs/widgets/gallery.t27"; pub const LOCALES : [2]str = ["en", "ru"]; pub const RU_CONTRACT : str = "specs/course/goldenfloat-ru.t27"; ; Lesson marks the reader sets are kept in this browser only, under this key, one key for ; every course. pub const PROGRESS_KEY : str = "t27-course-done"; pub const SENDS_NOTHING : bool = true; ; The paid FPGA training that used to live at #/course. pub const COHORT_ROUTE : str = "fpga-training"; ; A lesson's widget is the page's main stage, so it is drawn taller than a ; gallery card (specs/widgets/gallery.t27 EMBED_* heights are for embeds in posts). pub const TOOL_FRAME_HEIGHT : u16 = 640; pub const PLAYER_FRAME_HEIGHT : u16 = 480; ; --- Words on the page --------------------------------------------------------------------- pub const TITLE : str = "GoldenFloat with t27: one rule, seventeen float widths"; pub const DESCRIPTION : str = "Course 3, 9 modules of 3 lessons, one widget and one t27 spec each: the GoldenFloat family, where one rule built on phi splits every width from 4 to 1024 bits into sign, exponent and mantissa, then the same split with an exponent in trits."; pub const SAY_KICKER : str = "Course"; pub const SAY_LEAD : str = "It follows the AI numbers course. Every lesson opens a table drawn from one spec, next to that spec running in your browser; where a spec's comment and its code disagree, the lesson says which is which."; pub const SAY_SHAPE : str = "9 modules of 3 lessons, 27 cells. A filled cell is a lesson you marked done."; pub const SAY_START : str = "Start lesson 1"; pub const SAY_CONTINUE : str = "Continue"; pub const SAY_MODULE : str = "Module {0}"; pub const SAY_LESSON : str = "Lesson {0} of {1}"; pub const SAY_GOAL : str = "You will learn"; pub const SAY_TRY : str = "Try it"; pub const SAY_ALSO : str = "Also try"; pub const SAY_ALSO_HINT : str = "Each one swaps the widget above."; pub const SAY_BACK_TO_MAIN : str = "Back to this lesson's widget"; pub const SAY_SPEC : str = "Open the lesson's spec in the player"; pub const SAY_OPEN_PAGE : str = "Open the widget on its own page"; pub const SAY_WIDGET_LANG : str = "Widgets keep their own English words: each one lives in its own t27 spec."; pub const SAY_PREV : str = "Previous"; pub const SAY_NEXT : str = "Next"; pub const SAY_ALL : str = "All lessons"; pub const SAY_MARK : str = "Mark as done"; pub const SAY_MARKED : str = "Done"; pub const SAY_PROGRESS : str = "{0} of {1} done"; pub const SAY_PRIVATE : str = "Progress stays in this browser; nothing is sent."; pub const SAY_SOURCE : str = "This course is itself a t27 spec: read it"; pub const SAY_COHORT : str = "Looking for the paid FPGA training? It moved to its own page."; pub const SAY_NOT_FOUND : str = "No lesson has this address."; pub const SAY_OPEN_LESSON : str = "Open the interactive lesson"; pub const SAY_OPEN_COURSE : str = "Open the interactive course"; pub const SAY_SEO_TITLE : str = "{0}: GoldenFloat course, lesson {1} of {2}"; pub const SAY_SHARE : str = "Link to share, with a preview card"; pub const SAY_NEXT_COURSE : str = "Next course"; pub const SAY_PREV_COURSE : str = "Previous course"; ; --- Modules ------------------------------------------------------------------------------- pub const LESSONS_PER_MODULE : u8 = 3; pub const MODULE_COUNT : u8 = 9; pub const MODULE_IDS : [9]str = [ "the-rule-and-its-numbers", "why-phi-why-three", "the-small-rungs", "ten-to-fourteen-bits", "gf16-at-work", "single-to-double", "past-the-double", "widest-then-trits", "trits-and-decode" ]; pub const MODULE_TITLES : [9]str = [ "The rule and its numbers", "Why phi, why three", "The small rungs: GF4 to GF8", "Ten to fourteen bits", "GF16 at work", "GF32 to GF64", "GF96 to GF256", "The widest rungs, then trits", "More trits, then the decode" ]; pub const MODULE_LINES : [9]str = [ "One rule splits every width, the ratio it aims at, and the Lucas numbers behind the 3.", "Why the split is phi, why base three, and how a spec checks GF16 keeps phi.", "GF4, GF6 and GF8, the fewest bits, where rounding to whole bits costs the most.", "GF10, GF12 and GF14, and how the distance from 1 / phi moves as the word grows.", "The primary 16-bit format, a two-term dot product in GF-T16, then GF20 and GF24.", "GF32 beside IEEE single, GF48 with no IEEE twin, GF64 beside IEEE double.", "GF96, GF128 and GF256, where the specs hold the layout with invariants.", "GF512 and GF1024, the two widest rungs, then GF-T8, where the exponent moves to trits.", "GF-T16 and GF-T32, then why fixed fields decode in parallel and a posit does not." ]; ; --- Lessons ------------------------------------------------------------------------------- ; LESSON_WIDGETS names the widget the lesson opens; every one is a gallery id, and no two ; lessons of any course open the same one. LESSON_ALSO lists more gallery ids, comma ; separated, shown as chips that swap the widget. LESSON_SPECS is the spec under ; public/t27/files/ the lesson opens in the player; every lesson names one. pub const LESSON_COUNT : u8 = 27; pub const LESSON_IDS : [27]str = [ "a-float-cut-by-phi", "phi-as-a-ratio", "lucas-numbers-stay-whole", "why-the-split-is-phi", "why-base-three", "phi-in-sixteen-bits", "gf4-four-bits", "gf6-six-bits", "gf8-one-byte", "gf10-ten-bits", "gf12-twelve-bits", "gf14-fourteen-bits", "gf16-the-primary", "two-products-one-sum", "gf24-twenty-four-bits", "gf32-a-single", "gf48-forty-eight-bits", "gf64-a-double", "gf96-ninety-six-bits", "gf128-a-quad", "gf256-two-five-six", "gf512-five-twelve", "gf1024-one-kilobit", "gft8-exponent-in-trits", "gft16-six-trits", "gft32-twelve-trits", "decode-in-one-step" ]; pub const LESSON_MODULES : [27]str = [ "the-rule-and-its-numbers", "the-rule-and-its-numbers", "the-rule-and-its-numbers", "why-phi-why-three", "why-phi-why-three", "why-phi-why-three", "the-small-rungs", "the-small-rungs", "the-small-rungs", "ten-to-fourteen-bits", "ten-to-fourteen-bits", "ten-to-fourteen-bits", "gf16-at-work", "gf16-at-work", "gf16-at-work", "single-to-double", "single-to-double", "single-to-double", "past-the-double", "past-the-double", "past-the-double", "widest-then-trits", "widest-then-trits", "widest-then-trits", "trits-and-decode", "trits-and-decode", "trits-and-decode" ]; pub const LESSON_WIDGETS : [27]str = [ "golden-split", "golden-phi-ratio", "golden-lucas", "golden-split-optimality", "golden-radix-economy", "golden-phi-in-gf16", "golden-gf4", "golden-gf6", "golden-gf8", "golden-gf10", "golden-gf12", "golden-gf14", "golden-gf16", "golden-dot-two", "golden-gf24", "golden-gf32", "golden-gf48", "golden-gf64", "golden-gf96", "golden-gf128", "golden-gf256", "golden-gf512", "golden-gf1024", "golden-gft8", "golden-gft16", "golden-gft32", "golden-decode" ]; pub const LESSON_ALSO : [27]str = [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ]; pub const LESSON_SPECS : [27]str = [ "specs/numeric/goldenfloat_family.t27", "specs/numeric/phi_ratio.t27", "specs/numeric/lucas_accumulator.t27", "specs/math/phi_split_optimality.t27", "specs/math/radix_economy.t27", "specs/numeric/gf_competitive.t27", "specs/numeric/gf4.t27", "specs/numeric/gf6.t27", "specs/numeric/gf8.t27", "specs/numeric/gf10.t27", "specs/numeric/gf12.t27", "specs/numeric/gf14.t27", "specs/numeric/gf16.t27", "specs/ternary/gft_dot2.t27", "specs/numeric/gf24.t27", "specs/numeric/gf32.t27", "specs/numeric/gf48.t27", "specs/numeric/gf64.t27", "specs/numeric/gf96.t27", "specs/numeric/gf128.t27", "specs/numeric/gf256.t27", "specs/numeric/gf512.t27", "specs/numeric/gf1024.t27", "specs/numeric/gft8.t27", "specs/numeric/gft16.t27", "specs/numeric/gft32.t27", "specs/math/gf_competitive.t27" ]; pub const LESSON_TITLES : [27]str = [ "A float cut by phi", "Phi as a ratio", "Lucas numbers stay whole", "Why the split is phi", "Why base three", "Phi in sixteen bits", "GF4: four bits", "GF6: six bits", "GF8: one byte", "GF10: ten bits", "GF12: twelve bits", "GF14: fourteen bits", "GF16: the primary format", "Two products, one sum", "GF20 and GF24", "GF32: a single", "GF48: forty-eight bits", "GF64: a double", "GF96: ninety-six bits", "GF128: a quad", "GF256: two hundred fifty-six bits", "GF512: five hundred twelve bits", "GF1024: one kilobit", "GF-T8: an exponent in trits", "GF-T16: six trits", "GF-T32: twelve trits", "Decode in one step" ]; pub const LESSON_GOALS : [27]str = [ "How one rule, E = round((N - 1) / phi^2), splits every GoldenFloat width into sign, exponent and mantissa.", "How phi_ratio.t27 computes a split for any width, and why the distance from 1 / phi does not shrink at every step.", "Why phi^(2n) + phi^(-2n) is always a whole number, and where the 3 of phi^2 + 1/phi^2 = 3 comes from.", "Two arguments for the phi split, and why the spec says the self-similarity one is not an optimisation.", "Why ln(b) / b peaks at e, how close base 3 comes, and what 27 trits are worth in bits.", "How a spec checks that GF16 keeps phi, phi^2 = phi + 1 and phi^2 + 1/phi^2 = 3 within a stated tolerance.", "The smallest GoldenFloat: one sign bit, one exponent bit, two mantissa bits, bias 0.", "How the rule splits 6 bits into 1 + 2 + 3, and what bias 1 means.", "The one-byte GoldenFloat, 1 + 3 + 4, bias 3, and what its largest and smallest values are.", "How 10 bits split into 1 + 3 + 6, and why its ratio sits 0.118 from 1 / phi.", "The twelve-bit GoldenFloat, 1 + 4 + 7, bias 7, and how a test name can promise more than its assert.", "How 14 bits split into 1 + 5 + 8, a ratio 0.007 from 1 / phi.", "The 16-bit GoldenFloat the family marks primary: 1 + 6 + 9, bias 31, and its special codes.", "How a GF-T16 multiply-accumulate computes a1 * b1 + a2 * b2, the kernel of a matrix multiply.", "The 20- and 24-bit GoldenFloats, 1 + 7 + 12 and 1 + 9 + 14, and the tolerance each spec allows.", "The 32-bit GoldenFloat, 1 + 12 + 19, bias 2047, and the two invariants that compare it with IEEE single.", "How the rule splits 48 bits into 1 + 18 + 29, a width IEEE 754 does not have.", "The 64-bit GoldenFloat, 1 + 24 + 39, beside IEEE double, and how its encoder clamps the exponent.", "Why the spec of a 96-bit float writes its bias as an expression, not a number.", "The 128-bit GoldenFloat, 1 + 49 + 78, and the four invariants that hold its layout.", "How the rule splits 256 bits into 1 + 97 + 158.", "How the rule splits 512 bits into 1 + 195 + 316, a ratio within 0.001 of 1 / phi.", "The widest rung of the family, 1 + 391 + 632, and the test that names it.", "How GF-T keeps the phi split but stores the exponent in balanced trits: 1 + 3 trits + 4 bits.", "How GF-T16 spends 6 exponent trits and 9 mantissa bits, and how many exponent values that gives.", "How GF-T32 spends 12 exponent trits and 19 mantissa bits.", "Why a fixed-field format decodes its fields in parallel and a posit cannot, as the spec counts the steps." ]; pub const LESSON_TEXTS : [27]str = [ "A float spends its bits on three fields: one sign bit, an exponent for range and a mantissa for precision. IEEE 754 picks the split by committee for each width. GoldenFloat uses one rule for all of them: of the N - 1 bits after the sign, round((N - 1) / phi^2) go to the exponent and the rest to the mantissa, so the ratio E / M stays near 1 / phi, about 0.618. The family spec lists 17 widths from GF4 to GF1024, and GF16 is the one it marks primary.", "phi_ratio.t27 sets PHI_RATIO_TARGET to 1 / phi, about 0.618, and its function phi_split works for any width: of the N - 1 bits after the sign, round((N - 1) / phi^2) go to the exponent and the rest to the mantissa. Its table verify_phi_split holds seven widths, and all seven match the family: GF4 splits 1 and 2, GF8 3 and 4, GF12 4 and 7, GF16 6 and 9, GF20 7 and 12, GF24 9 and 14, GF32 12 and 19. The distance from 1 / phi does not fall at every step: GF8 at 0.132 is further than GF4 at 0.118, and GF16 at 0.049 is further than GF12 at 0.047.", "phi is irrational, yet phi^2 + phi^(-2) is exactly 3. That is no accident: phi^k + (-1/phi)^k is the Lucas number L_k, and Lucas numbers are whole: 2, 1, 3, 4, 7, 11, 18 and on, each the sum of the two before it. The spec computes phi^(2n) + phi^(-2n) in f64 and checks it against L_2n for n from 0 to 6, within a tolerance of 1e-9. The 3 of the project motto is L_2.", "phi_split_optimality.t27 gives two arguments and says which is which. One is self-similarity: ask that the exponent is to the mantissa as the mantissa is to both, E / M = M / (E + M). With r = E / M that reads r = 1 / (r + 1), so r^2 + r - 1 = 0 and r = (sqrt(5) - 1) / 2 = 1 / phi. The spec states that this is a defining property, not an optimisation: maximising E * M alone gives an equal split, 7 and 7 for 14 bits. The other is about rounding: round((N - 1) / phi^2) is the whole number nearest the ideal, and verify_7_7_match finds it equal to the published split for 7 of 7 formats.", "Radix economy scores a base b by E(b) = ln(b) / b, and calculus puts its peak at b = e, where E = 1 / e = 0.36788. radix_economy.t27 writes the neighbours in: E(2) = 0.34657 and E(3) = 0.36620. Base 3 reaches 0.995 of the peak, and E(3) / E(2) = 1.0566, an advantage of 5.66 percent; the spec bounds it from below at 0.054, or 5.4 percent, though the invariant is named 54_percent. In range, 27 balanced trits reach 3812798742493, above 2^41 - 1 and under 2^42 - 1, so they need 42 bits. These are arguments about digits, not a timing on a ternary machine.", "A format is only as good as the identities it keeps. gf_competitive.t27 holds five checks: phi stored in GF16 against its true value, phi^2 against phi + 1, the sum phi^2 + 1/phi^2 against 3, a round trip, and a sum of 1000 terms. Read them as they are: the values in each test are written into the test, not produced by an encoder in this spec. The spec checks the arithmetic of the error, with tolerances of 1e-4 and 5e-3.", "GF4 has 4 bits: 1 sign, 1 exponent, 2 mantissa, and its exponent bias is 0. With one exponent bit there are only two scales, 1 and 2, so its 16 codes are coarse. The rule gives E = round(3 / phi^2) = 1, and the ratio E / M is 0.5, a distance of 0.118 from 1 / phi. The AI numbers course opens the same spec for another reason; here it is the lowest rung of the family.", "GF6 has 6 bits: 1 sign, 2 exponent, 3 mantissa. Two exponent bits give codes 0 to 3, and with bias 1 the scale runs from 2^-1 to 2^2. The ratio E / M is 0.667, a distance of 0.049 from 1 / phi. The spec keeps a status line too: the bias is not derived from the closed form, it is chosen per format, and the spec says so.", "gf8.t27 holds one byte: 1 sign, 3 exponent, 4 mantissa bits, and bias 3, which is 2^(3 - 1) - 1. PHI_DISTANCE is 0.132, the furthest of the seven widths phi_ratio.t27 lists, since 3 / 4 = 0.75 overshoots 1 / phi. Its largest value, by max_value, is (1 + 15/16) * 2^(7 - 3) = 31, and its smallest, by min_positive, is 1/16 * 2^-2 = 1/64. The comments above both functions say 15.5 and 0.0625; the code computes 31 and 1/64. MEMORY_RATIO_VS_FP32 is 0.25: four GF8 values fit where one FP32 does.", "GF10 has 10 bits: 1 sign, 3 exponent, 6 mantissa, bias 3. The rule gives E = round(9 / phi^2) = 3, and E / M is 0.5, the same distance of 0.118 from 1 / phi as GF4. Rounding to whole bits is what costs it: at small widths there are few splits to choose from.", "gf12.t27 holds 12 bits: 1 sign, 4 exponent, 7 mantissa bits, and bias 7. Its ratio E / M is 4 / 7 = 0.571, and PHI_DISTANCE is 0.0466. The test that checks it is named gf12_phi_distance_lowest, but it asserts only that the distance is under 0.05, and a comment in the spec calls GF12 the closest of all formats. The family says otherwise: GF14 in the next lesson sits 0.007 from 1 / phi, and GF32 0.0135. Read a test by its assert, not by its name. MEMORY_RATIO_VS_FP32 is 12 / 32 = 0.375.", "GF14 has 14 bits: 1 sign, 5 exponent, 8 mantissa, bias 15. Its ratio E / M is 0.625, only 0.007 from 1 / phi, because 5 and 8 are neighbouring Fibonacci numbers, and the ratio of neighbours approaches 1 / phi.", "GF16 has 16 bits: 1 sign, 6 exponent, 9 mantissa, bias 31. Exponent code 63, all ones, is kept for infinity and NaN, as in IEEE 754. The spec gives every special code a name: 0x0000 and 0x8000 for the two zeros, 0x7E00 and 0xFE00 for the two infinities, 0xFE01 for NaN. A mantissa of 9 bits divides by 512.", "Every layer of a network is a stack of dot products, and a dot product is products added up. gft_dot2.t27 is the smallest one: y = a1 * b1 + a2 * b2 in GF-T16, a 16-bit magnitude of a 7-bit offset and a 9-bit mantissa with bias 40. In that layout 1.0 is code 20480 and 2.0 is code 20992. The spec has two tests: 1 * 1 = 1, and 1 * 1 + 1 * 1 = 2.", "gf20.t27 holds 1 sign, 7 exponent and 12 mantissa bits with bias 63; gf24.t27 holds 1 sign, 9 exponent and 14 mantissa bits with bias 255. The lesson opens gf24.t27, whose PHI_DISTANCE is 0.0248, and its test allows anything under 0.03; MEMORY_RATIO_VS_FP32 is 0.75. GF20 writes its distance as 0.03463, under a test bound of 0.04, while 7 / 12 sits 0.03470 from 1 / phi: the stored constant and the arithmetic differ in the fourth decimal. Between them, both widths keep the ratio within 0.035 of 1 / phi.", "gf32.t27 holds 32 bits: 1 sign, 12 exponent, 19 mantissa bits, and bias 2047. IEEE single spends 8 bits on the exponent and 23 on the mantissa; the spec keeps two invariants that say so, EXP_BITS > 8 and MANT_BITS < 23, so GF32 trades precision for range at the same width. Its PHI_DISTANCE is 0.0135, under the test bound of 0.015, and MEMORY_RATIO_VS_FP32 is 1. A comment calls GF32 second after GF12; by the distances in this course it is closer than GF12, and GF14 is closer still.", "GF48 has 48 bits: 1 sign, 18 exponent, 29 mantissa, bias 131071. IEEE 754 has no 48-bit format; the rule makes one the same way it makes all the others. Its ratio E / M is 0.621, 0.003 from 1 / phi.", "GF64 has 64 bits: 1 sign, 24 exponent, 39 mantissa, bias 8388607. IEEE double spends 11 bits on the exponent and 52 on the mantissa; GF64 trades mantissa for a far wider range. Its spec has an encoder and a decoder: the mantissa divides by 2^39, and the exponent is clamped between 0 and 2^24 - 1.", "GF96 has 96 bits: 1 sign, 36 exponent, 59 mantissa. Its bias, 2^35 - 1, no longer fits the 64-bit integer types the spec uses for small formats, so the spec writes it as the text 2^(36-1) - 1 and checks the layout with invariants instead. The ratio E / M is 0.610.", "GF128 has 128 bits: 1 sign, 49 exponent, 78 mantissa. IEEE quad spends 15 bits on the exponent. The spec holds the layout with four invariants: the fields partition the word, the mantissa and the exponent follow the closed form, and the shifts follow the layout.", "GF256 has 256 bits: 1 sign, 97 exponent, 158 mantissa. The family spec has a test for these counts too. At this width rounding costs little, and the ratio E / M is 0.614, 0.004 from 1 / phi.", "GF512 has 512 bits: 1 sign, 195 exponent, 316 mantissa. Its ratio E / M is 0.617, under 0.001 from 1 / phi. The wider the word, the closer whole bits can come to the target, which is the trend the family table shows.", "GF1024 has 1024 bits: 1 sign, 391 exponent, 632 mantissa. Its ratio E / M is 0.6187, a distance of 0.0006 from 1 / phi, and the family spec has a test that names GF1024 as the format with the smallest phi distance. It is a rung of the family on paper; no hardware in this course computes in it.", "GF-T is GoldenFloat with a ternary exponent. GF-T8 has 1 sign, 3 exponent trits and 4 mantissa bits. Three trits give 27 exponent values, offset 13 makes them balanced around zero, and offset 26 is kept as the one non-finite value. The spec tests the split as E / M in thousandths: 3000 / 4 = 750.", "GF-T16 has 1 sign, 6 exponent trits and 9 mantissa bits. Six trits give 3^6 = 729 exponent values; offset 364 balances them and offset 728 is not finite. The split in thousandths is 6000 / 9 = 666. Its mantissa has the same 9 bits as GF16, so the two differ only in how they store the exponent.", "GF-T32 has 1 sign, 12 exponent trits and 19 mantissa bits. Twelve trits give 3^12 = 531441 exponent values; offset 265720 balances them and offset 531440 is not finite. The split in thousandths is 12000 / 19 = 631. The 19 mantissa bits match GF32 in the family table.", "A posit packs a regime of variable length before its exponent, so a decoder must find where the regime ends before it can read anything else. GF16 and IEEE FP16 keep every field at a fixed position, so all fields decode at once. gf_competitive.t27 counts the steps: 3 for FP16, 6 for POSIT16, 3 for GF16, and marks which can run in parallel. These are counts written into the spec, not a timing measured on hardware." ]; pub const LESSON_TASKS : [27]str = [ "Run the tests of goldenfloat_family.t27 and find the one that counts the family. Then find which format the spec marks primary and the test that says only one is.", "Run the tests of phi_ratio.t27 and find the one that checks GF16 at 6 and 9. Then compute 3 / 4 and 4 / 7 against 0.618 and say which is further.", "Run the tests and read the ladder from n = 0 to n = 6. Then find the invariant that names TRINITY as L_2, and the tolerance the f64 comparison allows.", "Read self_similarity_proof_steps and count its steps. Then find the test that says the AM-GM split differs from the phi split, and the width it uses.", "Divide E_BASE3 by E_BASE2 in radix_economy.t27 by hand. Then find the invariant named 54_percent and say what number it actually asserts.", "Run the tests and find the value each test writes in for phi^2 and for phi + 1. Then find which two tests use the tighter tolerance of 1e-4.", "Find EXP_BIAS and PHI_DISTANCE in gf4.t27, then the invariant that bounds the distance. Open the decode function and find the two scales one exponent bit gives.", "Find BIAS and EXP_MAX in gf6.t27 and check them against 2^(E-1) - 1 and 2^E - 1. Then read PHI_BIAS_STATUS and say what it admits.", "Compute max_value and min_positive of gf8.t27 by hand and compare them with the comments above them. Then decode the code 0b01000000 that the test gf8_phi_distance expects for phi, and say what value it holds.", "Find EM_RATIO and PHI_DIST in gf10.t27. Then compute round(9 / phi^2) yourself and check it against EXP_BITS.", "Find PHI_DISTANCE and the test gf12_phi_distance_lowest in gf12.t27. Then compare the distance with GF14 and GF32 and say what the test name claims that its assert does not.", "Find PHI_DIST in gf14.t27 and compare it with GF10. Then name the next pair of Fibonacci numbers after 5 and 8.", "Find SIGN_MASK, EXP_MASK and MANT_MASK in gf16.t27 and check that together they cover all 16 bits. Then find the code of NaN and say which field makes it not an infinity.", "Find the two tests and decode 20480 and 20992 by hand with value = (1 + mant / 512) * 2^(offset - 40). Then find the line in gft_mul that handles the carry when the product passes 2.", "Find PHI_DISTANCE and EXP_BIAS in gf24.t27 and check the bias against 2^(9 - 1) - 1. Then compute 7 / 12 against 0.618034 and compare it with the constant gf20.t27 stores.", "Find the two invariants of gf32.t27 that compare it with IEEE single. Then check EXP_BIAS against 2^(12 - 1) - 1 and compute 12 / 19.", "Find BIAS and EXP_MAX in gf48.t27 and check them against 2^17 - 1 and 2^18 - 1. Then find the three shift constants and say which field each one places.", "Find EXP_BIAS, EXP_MAX and MANT_DIV in gf64.t27. Then open encode and find where the exponent is clamped.", "Find BIAS_EXPR and EXP_MAX_EXPR in gf96.t27 and compare them with BIAS in gf48.t27. Then read the invariants and say what each one checks.", "Read the four invariants of gf128.t27 and check SIGN_SHIFT and EXP_SHIFT against the field widths by hand.", "Find EM_RATIO and PHI_DIST in gf256.t27. Then in goldenfloat_family.t27 find the test that checks the GF256 bit counts, and check that both specs agree.", "Find PHI_DIST in gf512.t27 and compare it with GF14 and GF48. Then check SIGN_SHIFT and EXP_SHIFT by hand.", "Find PHI_DIST in gf1024.t27. Then in goldenfloat_family.t27 find the test about GF1024 and the function it calls.", "Run the two tests of gft8.t27. Then find exp_values and is_finite and say which offset is not finite.", "Run the two tests of gft16.t27. Then compare MANT_BITS with GF16 and work out the range 729 exponent values cover around zero.", "Run the two tests of gft32.t27 and check 3^12 by hand. Then compare its mantissa with the GF32 row of the family spec.", "Find decode_complexity and the three entries it returns. Then find the invariant that compares the posit with GF16, and say what a timing on hardware would add." ]; ; --- Claims -------------------------------------------------------------------------------- test the_course_is_three_cubed { assert LESSONS_PER_MODULE == 3; assert MODULE_COUNT == 9; assert LESSON_COUNT == 27; assert MODULE_COUNT * LESSONS_PER_MODULE == LESSON_COUNT; assert LESSON_COUNT == 3 * 3 * 3; } test it_starts_with_the_rule_and_ends_with_the_decode { assert MODULE_IDS[0] == "the-rule-and-its-numbers"; assert LESSON_IDS[0] == "a-float-cut-by-phi"; assert LESSON_WIDGETS[0] == "golden-split"; assert LESSON_SPECS[0] == "specs/numeric/goldenfloat_family.t27"; assert LESSON_IDS[26] == "decode-in-one-step"; assert LESSON_MODULES[26] == "trits-and-decode"; assert LESSON_WIDGETS[26] == "golden-decode"; assert LESSON_SPECS[26] == "specs/math/gf_competitive.t27"; } test the_primary_format_is_lesson_thirteen { assert LESSON_IDS[12] == "gf16-the-primary"; assert LESSON_SPECS[12] == "specs/numeric/gf16.t27"; assert LESSON_SPECS[13] == "specs/ternary/gft_dot2.t27"; } test the_trit_exponents_close_the_family { assert LESSON_SPECS[23] == "specs/numeric/gft8.t27"; assert LESSON_SPECS[24] == "specs/numeric/gft16.t27"; assert LESSON_SPECS[25] == "specs/numeric/gft32.t27"; } test every_lesson_opens_its_own_spec { assert LESSON_WIDGETS[1] == "golden-phi-ratio"; assert LESSON_SPECS[1] == "specs/numeric/phi_ratio.t27"; assert LESSON_SPECS[3] == "specs/math/phi_split_optimality.t27"; assert LESSON_SPECS[4] == "specs/math/radix_economy.t27"; assert LESSON_SPECS[8] == "specs/numeric/gf8.t27"; assert LESSON_SPECS[10] == "specs/numeric/gf12.t27"; assert LESSON_SPECS[14] == "specs/numeric/gf24.t27"; assert LESSON_SPECS[15] == "specs/numeric/gf32.t27"; } test the_course_sends_nothing { assert SENDS_NOTHING == true; assert LOCALES[0] == "en"; assert LOCALES[1] == "ru"; } test three_lessons_fill_each_module { assert LESSON_MODULES[0] == MODULE_IDS[0]; assert LESSON_MODULES[2] == MODULE_IDS[0]; assert LESSON_MODULES[3] == MODULE_IDS[1]; assert LESSON_MODULES[12] == MODULE_IDS[4]; assert LESSON_MODULES[14] == MODULE_IDS[4]; assert LESSON_MODULES[24] == MODULE_IDS[8]; assert LESSON_MODULES[26] == MODULE_IDS[8]; }