Skip to content

cs: tcs の f32 数値モデル (T226) へ追従 — double/long を粉砕 - #21

Merged
neguse merged 3 commits into
masterfrom
agent/tcs-f32
Aug 10, 2026
Merged

cs: tcs の f32 数値モデル (T226) へ追従 — double/long を粉砕#21
neguse merged 3 commits into
masterfrom
agent/tcs-f32

Conversation

@neguse

@neguse neguse commented Aug 10, 2026

Copy link
Copy Markdown
Owner

概要

tcs を最新へ更新する (pin は 395c234 + 下記回帰 fix の 9dbe4a0)。T226 で double / long が TinyC# サブセット外になったため、cs-lib と全 30 の C# サンプルを int / float の 2 型へ移行する。

  • doublefloat、実数リテラルに f suffix
  • double を返す System.Math API は (float) cast で受ける (tcs 上流と同じ流儀)
  • xorshift32 (lubx/Rand, 20_audio) は long + 0xFFFFFFFF マスクをやめ、int32 wrap + 算術シフト & 0x7FFF で Haxe と同じ乱数列をビット一致で維持
  • manual 08-csharp.md を同期 (double/long 不可を明記、struct / record struct を使える側へ移動)
  • verify (A6/A7/A8) の C# 編集目印を f suffix 付きソースに同期

tcs は float を f32 丸め・定数畳み込みなしで Lua の実数に出すため、生成 Lua の実行時挙動は不変。

tcs 側の付随 fix (neguse/tcs fix/out-discard-predecl): out _ (bare discard) の local 前宣言が 395c234 で失われ、registry _ENV (playground の snapshot 経路) で undeclared global write エラーになる回帰を修正。

検証

  • check (C# gate 相当): 30/30 警告ゼロ (移行前は tcs 最新で 30/30 fail)
  • build + WARP (d3d12) 実行: 30/30 成功
  • 全 30 サンプルの WARP capture が移行前 (旧 tcs + double) と byte 一致
  • dotnet build (csproj の IDE 型チェック経路) 0 エラー、docs lint / dotnet format whitespace clean
  • tcs 側: 回帰の semantic test を追加 (red → green)、dotnet test 753 passed

🤖 Generated with Claude Code

https://claude.ai/code/session_01T8xmDHVsgKEp6HzS1iRATr

neguse and others added 3 commits August 11, 2026 02:57
tcs 最新 (395c234) で double/long が TinyC# サブセット外になったため、
cs-lib と全 30 サンプルを int/float の 2 型へ移行する:

- double → float、実数リテラルへ f suffix 付与
- double を返す System.Math API は (float) cast で受ける (tcs 上流と同じ流儀)
- xorshift32 (lubx/Rand, 20_audio) は long + 0xFFFFFFFF マスクをやめ、
  int32 wrap + 算術シフト & マスクで Haxe と同じ乱数列をビット一致で維持
- manual 08-csharp を同期 (double/long 不可、struct/record struct 解禁)

tcs は float を Lua へそのまま実数として出す (f32 丸め・定数畳み込みなし)
ため生成 Lua の実行時挙動は不変。全 30 サンプルの WARP capture が移行前と
byte 一致することを確認済み (check/build/実行も 30/30)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T8xmDHVsgKEp6HzS1iRATr
playground の C# snapshot 経路で `tcs registry: write to undeclared
global: _` になる回帰 (web-verify で検出) の修正を取り込む。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T8xmDHVsgKEp6HzS1iRATr
A6/A7/A8 が Flappy17.cs の `velocityY = 3.0;` を探して編集するが、
f suffix 付与で `3.0f` になり marker 不一致で fail していた。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T8xmDHVsgKEp6HzS1iRATr
@neguse
neguse merged commit a3edc53 into master Aug 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant