[Gambas-user] DIV

Fabien Bodard gambas.fr at ...626...
Fri Jul 13 17:33:30 CEST 2012


2012/7/12 Benoît Minisini <gambas at ...1...>

> Le 12/07/2012 18:52, Jussi Lahtinen a écrit :
> >> This is for performance reasons: '\' (or DIV) operator is faster than
> '/'.
> >>
> >
> > OK.
> >
> >
> >
> >> If you want to use DIV like '/', just use '/'!
> >>
> >
> > "/" is different thing, it doesn't give integer quotient.
> > To get integer quotient from floats I use "iQuotient = Floor( a / b )".
> >
> >
> > Jussi
>
> CInt(a / b) is faster.
>
> And if iQuotient is already an integer, just doing iQuotient = a / b is
> a little bit faster again.
>
> Regards,
>
> --
> Benoît Minisini
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>


if I summarize :


iQuotient = Floor( a / b )


CInt(a / b)


iQuotient = a / b


>From the more complex to the most simple .... from the most slower to the
most faster....

Yes ! More it's simple, more it's faster... It's logical !!! :-D

-- 
Fabien Bodard



More information about the User mailing list