Re: square root?
Posted in 1996
Using sql is easy as described here, but not exactly fast. The other alternative noone seemed to mention is to simply use C functions. This of course assumes your variables are of type compatible with C (smallfloat, float, smallint, integer). If they aren't you can simply make them by assigning them to such variables. 4GL will do the conversion automatically. You may need a C function library for some of your functions, but you should be able to use any such library and simply write a set of wrapper functions to it for use from 4GL. mcanto@unl.edu.ar (Mario Canto) wrote: :You can use any sql function than you want inside 4gl without creating :any temp table (just using an existing one): :Example: : ... : DEFINE x, y FLOAT : : LET x = 3.141592654 / 6. : SELECT SIN(x) INTO y FROM systables WHERE tabid=1; -- always exists 1 : DISPLAY y : ... :Hope this helps :Mario R. Canto :mcanto@unl.edu.ar :On Fri, 18 Oct 1996, Clem Akins wrote: :} >> Does anyone know how to compute square root on 4GL? Also how to compute :} >> logarithmic and trig functions? :} >> :} >> Please respond to fmatrins@sc0126wp.sc.blm.gov :} :} Though it's not exactly what you asked for, these functions are available :} in SQL. Some of them are not documented, but ARE available, in older :} versions, too. You may be able to compute these values non-programmatically :} using temp tables and SQL functions. :} :} Check your release notes, as well as newer versions of TFM, and try the :} functions on your version (if it's older.) :} :} You may also check out the International Informix User Group page. There :} are many tools and function sets available there for 4GL (and other Informix :} products) at no cost to you. Perhaps some of them will be useful. The URL :} is: http://www.iiug.org/software/software_index.html :} :} Good luck, :} :} ______________________________________________________ :} Clem Akins (aka clema@informix.com) :} Informix Software, Inc (Standard disclaimers apply) :} International Technical Support :} Last seen: Spending a balmy winter in Singapore! :} Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company