Next: , Previous: , Up: Array Expressions   [Contents][Index]


3.9 Two-argument math functions

The math functions described in this section take two arguments. Most combinations of these types may be used as arguments:

ANSI C++ math functions

These math functions are available on all platforms, and work for complex numbers.

atan2(x,y)

Inverse tangent of (y/x). The signs of both parameters are used to determine the quadrant of the return value, which is in the range [-\pi, \pi]. Works for complex<T>.

blitz::polar(r,t)

Computes ; i.e. converts polar-form to Cartesian form complex numbers. The blitz:: scope qualifier is needed to disambiguate the ANSI C++ function template polar(T,T). This qualifier will hopefully disappear in a future version.

pow(x,y)

Computes x to the exponent y. Works for complex<T>.

IEEE/System V math functions

See the notes about IEEE/System V math functions in the previous section. None of these functions work for complex numbers. They will all cast their arguments to double precision.

copysign(x,y)

Returns the x parameter with the same sign as the y parameter.

drem(x,y)

Computes a floating point remainder. The return value r is equal to r = x - n * y, where n is equal to nearest(x/y) (the nearest integer to x/y). The return value will lie in the range [ -y/2, +y/2 ]. If y is zero or x is +INF or -INF, NaNQ is returned.

fmod(x,y)

Computes a floating point modulo remainder. The return value r is equal to r = x - n * y, where n is selected so that r has the same sign as x and magnitude less than abs(y). In order words, if x > 0, r is in the range [0, |y|], and if x < 0, r is in the range [-|y|, 0].

hypot(x,y)

Computes so that underflow does not occur and overflow occurs only if the final result warrants it.

nextafter(x,y)

Returns the next representable number after x in the direction of y.

remainder(x,y)

Equivalent to drem(x,y).

scalb(x,y)

Calculates.

unordered(x,y)

Returns a nonzero value if a floating-point comparison between x and y would be unordered. Otherwise, it returns zero.


Next: , Previous: , Up: Array Expressions   [Contents][Index]