Skip to content

Docs reference float types (float8/16/80/128/256/512) and suffixes (f8/f16/f80/f128/f256/f512) that the compiler does not implement #14

@davidfrogley

Description

@davidfrogley

Summary

The float documentation, examples, and TextMate grammar describe eight float types (float8, float16, float32, float64, float80, float128, float256, float512) plus matching literal suffixes. The compiler only implements three names: float32, float64, and float (an alias for float64). Code copied from the docs fails at name resolution or literal parsing.

Compiler reality (source of truth)

Rux/Include/Rux/Type.h:17-50TypeRef::Kind defines exactly two float enumerators plus one alias:

Float32, Float64,
...
Float = Float64,

No Float8 / Float16 / Float80 / Float128 / Float256 / Float512 exist anywhere in the compiler.

Type-name resolution accepts only "float32", "float64", "float":

  • Rux/Source/Hir.cpp:238-240, 703-705
  • Rux/Source/Sema.cpp:478-480, 1024-1025
  • Rux/Source/Lir.cpp:1287-1288

Literal-suffix parsing accepts only f32 and f64:

  • Rux/Source/Hir.cpp:680-681
  • Rux/Source/Sema.cpp:800-801

Repro

let a: float8   = 1.0;     // unknown type
let b: float16  = 1.0;     // unknown type
let c: float80  = 1.0;     // unknown type
let d: float128 = 1.0;     // unknown type
let e: float256 = 1.0;     // unknown type
let f: float512 = 1.0;     // unknown type
let g = 1.0f8;             // unknown suffix
let h = 1.0f16;            // unknown suffix
let i = 1.0f80;            // unknown suffix
let j = 1.0f128;           // unknown suffix
let k = 1.0f256;           // unknown suffix
let l = 1.0f512;           // unknown suffix

All twelve declarations should compile per the docs; none do.

Every doc/asset that needs editing

Web/src/docs/types/float.md

Line-by-line list of mentions:

  • L5 — "spanning from compact 8-bit representations to extended 512-bit precision" (overview claim).
  • L17 — "Rux defines eight distinct float types."
  • L19-28 — types table; rows for float8, float16, float80, float128, float256, float512.
  • L30-38 — ### float8 section + example let w: float8 = 1.5; + warning callout.
  • L40-46 — ### float16 section + example let half: float16 = 0.0625;.
  • L64-70 — ### float80 section + example let precise: float80 = …; (also references float128 fallback).
  • L72-78 — ### float128 section + example let quad: float128 = 1.0f128;.
  • L80-86 — ### float256 section + example let ultra: float256 = 1.0f256;.
  • L88-94 — ### float512 section + example let ext: float512 = 1.0e512.
  • L117 — let c = 1.0f16; in the "select different default" snippet.
  • L118 — let d = 1.0f128; in the same snippet.
  • L150-161 — literal-suffix table; rows f8, f16, f80, f128, f256 (note: f512 is also missing from this table even though float512 is in the type table — internal inconsistency).
  • L165 — let b = 1.0f16;.
  • L166 — let c = 1.0f128;.
  • L193 — let c: float128 = b; in widening example.
  • L196 — widening chain float8 → float16 → float32 → float64 → float80 → float128 → float256 → float512.
  • L205 — let c: float16 = a as float16;.
  • L228 — x.to_float128(); (inside an HTML-commented block, but still wrong).
  • L396-397 — bullets recommending float128+, float8, float16.
  • L481 — perf note "float128, float256, and float512 are software-emulated…".
  • L487-490 — IEEE-754 compliance bullets covering float16, float80, float8 (E4M3), float256, float512.
  • L530 — "Subnormal numbers are supported on all float types ≥ float16."

Web/src/examples/Float.rux

  • L2-3 — float8, float16 declarations.
  • L6-9 — float80, float128, float256, float512 declarations.
  • L17-18 — 3.14f8, 3.14f16 literals.
  • L20-23 — 3.14f80, 3.14f128, 3.14f256, 3.14f512 literals.

(Lines 4-5, 12, 15-16, 19 are correct and should stay.)

Web/.vitepress/grammars/rux.tmLanguage.json

  • L147 — number regex includes nonexistent suffixes: (f8|f16|f32|f80|f64|f128|f256|f512|…)? — should be (f32|f64|…)?.
  • L552 — float type-name regex: \b(float|float8|float16|float32|float64|float80|float128|float256|float512)\b — should be \b(float|float32|float64)\b.

Suggested fix

Trim docs/examples/grammar to match the compiler — float, float32, float64 and suffixes f32, f64 only. If extended-precision floats are on the roadmap, gate those sections behind a "Planned" / "Not yet implemented" callout instead of presenting them as available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions