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).
| @@ -443,6 +443,9 @@ | ||
| 443 | 443 | proc acos*(x: F64): F64; (* from 0 to pi *) |
| 444 | 444 | proc atan*(x: F64): F64; (* from -pi/2 to pi/2 *) |
| 445 | 445 | 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 *) | |
| 446 | 449 | ``` |
| 447 | 450 | |
| 448 | 451 | A `Buf`, a `List` and a `Map` take their memory from the allocator |
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | This report defines the language. It is short on purpose. Whatever it |
| 14 | 14 | doesn't allow, raz doesn't have. |
| 15 | 15 | |
| 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 | |
| 17 | 17 | version's changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose, |
| 18 | 18 | for a language anyone can build again. They break programs written |
| 19 | 19 | for 2026-10.10 and before: for 2026-10.9, say, the report of compiler |
| @@ -125,3 +125,6 @@ | ||
| 125 | 125 | `conform/` tests (appendix A); the rest of the library is the standard |
| 126 | 126 | library. The report is in two volumes, `doc/raz.md` and `doc/raz-lib.md`, |
| 127 | 127 | 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). |
| @@ -16,14 +16,14 @@ | ||
| 16 | 16 | ln2lo = 1.90821492927058770002E-10; |
| 17 | 17 | |
| 18 | 18 | (* The bits of x, and the F64 with bits u. *) |
| 19 | -proc bits(x: F64): U64; | |
| 19 | +proc bits*(x: F64): U64; | |
| 20 | 20 | var p: ^U64; |
| 21 | 21 | begin |
| 22 | 22 | p := ^U64(ADR(x)); |
| 23 | 23 | return p^; |
| 24 | 24 | end; |
| 25 | 25 | |
| 26 | -proc fromBits(u: U64): F64; | |
| 26 | +proc fromBits*(u: U64): F64; | |
| 27 | 27 | var p: ^F64; |
| 28 | 28 | begin |
| 29 | 29 | p := ^F64(ADR(u)); |
| @@ -360,7 +360,7 @@ | ||
| 360 | 360 | end; |
| 361 | 361 | |
| 362 | 362 | (* 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); | |
| 364 | 364 | code |
| 365 | 365 | mov rax, rdi; |
| 366 | 366 | mul rsi; |
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | import Sys, Out, Version, Files, Fmt, Diag, Scan, Sym, Chunk, X64, Gen, Parse, Link, Elf; |
| 30 | 30 | |
| 31 | 31 | 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 *) | |
| 33 | 33 | MemfdCreate = 319; (* the system call *) |
| 34 | 34 | MfdCloexec = 1; (* an ELF still executes: the kernel opens it first *) |
| 35 | 35 | Execve = 59; |