CS 2734
Computer Organization II
Prior to the laboratory, you should do the following:
double vectornorm(double a[], int n)
{
int i;
double sum;
sum = 0.0;
for (i = 0; i < n; i++)
sum = sum + a[i]*a[i];
sum = sqrt(sum);
return sum;
}
For Checkoff:
/home/sdykes/pub/c12
You enter the executable filename either as an argument or through an interactive prompt.
f0 and f1 in this
case or the function will return NaN.
-NaN
to test for uninitialized usage.
Consequently, if you try to zero an uninitialized register by
subtraction, as in
fsubd %f0, %f0, %f0the result is
%f0 = -NaN.
ldd).
This means you have to be careful of alignment for text
and data segments, e.g.
.data
.align 8
zero:
.word 0x0 ! (double) 0.0
.word 0x0
(You can also use the .double directive to declare
initialized static variables containing doubles.
Revision Date: 4/18/97