raz / commit 1cc92bba

commit
1cc92bba0f6ee88111c7458ecc61d032679fb848
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
cfa2bc20
Report 2026-10.23: Math exports bits, fromBits and mul

An F64's bits and back, and the 128-bit product of two U64s, which
rjson needs to read and write reals exactly (Eisel-Lemire, Ryu).

patch · log

5 files changed, +11 -5

doc/raz-lib.md (history) modified +3 -0

@@ -443,6 +443,9 @@
443443 proc acos*(x: F64): F64; (* from 0 to pi *)
444444 proc atan*(x: F64): F64; (* from -pi/2 to pi/2 *)
445445 proc atan2*(y, x: F64): F64; (* the angle of (x, y) from the x axis, from -pi to pi *)
446+proc bits*(x: F64): U64; (* the bits of x, as IEEE 754 lays them out *)
447+proc fromBits*(u: U64): F64; (* the F64 whose bits are u *)
448+proc mul*(a, b: U64): (U64, U64); (* a times b: the low 64 bits of the product, and the high *)
446449 ```
447450
448451 A `Buf`, a `List` and a `Map` take their memory from the allocator

doc/raz.md (history) modified +1 -1

@@ -13,7 +13,7 @@
1313 This report defines the language. It is short on purpose. Whatever it
1414 doesn't allow, raz doesn't have.
1515
16-This is version 2026-10.22 of the report; section 11 says where each
16+This is version 2026-10.23 of the report; section 11 says where each
1717 version's changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose,
1818 for a language anyone can build again. They break programs written
1919 for 2026-10.10 and before: for 2026-10.9, say, the report of compiler

doc/report-history.md (history) modified +3 -0

@@ -125,3 +125,6 @@
125125 `conform/` tests (appendix A); the rest of the library is the standard
126126 library. The report is in two volumes, `doc/raz.md` and `doc/raz-lib.md`,
127127 and its history is here.
128+- **2026-10.23.** `Math` gains `bits` and `fromBits`, an `F64`'s bits
129+ and back, and `mul`, the 128-bit product of two `U64`s, for reading
130+ and writing reals exactly (volume 2).

lib/Math.raz (history) modified +3 -3

@@ -16,14 +16,14 @@
1616 ln2lo = 1.90821492927058770002E-10;
1717
1818 (* The bits of x, and the F64 with bits u. *)
19-proc bits(x: F64): U64;
19+proc bits*(x: F64): U64;
2020 var p: ^U64;
2121 begin
2222 p := ^U64(ADR(x));
2323 return p^;
2424 end;
2525
26-proc fromBits(u: U64): F64;
26+proc fromBits*(u: U64): F64;
2727 var p: ^F64;
2828 begin
2929 p := ^F64(ADR(u));
@@ -360,7 +360,7 @@
360360 end;
361361
362362 (* a times b: the low 64 bits of the product, and the high. *)
363-proc mul(a, b: U64): (U64, U64);
363+proc mul*(a, b: U64): (U64, U64);
364364 code
365365 mov rax, rdi;
366366 mul rsi;

src/Raz.raz (history) modified +1 -1

@@ -29,7 +29,7 @@
2929 import Sys, Out, Version, Files, Fmt, Diag, Scan, Sym, Chunk, X64, Gen, Parse, Link, Elf;
3030
3131 const
32- Report = "2026-10.22"; (* the version of doc/raz.md it follows *)
32+ Report = "2026-10.23"; (* the version of doc/raz.md it follows *)
3333 MemfdCreate = 319; (* the system call *)
3434 MfdCloexec = 1; (* an ELF still executes: the kernel opens it first *)
3535 Execve = 59;