Definizione.Si definisce insieme dei numeri macchina con $t>0$ cifre significative, base $\beta \geq 2$ e rango $(1,U)$ il sottoinsieme di $\mathbb{R}$ così definito:
$\mathbb{F}(t, \beta, L, U)=\{0\} \cup \{ x \in \mathbb{R} / x = segno(x) \beta^p \sum \limits_{i=1}^t d_i \beta^{-1} \}$ con $0 \leq d_i \leq \beta -1, i=1,2...,t$
$d_1 \neq 0$
$L \leq p \leq U$ dove $L$ intero negativo, $U$ intero positivo.
$x=\pm(.x_1x_2...x_t)\beta^p$
Il calcolatore usa solo un sottoinsieme finito di $\mathbb{R}$ e ogni volta che deve rappresentare un numero $x \in \mathbb{R}$ tale che $x \notin \mathbb{F}$ deve associargli un opportuno $\hat{x}\in \mathbb{F}$ tale che $x \approx \hat{x}$. Se $x \in \mathbb{R}, x\neq0, x\notin \mathbb{F}(t, \beta, L, U)$ si procede nel modo seguente:
- se $p<L \Rightarrow x \rightarrow \hat{x}=0$ e indicazione di underflow
- se $p>U \Rightarrow x \rightarrow$ nessun $\hat{x}$ ("Inf") e indicazione di overflow
- se $L \leq p \leq U$ ma $x \notin \mathbb{F}$ perché le sue cifre con $i>t$ non sono tutte nulle, si procede per troncamento o per arrotondamento:
- se $d_{t+1} < \frac{\beta}{2}$
$\Rightarrow x \rightarrow \hat{x}=trn(x)=\beta^p\sum\limits_{i=1}^td_i\beta^{-1}$
$\Rightarrow \hat{x}=(.d_1d_2...d_t)\beta^p$ - se $d_{t+1} \geq \frac{\beta}{2}$
$\Rightarrow x \rightarrow \hat{x}=arr(x)=trn(x)\beta^{p-t}$
$\Rightarrow \hat{x}=(.d_1d_2...(d_t)+1)\beta^p$
- se $d_{t+1} < \frac{\beta}{2}$
Nessun commento:
Posta un commento