Reply to message «Re: create variable on the fly», sent 22:58:36 23 January 2011, Sunday by Christian Brabandt:
> Something like this:
> if (a>0 && b>0 && a+b < 0)
> return -1
> endif
There are lots of cases when this does not work, for example:
:echo +(printf('%u', -1)/2)
2147483647
:echo 2147483647*2147483647
1
Maybe it is better to use python? It can do long arithmetics and thus one is
able to reliably check whether calculations have exceeded the limit.
Original message:
> Hi rameo!
>
> On Fr, 21 Jan 2011, rameo wrote:
> > Is it possible to check if a result of a calculation is above the
> > limit and interrupt the function?
>
> Something like this:
> if (a>0 && b>0 && a+b < 0)
> return -1
> endif
>
>
> regards
> Christian
signature.asc
Description: This is a digitally signed message part.
