lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> We can discuss about the algorithm to calculate a power but for me
> this is a printing problem. To have a not-exactly zero value can
> happen because of how FP values works but in GSL shell I've designed a
> smarter system to print a matrix, here an example:
>
>> m = cnew(2,2,|k,j|(k+1i * j)^2) -- create a complex matrix
>> =m -- print the matrix
> [    2i -3+4i ]
> [  3+4i    8i ]
>
> As you can see there are no spurious 'almost zero' values.
>

sometimes it's nice to have arithmetic with (small) integers exact.
It's perhaps less useful for "complex integers", but still
(1+1i)^2==2i might be true

(but as I said - gsl-shell is great :)

-p