Binary arithmetic operators – Echelon Neuron C User Manual

Page 81

Advertising
background image

Neuron C Reference Guide

61

Example:

float_type local_angle; // internal variable
network output SNVT_angle_f nvoAngle; // network variable

void f(void) {

nvoAngle = *(SNVT_angle_f *) &local_angle;

}

The following example shows how an input SNVT_length_f network variable can
be used as an input parameter to one of the functions in this library.
Example:

network input SNVT_length_f nvoLength;

// network variable

when(nv_update_occurs(nvoLength)) {
if(fl_eq((const float_type *)&nvoLength, &fl_zero))

// compare length to zero

. . .

}

The IEEE 754 format defines certain special numbers such as Infinity, Not-a-

Number (NaN), and Denormalized Numbers. This library does not produce the

correct results when operating on these special numbers. Also, the treatment of
roundoff, overflow, underflow, and other error conditions does not conform to the

standard.
To assign the IEEE value of NaN to a floating-point object, you can use the hex
value 0x7FC00000 as shown in the example below:
Example:

float_type fl = {0,0x7F,1,0x40,0}; // NaN

The NodeBuilder debugger can display floating-point objects according to their
underlying float_type structure.
The debugger can display floating-point objects as raw data at a specific address.

To examine the value of one or more contiguous floating-point variables, enter
the address of the first variable into the raw data evaluation window, select Raw

Data at Address, Data Size as quad, Count as the number of variables that you

want to display, and Format as Float. You can also modify floating-point
variables by clicking on the value field, and entering new data in the usual

format for floating-point numbers.

The floating-point function arguments are all passed by pointer reference. The

calling function or task is responsible for declaring storage for the arguments

themselves. Argument lists are ordered so that input arguments precede output
arguments. In all cases, floating-point output arguments can match any of the

input arguments to facilitate operations in place.

Binary Arithmetic Operators

Table 21 on page 62 lists the binary arithmetic operator functions.

Advertising