Subject | Re: Problem with quotes |
---|---|

Author | Adam |

Post date | 2005-10-11T23:29:02Z |

--- In firebird-support@yahoogroups.com, Ali Gökçen <alig@e...> wrote:

I am sure we can optimise the divide by 2 with a right shift op ;)

>((m*m+1)-(n*n+1))/2

>

> > = Cast(((n * (n+1)) / 2) as Integer)

> >

> > ( Does that make me a real programmer ;-) )

>

> Yup, it makes you with a little optimization.

> (if you cancel the casting :P )

>

> (n*n+n)/2, no cast, no paranthesis soup. ;)

>

> Actually this was the light version of my ask.

> The original is: how can you put sum of numbers from n to m.

I am sure we can optimise the divide by 2 with a right shift op ;)