Re: Informix can't handle arithmetic expressions ?
Posted in 1995
Dan,
>From: Dan Madvig - Bethel College & Sem. <daniel@genesis.admin.bethel.edu>
>Date: Fri, 21 Jul 95 11:20:27 CDT
>X-Informix-List-Id: <list.6988>
>
>> I was was really surprised, when I noticed that Informix
>> didn't evaluate arithmetic expressions right, 1 / 2 will be 0 , if stored in
>> a variable, 1 / 2 will be 1 in an arithmetic expression.
>>
>> Is this a known bug (or feature) ?
I've dealt separately with Klaus's comments -- the gist of that message is
that I4GL is behaving as it should.
>Have you noticed in sacego that if you multiply two smallfloats,
>you get similar results?
>
>e.g. 0.045 * 2.00 yields 0.000
This claim is pretty much unsubstantiated -- there is no code given, and no
detailed version information. I attach a partial refutation -- it is an
example report run on a Sun Sparc 10 running Solaris 2.4 and using OnLine
6.00.UE1 and ISQL 6.01.UD1 and the ACE report below. The output I get is:
f1 = 0.045, f2 = 2.000, f3 = 0.090
0.05 2.00 0.09 0.09
This looks fine to me. What's your version of the events which leads you
to assert that ACE does not know how to multiply 2 SMALLFLOAT values?
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
DATABASE stores END
DEFINE
VARIABLE f1 SMALLFLOAT
VARIABLE f2 SMALLFLOAT
VARIABLE f3 SMALLFLOAT
END
OUTPUT
TOP MARGIN 0
BOTTOM MARGIN 0
LEFT MARGIN 0
PAGE LENGTH 1
END
SELECT * FROM Systables WHERE Tabid = 1 END
FORMAT
ON EVERY ROW
LET f1 = 0.045
LET f2 = 2.00
LET f3 = f1 * f2
PRINT " f1 = ", f1 USING "&.&&&",
", f2 = ", f2 USING "&.&&&",
", f3 = ", f3 USING "&.&&&"
PRINT f1, f2, f3, f1 * f2
END