Subject Re: [ib-support] Re: IB dumber than a $5 calculator
Author Paul Schmidt
On 30 May 2002 at 13:59, rrokytskyy wrote:

> > The problem is this:
> >
> > Take the diameter of an old metal swimming pool I had in the 1970's
> 18 feet, now I
> > want the circumference in metres.
> >
> > 'Calc = ' || '18' * .3048 * '3.14' the output variable is a VARCHAR
> (20)
> >
> > what it really needs to do is convert the 18 to a double and the
> 3.14 to a double, do
> > the math and cast the result to a string, concatenate that to any
> strings and sanity
> > check the result for length. In this case the result would be Calc
> = 17.227296 at
> > least according to my Canon F-502 calculator.
>
> Do not want to comment your statement about IB, but the right
> statement would be:
>
> 'Calc = ' || ('18' * .3048 * '3.14')
>
> at leaset this works:
>
> select 'Calc = ' || ('18' * .3048 * '3.14') from rdb$database
>
> Usually statements are evaluated from left to right, and there is not
> precedence between * and || operators.
>

Okay, so I missed a couple of brackets, I should have warned it was untested and
off the top of my head.




Paul Schmidt, President
Tricat Technologies
paul@...
www.tricattechnologies.com