Miscellaneous floating-point functions, Floating-point to/from integer conversions – Echelon Neuron C User Manual

Page 84

Advertising
background image

64

Functions

Short

Name Function

gt

boolean fl_gt(const float_type *arg1,

const float_type *arg2);

Returns TRUE if the first argument is greater than the second

argument, otherwise FALSE: (arg1 > arg2).

lt

boolean fl_lt(const float_type *arg1,

const float_type *arg2);

Returns TRUE if the first argument is less than the second argument,
otherwise FALSE: (arg1 < arg2).

ge

boolean fl_ge(const float_type *arg1,

const float_type *arg2);

Returns TRUE if the first argument is greater than or equal to the

second argument, otherwise FALSE: (arg1 >= arg2).

le

boolean fl_le(const float_type *arg1,

const float_type *arg2);

Returns TRUE if the first argument is less than or equal to the second

argument, otherwise FALSE: (arg1 <= arg2).

cmp

int fl_cmp(const float_type *arg1,

const float_type *arg2);

Returns +1 if the first argument is greater than the second argument, -1
if it is less, or 0 if it is equal.

Miscellaneous Floating-Point Functions

Table 24 lists miscellaneous floating-point functions.

Table 24. Floating-Point Functions

Short

Name Function

sign

int fl_sign(const float_type *arg);

Sign function, returns +1 if the argument is positive, 0 if the argument

is zero, or -1 if the argument is negative.

rand

void fl_rand(float_type *arg);

Returns a random number uniformly distributed in the range [ 0.0, 1.0 )

– that is, including the number 0.0, but not including the number 1.0.

Floating-Point to/from Integer Conversions

Table 25 on page 65 lists the conversion functions for floating-point and integer

numbers.

Advertising