feat(lang): float and double types with ordinary operators
`float` (32-bit) and `double` (64-bit) with + - * / %, comparisons and unary minus. Decimal literals take their type from context and stay `fixed` elsewhere; int and long promote implicitly (LUDIC_WARN_FLOAT_PROMOTE=1 lists every promotion). float(), double(), int(), long() and fixed() convert; floats(n)/doubles(n) buffers; float fields, globals, constants and parameters; Math.* computes in float for float arguments; string/print write the shortest round-tripping decimal; float_bits/float_from_bits expose the bits. @deterministic code may not use floats. The f_* runtime helpers stay as they are. Editors know the new type words; the JetBrains plugin is 1.5.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f92d7f89c6
commit
e010c2cecc
40 changed files with 67726 additions and 57272 deletions
11
changes/float-types.md
Normal file
11
changes/float-types.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
bump: minor
|
||||
type: feat
|
||||
`float` and `double`: IEEE floating point with ordinary operators, so renderer math reads
|
||||
`a * b + c` instead of `f_add(f_mul(a, b), c)`.
|
||||
- Decimal literals take their type from context (`let s: float = 0.1` is exactly 0.1), and
|
||||
stay `fixed` elsewhere, so existing programs keep their meaning.
|
||||
- `int`/`long` promote; `float(x)`, `double(x)`, `int(x)`, `long(x)` and `fixed(x)` convert.
|
||||
- `floats(n)` / `doubles(n)` buffers; float fields, globals, constants and parameters.
|
||||
- `Math.*` computes in float when given one; `string`/`print`/interpolation write the
|
||||
shortest round-tripping decimal; `float_bits` / `float_from_bits` expose the IEEE pattern.
|
||||
- `@deterministic` code may not use floats (it is now checked).
|
||||
|
|
@ -19,5 +19,5 @@ The JetBrains plugin covers much more of the IDE:
|
|||
package banner has script shortcuts, and Tools | Ludic | Run Script… lists them all.
|
||||
- The toolchain's and the project's packages are listed under External Libraries.
|
||||
- The Structure view, parameter info and code-block navigation now come from `ludic-lsp`.
|
||||
- The plugin is now 1.4.0 and requires IntelliJ Platform 2024.2 or newer and LSP4IJ 0.21.
|
||||
- The plugin is now 1.5.0 and requires IntelliJ Platform 2024.2 or newer and LSP4IJ 0.21.
|
||||
- Fixed: Enter no longer inserts an extra `}`, and Comment Line no longer writes two spaces.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue