So I’ve recently come across some Modula 2 code that I wrote ages ago and realised that a small part of it might be worth converting to NWScript. However, not being that into the actual under the hood way that NWScript actually works, I need to ask a couple of questions.

Question 1 is probably the easiest to answer. The code that I wrote involves some pre-calculated numbers. The only thing is that they were written for double precision floating point numbers (i.e. 64 bit as opposed to NWScript’s 32 bit). As an illustration (i.e. not considering converting this actual line) of what I am talking about the following constant declaration -

```
ReciprocalOfPI = 0.31830988618379067154; (* 1 / PI *)
```

All I need to know is how many digits can I safely lose from the right of such numbers.

Now to my other question. Are pseudo arrays the best solution for storing related data where the actual number of pieces of data is unknown until run time?

Thanks.

FWIW I don’t know if anyone has a use for them but as an exercise in making sure that I could remember enough about Modula 2 to be able to do the conversion, I did these little functions.

```
int GCD(int C, int D)
{
if(C == 0)
return D;
else if(D == 0 || C == D)
return C;
else
return GCD(D, C % D); // Eek! Recursion
}
int GreatestCommonDivisor(int A, int B)
{
if(A < 0 || B < 0) // only works for positive numbers
return -1;
if(A < B) //swap them using bitwise Exclusive Or as they are ints
{
A ^= B;
B ^= A;
A ^= B;
}
return GCD(A, B);
}
int LowestCommonMultiple(int M, int N)
{
if(M < 0 || N < 0) // only works for positive numbers
return -1;
return M / GreatestCommonDivisor(M, N) * N;
}
```

Note if an error occurs they return -1.

TR