Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/math-brain/overflow-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ export const computeOverflowDetail = ({
const saturationFlag = saturation === true;

const magnitudeExceedsRange =
rawMagnitudeValue != null && Math.abs(rawMagnitudeValue) > OVERFLOW_LIMIT + OVERFLOW_TOLERANCE;
rawMagnitudeValue != null && Math.abs(rawMagnitudeValue) >= OVERFLOW_LIMIT + OVERFLOW_TOLERANCE;
const directionalExceedsRange =
rawDirectionalBiasValue != null && Math.abs(rawDirectionalBiasValue) > OVERFLOW_LIMIT + OVERFLOW_TOLERANCE;
rawDirectionalBiasValue != null && Math.abs(rawDirectionalBiasValue) >= OVERFLOW_LIMIT + OVERFLOW_TOLERANCE;

const overflowRegistered =
magnitudeClampedFlag ||
Expand Down
13 changes: 13 additions & 0 deletions test/overflow-detail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,17 @@ describe('overflow detail exports', () => {
expect(detail.drivers).toContain('Body 3 ▻ Body 4 Trine');
expect(detail.drivers).not.toContain('');
});

it('registers overflow when raw value is exactly at the tolerance boundary', () => {
const detail = computeOverflowDetail({
rawMagnitude: 5.05,
clampedMagnitude: 5,
rawDirectionalBias: null,
clampedDirectionalBias: null,
aspects: [],
});

expect(detail).not.toBeNull();
expect(detail?.overflowRegistered).toBe(true);
});
});