# Verificare i limiti di schema numerico invece di assumere una costanza completa

> Controlla Int, SmallInt, TinyInt e Number2 con schemi compatti nativi, tra cui valori frazionali, input zero e out-of-range.

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: it
Content-SHA256: 57a72562f250155c9f2a98c21459e0c22373652ced9a1eb9d42bafe20d79132e
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

In `total5@0.0.19`, tutti i tipi numerici compatti entrano nel validatore del numero nativo. **`Int` non garantisce un integratore**: `7.9` è conservato. `Number2` conserva anche questa frazione; non interpretare il suo nome come rotondo a due punti decimali.

`TinyInt` accetta valori da 0 a 255. `SmallInt` accetta da -32767 a 32767; in particolare, -32768 viene rifiutato in questa versione. Questi controlli dei sottotipi impongono limiti ma non richiedono valori interi: `TinyInt` accetta `1.5`. Applica un controllo esplicito con `Number.isInteger()` per identificatori, contatori o quantità che devono essere interi. Queste osservazioni descrivono questa versione e i valori testati, non la semantica delle colonne SQL.

```js controllers/numbers.js
var schema = NEWSCHEMA('NumericBoundaries', '*integer:Int,*small:SmallInt,*tiny:TinyInt,*decimal:Number2');

exports.install = function() {
	ROUTE('POST /numbers/ @json', numbers);
};

function numbers($) {
	var result = schema.transform($.body);
	if (result.error) {
		$.response.status = 400;
		$.json({ error: 'invalid numeric input' });
		return;
	}
	$.json(result.response);
}
```
