Subject Re: IB stored proc & casting issue csswa 2002-05-30T18:21:29Z
(yes, I am slowly burying that subject line!)

Sure, this is a neat example, Paul. But I'd still much rather have
divisions that work as seamlessly as multiplication. I'm still
hoping someone will point out why multiplications get automatic float-
casting internally but divisions don't. :-)

Regards,
Andrew Ferguson
-- Got a new truck for my wife - not a bad trade huh?

--- In ib-support@y..., "Paul Schmidt" <paul@t...> wrote:
> 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@t...
> www.tricattechnologies.com