You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,10 +37,11 @@
37
37
- Tests are xUnit (`tests/FixedMathSharp.Tests`). Keep one feature area per test file (e.g., `Vector3d.Tests.cs`, `Bounds/BoundingBox.Tests.cs`).
38
38
- Use helper assertions from `tests/FixedMathSharp.Tests/Support/FixedMathTestHelper.cs` for tolerance/range checks rather than ad-hoc epsilon logic.
39
39
- For deterministic RNG changes, validate same-seed reproducibility and bounds/argument exceptions like in `DeterministicRandom.Tests.cs`.
40
+
- Cyclomatic complexity exceptions are documented in `docs/complexity-exceptions.md`; update that register when touching methods above the review threshold instead of refactoring hot deterministic paths just to lower a metric.
40
41
41
42
## Agent editing guidance
42
43
43
44
- Keep public API shape stable unless the task explicitly requests API changes.
44
45
- Match existing style (regions, XML docs, explicit namespaces, no implicit usings).
45
46
- Make focused edits in the relevant numeric/bounds module and update corresponding tests in the parallel test file.
46
-
- For serialization changes, ensure MemoryPack attributes are correctly applied and roundtrip tests are updated.
47
+
- For serialization changes, ensure MemoryPack attributes are correctly applied and roundtrip tests are updated.
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -194,6 +194,8 @@ FixedMathSharp is optimized for high-performance deterministic calculations:
194
194
195
195
The library is covered by xUnit tests for core arithmetic, vectors, bounds, serialization, and deterministic random behavior. Fuzzy comparisons are used where a tolerance-based check is more appropriate than exact equality.
196
196
197
+
Cyclomatic complexity exceptions are tracked in [`docs/complexity-exceptions.md`](docs/complexity-exceptions.md). The register explains why specific hot-path or fixed-shape methods exceed the review threshold and what should trigger revisiting them.
Complexity exceptions are acceptable when the method is a hot deterministic math path, a direct component-wise value comparison, a fixed-shape assertion helper, or an algorithm where extraction would add indirection without reducing real maintenance risk. These exceptions should be revisited when coverage drops, behavior changes, or the implementation becomes harder to reason about.
|`FixedMathSharp.FluentAssertions`|`FixedAssertionHelpers.AreComponentApproximatelyEqual(Fixed4x4, Fixed4x4, Fixed64)`| 30 | 100% line / 100% branch | Fixed-shape assertion over all matrix components. The explicit checks keep failure location and assertion intent clear. | Assertion diagnostics degrade, matrix shape changes, or repeated assertion logic grows further. |
19
+
|`FixedMathSharp`|`Fixed4x4.Equals(Fixed4x4)`| 30 | 100% line / 100% branch | Direct 4x4 value comparison avoids loops, allocations, and indexer overhead on a hot value type. | Equality semantics change or a generated/source-shared component comparison becomes available without runtime cost. |
20
+
|`FixedMathSharp`|`BoundingSphere.CreateFromPointList(IReadOnlyList<Vector3d>)`| 26 | 98.2% line / 100% branch | Ritter-style bounding sphere construction has fixed selection and expansion branches; keeping it local preserves data flow and avoids extra passes. | More sphere construction modes are added, coverage drops, or the algorithm needs accuracy/performance tuning. |
21
+
|`FixedMathSharp`|`FixedMath.Sin(Fixed64)`| 24 | 100% line / 100% branch | Trigonometric range reduction and approximation are performance-sensitive and deterministic. Extraction would split a compact numeric routine. | Approximation strategy changes or benchmark evidence shows a helper split is neutral or faster. |
22
+
|`FixedMathSharp`|`Fixed64.op_Division(Fixed64, Fixed64)`| 24 | 100% line / 100% branch | Saturating fixed-point division uses low-level bit operations and guarded overflow paths that should remain explicit. | Division semantics change or additional edge cases make the method difficult to audit. |
23
+
|`FixedMathSharp`|`FixedMath.Sqrt(Fixed64)`| 18 | 100% line / 100% branch | Integer square-root logic is branchy by nature and sits on a core deterministic math path. | A simpler algorithm is adopted with equal determinism and performance. |
24
+
|`FixedMathSharp`|`Fixed3x3Extensions.FuzzyEqual(Fixed3x3, Fixed3x3, Fixed64?)`| 18 | 100% line / 100% branch | Component-wise fuzzy equality is intentionally explicit to avoid allocation and preserve inlining. | The matrix equality helpers are generated or centralized without adding runtime overhead. |
25
+
|`FixedMathSharp`|`BoundingSphere.ContainsBoxLike(Vector3d, Vector3d)`| 18 | 100% line / 100% branch | Checks all box-like corners against the sphere; explicit shape avoids temporary corner arrays. | Bounds internals move to a shared corner iterator that is allocation-free. |
26
+
|`FixedMathSharp`|`Fixed4x4.get_Item(int)`| 17 | 100% line / 100% branch | Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. | The matrix layout changes or generated indexer code becomes part of the build. |
27
+
|`FixedMathSharp`|`Fixed4x4.set_Item(int, Fixed64)`| 17 | 100% line / 100% branch | Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. | The matrix layout changes or generated indexer code becomes part of the build. |
28
+
|`FixedMathSharp`|`Fixed64.op_Multiply(Fixed64, Fixed64)`| 16 | 95.6% line / 81.2% branch | Full-width multiply with saturating and round-half-to-even behavior requires explicit guarded paths. | Additional uncovered reachable branches appear, arithmetic semantics change, or benchmarks support a simpler equivalent. |
29
+
|`FixedMathSharp`|`Fixed3x3Extensions.FuzzyEqualAbsolute(Fixed3x3, Fixed3x3, Fixed64)`| 16 | 100% line / 100% branch | Direct component-wise comparison avoids loops and keeps the extension inlinable. | The matrix equality helpers are generated or centralized without adding runtime overhead. |
30
+
|`FixedMathSharp`|`Fixed3x3.Equals(Fixed3x3)`| 16 | 100% line / 100% branch | Direct 3x3 value comparison avoids loops, allocations, and indexer overhead on a hot value type. | Equality semantics change or a generated/source-shared component comparison becomes available without runtime cost. |
31
+
|`FixedMathSharp`|`FixedCurve.Evaluate(Fixed64)`| 16 | 95.2% line / 87.5% branch | Curve evaluation combines clamping, segment search, and interpolation mode dispatch in one readable flow. | More interpolation modes are added or segment lookup becomes a performance bottleneck. |
32
+
|`FixedMathSharp`|`FixedMath.Pow2(Fixed64)`| 16 | 100% line / 100% branch | Fixed-point exponent approximation is compact, deterministic, and performance-sensitive. | Approximation strategy changes or benchmark evidence supports decomposition. |
33
+
|`FixedMathSharp`|`FixedPlane.IntersectsBoxLike(Vector3d, Vector3d)`| 16 | 100% line / 100% branch | Plane-vs-bounds classification is branch-heavy but fixed-shape and allocation-free. | Additional bound shapes are added and a shared allocation-free helper becomes clearer. |
34
+
|`FixedMathSharp`|`BoundingFrustum.Intersects(FixedRay)`| 16 | 100% line / 93.8% branch | Slab-style frustum clipping has unavoidable enter/exit branches and benefits from locality. | More ray/frustum edge cases are discovered or clipping logic is shared elsewhere. |
35
+
|`FixedMathSharp`|`FixedMath.Atan(Fixed64)`| 16 | 100% line / 100% branch | Trigonometric approximation and range handling are deterministic hot-path math. | Approximation strategy changes or benchmark evidence supports decomposition. |
36
+
|`FixedMathSharp`|`FixedMath.Asin(Fixed64)`| 16 | 100% line / 100% branch | Trigonometric domain handling and approximation are deterministic hot-path math. | Approximation strategy changes or benchmark evidence supports decomposition. |
37
+
|`FixedMathSharp`|`FixedMath.Tan(Fixed64)`| 16 | 95.6% line / 100% branch | Tangent delegates through fixed trigonometric identities and guarded edge handling. | New domain behavior is added or uncovered lines become reachable with valid input. |
38
+
|`FixedMathSharp.FluentAssertions`|`FixedAssertionHelpers.AreComponentApproximatelyEqual(Fixed3x3, Fixed3x3, Fixed64)`| 16 | 100% line / 100% branch | Fixed-shape assertion over all matrix components. The explicit checks keep failure location and assertion intent clear. | Assertion diagnostics degrade, matrix shape changes, or repeated assertion logic grows further. |
39
+
|`FixedMathSharp`|`BoundingFrustum.IntersectsFrustum(BoundingFrustum)`| 14 | 91.3% line / 85.7% branch | Separating-axis frustum checks are algorithmically branch-heavy and intentionally avoid allocations. | A robust shared SAT helper can improve clarity without extra allocations or worse benchmarks. |
40
+
|`FixedMathSharp`|`BoundingBox.ClosestPointOnSurface(Vector3d)`| 14 | 100% line / 100% branch | The nearest-face selection is fixed-shape and explicit; helper extraction would not reduce real complexity. | Box surface projection grows beyond nearest-face selection. |
41
+
|`FixedMathSharp`|`Fixed3x3.get_Item(int)`| 12 | 100% line / 100% branch | Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. | The matrix layout changes or generated indexer code becomes part of the build. |
42
+
|`FixedMathSharp`|`Fixed3x3.set_Item(int, Fixed64)`| 12 | 100% line / 100% branch | Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. | The matrix layout changes or generated indexer code becomes part of the build. |
43
+
|`FixedMathSharp`|`BoundingFrustum.Contains(BoundingFrustum)`| 12 | 100% line / 100% branch | Frustum containment needs null handling, equality fast-path, corner checks, and intersection fallback. | Frustum containment semantics change or the corner loop is shared with other bound types. |
44
+
|`FixedMathSharp`|`FixedMath.Acos(Fixed64)`| 12 | 100% line / 100% branch | Trigonometric domain handling and approximation are deterministic hot-path math. | Approximation strategy changes or benchmark evidence supports decomposition. |
45
+
|`FixedMathSharp`|`FixedQuaternion.FromEulerAngles(Fixed64, Fixed64, Fixed64)`| 12 | 100% line / 100% branch | Validates three angles and builds the quaternion in a compact deterministic path. | Angle validation policy changes or Euler conversion variants are added. |
46
+
|`FixedMathSharp`|`FixedRay.Intersects(BoundingSphere)`| 12 | 100% line / 91.7% branch | Ray-sphere intersection has standard geometric early exits and should remain local for clarity and speed. | New ray semantics are added or branch gaps reveal reachable untested behavior. |
47
+
48
+
## Review Notes
49
+
50
+
- Methods at 100% line and branch coverage with direct component-wise logic should usually remain explicit unless a zero-overhead generated approach is introduced.
51
+
- For fixed-point arithmetic and trigonometric routines, prefer benchmark-backed refactors over structural changes made only to reduce the reported complexity number.
52
+
- If a method remains above the complexity threshold and below full branch coverage, prefer adding focused tests for reachable branches before refactoring.
53
+
- Re-run coverage and CRAP analysis after any changes that touch the methods listed above, then update this register.
0 commit comments