Browse Source

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
pull/4022/head
Siegfried Pammer 4 weeks ago
parent
commit
2311b64409
  1. 8
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs

8
ICSharpCode.Decompiler.Tests/TestCases/Pretty/WellKnownConstants.cs

@ -95,6 +95,14 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -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;

Loading…
Cancel
Save