Type change


#1

Suppose I have 1-D array M, with cells containing two integer attributes, a and b. I may want to divide these two values:

./iquery -aq “apply(M, result_value, iif((b = 0), 0, (a/b)))”

result_value appears to be an integer (e.g. if I store the answer to this query, result_value is stored as an integer value.) Is there a simple way to ensure that the answer to this division operation is captured as a non-integer numeric type, such as a float?

I’ve looked at the cast operator, and even into a hokey workaround or two, but none have worked. Any suggestions appreciated.

Thanks, Patrick


#2

Hello, Patrick

Have you tried the following?
./iquery -aq “apply(M, result_value, iif((b = 0), 0.0, (double(a)/double(b))))”

Let me know if it helps.


#3

Thanks for the prompt response, that did the trick!

Patrick