in the file DecFloatC.c I edited

int NUMBER_OF_DIGITS=64;

int NUM_DIGITS=64;

int NUM_DIGITS2;

int NUM_DWORDS=8;

int NUM_BYTES=32;

int EXTRAWORDS = 0;

and put the following in the DecFloat_init function

Code: Select all

```
printf("NUM_DWORDS + 1 + EXTRAWORDS=%d\n", NUM_DWORDS + 1 + EXTRAWORDS);
```

and run this FB code

Code: Select all

```
dim shared as long NUMBER_OF_DIGITS, NUM_DIGITS, NUM_DWORDS, NUM_BYTES
scope
dim as long n = digits_precision / 8
if (8 * n) = digits_precision then
NUMBER_OF_DIGITS = digits_precision
else
NUMBER_OF_DIGITS = 8 * (n + 1)
end if
NUM_DIGITS = NUMBER_OF_DIGITS
NUM_DWORDS = NUMBER_OF_DIGITS / 8
NUM_BYTES = 4 * (NUM_DWORDS)
end scope
#Include "DecFloatC.bi"
DecFloat_Set_Digits(digits_precision, 0)
Const order=4
print "order = ";order
Dim As Decfloat z1, z2
Dim Shared As Decfloat roots(order)
```

and the printout was

Code: Select all

```
NUM_DWORDS + 1 + EXTRAWORDS=9
NUM_DWORDS + 1 + EXTRAWORDS=9
NUM_DWORDS + 1 + EXTRAWORDS=9
NUM_DWORDS + 1 + EXTRAWORDS=9
NUM_DWORDS + 1 + EXTRAWORDS=9
order = 4
NUM_DWORDS + 1 + EXTRAWORDS=17
NUM_DWORDS + 1 + EXTRAWORDS=17
```

notice that Dim Shared As Decfloat roots(order) is executed first and then

DecFloat_Set_Digits(digits_precision, 0)

Const order=4

print "order = ";order

Dim As Decfloat z1, z2

with redim or without shared the order of execution is normal

looks to me that my C code and the bi were OK, but it can't function with shared arrays without using redim