0

Hello there,

I am trying to build a square matrix of the type Double, with the following code:

```
for( i = 0; i < weightVector.length; i++)
for( j =0; j< weightVector.length; j++)
{
weightMatrix[i][j]= weightVector[i]* weightVector[j];
if(i==j) weightMatrix[i][i] += 0.0001;
}
```

The problem is each time the vector "weightVector" has a very small value (e.g the multiplication of the values 1.190597027811988E-273 and -2.513498651481222E-273) it gives zero as an answer, but if i work this out with a calculator, it gives me the right answer. Can you tell me why my programme is approximating its answer to zero, please?

*Edited 3 Years Ago by Dani*: Formatting fixed