Wire: write doubles and floats with .NET Framework's round-trip digits

The original ran Newtonsoft.Json on .NET Framework, whose "R" format writes
15 significant digits when they read back exactly and 17 otherwise (floats: 7,
else 9). Modern .NET writes the shortest round trip instead, so a value like
-0.066666670143604279 came out as -0.06666667014360428: equal when parsed,
different bytes. Every frame now goes through a converter that repeats the
Framework rule, with Newtonsoft's '.0' suffix and non-finite handling kept.
Goldens that encoded the modern digits are corrected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-09-25 12:44:34 +02:00
parent 82a518dcfb
commit 5a94e1cf0b
7 changed files with 148 additions and 7 deletions

View file

@ -11,7 +11,7 @@ public sealed class RadarTests
{
private const string Stamp = "2026-09-25T08:30:15.1230000Z";
private static string D(double value) => value.ToString("R", CultureInfo.InvariantCulture);
private static string D(double value) => OpenAC.MosswartMassacre.Backend.FrameworkNumberConverter.FrameworkRoundTrip(value);
private static PluginWorldObject Landscape(uint id, string name, PluginObjectClass cls, PluginNavigationPosition position, uint wielder = 0) =>
new(id, 1u, name, cls, 0u, 0u, wielder) { IsLandscape = true, HasPosition = true, Position = position };