SHA256
Document Render Core And API
This commit is contained in:
1 parent
354c42fdd9
commit
8deb64fd4d
22 files changed
+1241
-27
No files matched your search
@@ -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)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user