Skip to content
Astera Technology

Why does a large negative deviation pass a tolerance report?

Apply the supplied limit to magnitude on both sides of zero.

Download complete case notes and answer keys ↓

Prepare the report input

Original synthetic tolerance accepts integer deviations with magnitude at most two. delta<=2 bounds only the positive side and admits −5. BETWEEN -2 AND 2 bounds both sides without an absolute-value calculation; this is an example threshold, not an engineering standard.

Every record and report rule below is original and fictional. Reproduce the setup in a fresh SQLite test database; input previews include every table in this small fixture.

Synthetic input: deviations
iddelta
A-5
B-2
C2
D3
Download editable CSV ↓
Complete CREATE and INSERT fixture
CREATE TABLE deviations(id TEXT PRIMARY KEY,delta INTEGER NOT NULL); INSERT INTO deviations VALUES('A',-5),('B',-2),('C',2),('D',3);

Compare misleading and corrected results

Misleading SELECT: reproduce the defect
SELECT id,delta FROM deviations WHERE delta<=2 ORDER BY id;
Literal misleading result
iddelta
A-5
B-2
C2
Download editable CSV ↓
Corrected SELECT
SELECT id,delta FROM deviations WHERE delta BETWEEN -2 AND 2 ORDER BY id;
Literal corrected result
iddelta
B-2
C2
Download editable CSV ↓

The correction keeps −2 and +2, excludes −5 and +3. Signed raw deviations stay visible in the result.

Check a fresh boundary case

Add zero and the signed 64-bit minimum. Zero qualifies; the minimum is excluded by the lower bound without requiring abs of that extreme integer.

Recreate the original setup in another fresh database, then apply the change and corrected query below. For an empty result, the table displays a labelled empty-result marker rather than a data record.

Boundary change and corrected query
INSERT INTO deviations VALUES('E',0),('F',-9223372036854775808);
SELECT id,delta FROM deviations WHERE delta BETWEEN -2 AND 2 ORDER BY id;
Literal boundary result
iddelta
B-2
C2
E0
Download editable CSV ↓

Does −5 qualify merely because it is below +2?

Show the worked answer

No. Its magnitude is five, above the supplied two-unit limit. The boundary values −2 and +2 both qualify.

Related resources