[Gambas-user] Bug with * operator (I think)

Jussi Lahtinen jussi.lahtinen at ...626...
Tue Apr 6 19:17:51 CEST 2010


If someone is interested, this is how I managed to solve my problem.

I converted this;
Print (y * (1 + y)) / 2

To this (here y is string, not long);
Shell "echo \"(" & y & "*(1+" & y & "))/2\" |bc" To sResult

This is not very quick method, but in my case it is fast enough.

Jussi



On Mon, Apr 5, 2010 at 22:50, Jussi Lahtinen <jussi.lahtinen at ...626...> wrote:
>> The '*' operator (like '+' and '-') returns the same datatype as its
>> arguments. There is no conversion to a bigger datatype if needed, so the
>> result is truncated.
>
>  Yes, of course.
>  I was confused because "?3413156131^2" did work.
>
>
>>> I need really big numbers...
>>
>> Find a volunteer to implement a Gambas component based on a library that can
>> manage big integers, like that one: http://gmplib.org/
>
>  Seems not to work with 64bit machines yet...
>  I think this would be quite easy to use as external library, but of
> course component would be much better option.
>  Right now I think I will look at bc.
>  It is default command in many Linux distributions.
>  Something like this; 'echo "3413156131 * 3413156131;" | bc' combined
> with Gambas shell command.
>
>
> Jussi
>




More information about the User mailing list