swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] Exponent Operator


From: Paul Johnson
Subject: Re: [Swarm-Support] Exponent Operator
Date: Fri, 14 Oct 2005 10:36:40 -0500
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

Same as C.

If it really is squared, at last check, it is faster to just multiply (x+3)*(x+3) but if it is not, then the C function pow(x,y) will do. There are specialized functions for some things like sqrt() for y=1/2. Look in the C headers for prototypes. On Fedora Core 4 I find these in /usr/include/tgmath.h.


/* Power functions.  */

/* Return X to the Y power.  */
#define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)

/* Return the square root of X.  */
#define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)

/* Return `sqrt(X*X + Y*Y)'.  */
#define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)

/* Return the cube root of X.  */
#define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)




Crile Doscher wrote:
Could someone tell me what the exponent operator is in ObjC, i.e. for something like (x + 3) ^2? Many thanks -
Crile
_______________________________________________


--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700


reply via email to

[Prev in Thread] Current Thread [Next in Thread]