4GL exponentiation bug
Posted in 1994
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
I am using the Informix-4GL RDS. It seems that 4gl offers exponentiation (** operator) but it truncates the exponent expression to an integer. This is a problem since we are writing an application for an insurance company and frequently need to raise values to powers for interest rate and future/present value calculations. Example code: database formonly main define exp decimal, x decimal, y decimal let x = 2.0 let exp = .1 let y = x ** exp ( should be 2 to the .1 power) display 'y = ',y end main I always get 'y = ',1 (since anything to zero power is one) anyway, I wrote a function in c called power.c, but I had to build a custom 4gl runner and compile this function into it, then change the above line to let y = power (x, exp) which worked. How come informix doesnt say anything about this in their manual? We are running 4gl 4.1 RDS, with ONLINE and the same error happens with the C-compiler version of 4gl. Is this just my platform or do all 4gl ports do this? Thanks