Translate Codebase Comments and Log Messages to English

This commit is contained in:
copecone committed 2026-08-21 23:35:02 +09:00
1 parent 111f5cf792
commit 25c38707c3
23 files changed
+915 -921

No files matched your search

+12 -12
View File
@@ -1,4 +1,4 @@
using System;
using System;
namespace ADOFAIRenderer.Util
{
@@ -7,49 +7,49 @@ namespace ADOFAIRenderer.Util
public static (int Numerator, int Denominator) Double2MaxPrecisionInt(double value,
int maxDenominator = 100000000)
{
// 1. 예외 처리 및 부호 판별
// 1. Edge case handling and sign detection
if (value == 0.0) return (0, 1);
var isNegative = value < 0;
var target = Math.Abs(value);
// 2. 스턴-브로코 / 연속분수 경계값 초기화
// 아래 두 행의 분수 (0/1, 1/0) 사이에서 시작하여 타겟에 가까워집니다.
// 2. Stern-Brocot / continued fraction boundary initialization
// Starts between (0/1, 1/0) and converges towards the target value.
long m00 = 0, m01 = 1;
long m10 = 1, m11 = 0;
var x = target;
// int 범위 오버플로우를 방지하면서 반복 처리
// Iterate while preventing integer overflow
while (true)
{
var ai = (long)Math.Floor(x);
// 다음 단계의 분자, 분모 계산 (오버플로우 방지를 위해 long으로 임시 계산)
// Calculate next numerator and denominator (temporarily computed as long to prevent overflow)
var nextNumerator = ai * m10 + m00;
var nextDenominator = ai * m11 + m01;
// int 범위를 벗어나거나, 설정한 최대 분모를 초과하면 이전 단계의 최적값을 반환
// If exceeding integer range or specified maximum denominator, return previous optimal value
if (nextNumerator > int.MaxValue || nextDenominator > maxDenominator)
{
break;
}
// 행렬 업데이트
// Update matrix
m00 = m10; m01 = m11;
m10 = nextNumerator; m11 = nextDenominator;
// 오차가 거의 없으면 (정밀도 도달) 종료
// Terminate if error is negligible (precision limit reached)
if (Math.Abs(x - ai) < 1e-15) break;
// 다음 연속분수 항 준비
// Prepare next continued fraction term
x = 1.0 / (x - ai);
}
// 3. 최종 결정된 int 기반의 분자 분모
// 3. Final determined integer numerator and denominator
var finalNumerator = (int)m10;
var finalDenominator = (int)m11;
// 부호 복원
// Restore sign
if (isNegative) finalNumerator = -finalNumerator;
return (finalNumerator, finalDenominator);