Document Render Core And API

This commit is contained in:
copecone committed 2026-10-15 16:17:13 +09:00
1 parent 354c42fdd9
commit 8deb64fd4d
22 files changed
+1241 -27

No files matched your search

+11
View File
@@ -2,8 +2,19 @@ using System;
namespace ADOFAIRenderer.Util
{
/// <summary>Conversion of floating-point rates (frame rates) to integer fractions.</summary>
internal static class RationalUtil
{
/// <summary>
/// Best rational approximation Numerator / Denominator of <paramref name="value"/> by continued fraction expansion:
/// the last convergent whose numerator fits in int and whose denominator does not exceed
/// <paramref name="maxDenominator"/>. Exact for values with a short expansion (for example 60 gives 60/1). The sign is
/// carried by the numerator; 0 gives 0/1. A magnitude above int.MaxValue has no valid convergent and gives 1/0.
/// Thread-safe (pure function).
/// </summary>
/// <param name="value">Value to convert, for example a frame rate in frames per second.</param>
/// <param name="maxDenominator">Largest allowed denominator (default 100000000).</param>
/// <returns>Numerator and denominator (positive for magnitudes up to int.MaxValue).</returns>
public static (int Numerator, int Denominator) Double2MaxPrecisionInt(double value,
int maxDenominator = 100000000)
{