aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / tests / omegallm / mathref.wl
| 1 | (* tests/omegallm/mathref.wl: Wolfram generator for tests/omegallm/mathref.txt (aien-train#52). |
| 2 | Each line is "e XBITS RBITS" or "l XBITS RBITS" (16 lowercase hex digits). RBITS is the |
| 3 | round-half-even f64 of a 60-digit Exp/Log at the exact f64 XBITS, built bit by bit (subnormal, |
| 4 | overflow and zero cases explicit). Text = lines joined by "\n" plus a final "\n". *) |
| 5 | rb[v_] := Module[{e, m}, |
| 6 | e = Floor[Log2[v]]; |
| 7 | If[e < -1022, Return[Round[v*2^1074]]]; |
| 8 | m = Round[v*2^(52 - e)]; |
| 9 | If[m == 2^53, e = e + 1; m = 2^52]; |
| 10 | If[e > 1023, Return[2047*2^52]]; |
| 11 | (e + 1023)*2^52 + m - 2^52]; |
| 12 | sb[v_] := Which[v == 0, 0, v > 0, rb[v], True, 2^63 + rb[-v]]; |
| 13 | hx[b_] := IntegerString[b, 16, 16]; |
| 14 | xb[x_Real] := sb[SetPrecision[x, Infinity]]; |
| 15 | ex[x_Real] := Module[{r = SetPrecision[x, Infinity]}, "e " <> hx[xb[x]] <> " " <> hx[sb[N[Exp[r], 60]]]]; |
| 16 | lg[x_Real] := Module[{r = SetPrecision[x, Infinity]}, "l " <> hx[xb[x]] <> " " <> hx[If[r == 1, 0, sb[N[Log[r], 60]]]]]; |
| 17 | xe = Join[Table[N[k/1000], {k, -1000, 1000}], Table[N[-745 + i*145478/99900], {i, 0, 999}], |
| 18 | {709.782712893384, 709.7827128933841, 709.79, 710., -708.39, -708.4, -720., -745.13, -745.1332191019412, -745.14, -745.2, -800., 0.5*Log[2.], Log[2.], 1.*^-300, -1.*^-300, 1.*^-17}]; |
| 19 | xl = Join[Table[N[1/2 + k/1000], {k, 0, 1500}], Table[N[10^k], {k, -307, 307}], |
| 20 | {5.*^-324, 1.*^-310, 2.2250738585072014*^-308, 2.225073858507201*^-308, 1.7976931348623157*^308, 1.0000000000000002, 0.9999999999999999, 2.718281828459045}]; |
| 21 | xe = DeleteDuplicates[Select[xe, MachineNumberQ]]; xl = DeleteDuplicates[Select[xl, MachineNumberQ]]; |
| 22 | text = StringRiffle[Join[ex /@ xe, lg /@ xl], "\n"] <> "\n"; |