From 2311b64409ac8141b225d0afb36b5466bb92b999 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 18 Aug 2026 05:27:46 +0200 Subject: [PATCH] Cover the fractions that were not written as fractions The preferred-scale lookup reaches well past the byte-normalization cases it was added for: any value that is exactly n/2^k for a k the old denominator limit could not reach now prints as a fraction, so constants that used to be short exact decimals changed shape. That is the widest-reaching part of the change and nothing pinned it. The added constants are those values, including the unreduced 126 / 1024 that a lowest-terms rewrite would turn into 63 / 512, plus two that must keep their decimal form so the length gate stays covered from both sides. Assisted-by: Claude:claude-opus-5[1m]:Claude Code --- .../TestCases/Pretty/WellKnownConstants.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs index 50c368714..8f1506401 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs @@ -95,6 +95,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty public const double Double_ByteScale = 200.0 / 255.0; public const float Float_KScale = 123f / 1024f; public const float Float_MScale = 123f / 1048576f; + public const float Float_UnitKScale = 1f / 1024f; + public const float Float_SmallKScale = 17f / 1024f; + public const float Float_UnreducedKScale = 126f / 1024f; + public const float Float_ShortBinaryFraction = 13f / 256f; + public const float Float_NearOnePowerOfTwo = 225f / 256f; + public const float Float_TinyPowerOfTwoScale = 1f / 32768f; + public const float Float_NotAPreferredScale = 0.123456f; + public const double Double_NotAPreferredScale = 0.123456789; #if ROSLYN2 && !NET40 public const float Float_PI = MathF.PI;