Conversion of floating-point to ascii string – Echelon Neuron C User Manual

Page 85

Advertising
background image

Neuron C Reference Guide

65

Table 25. Floating-Point Conversion Functions

Short

Name Function

to
slong

signed long fl_to_slong(const float_type *arg);

Converts a floating-point number to a Neuron C signed long integer

(range -32,768 to +32,767). Truncation is towards zero. For example,
fl_to_slong(-4.56) = -4. If the closest integer is desired, call fl_round( )

before calling fl_to_slong( ).

to
ulong

unsigned long fl_to_ulong(const float_type *arg);

Converts a floating-point number to a Neuron C unsigned long integer
(range 0 to 65,535). Truncation is towards zero. For example,

fl_to_ulong(4.56) = 4. If the closest integer is desired, call fl_round( )
before calling fl_to_ulong( ).

to
s32

void fl_to_s32(const float_type *arg1, void *arg2);

Converts a floating-point number to a signed 32-bit integer (range

±2,147,483,647). The second argument is the address of a four-byte
array, compatible with the signed 32-bit integer type s32_type.

Truncation is towards zero. For example, fl_to_s32(-4.56) = -4. If the

closest integer is desired, call fl_round( ) before calling fl_to_s32( ).

from
slong

void fl_from_slong(signed long arg1, float_type *arg2);

Converts a Neuron C signed long integer (range -32,768 to +32,767) to a

floating-point number.

from
ulong

void fl_from_ulong(unsigned long arg1,
float_type

*arg2);

Converts a Neuron C unsigned long integer (range 0 to +65,535) to a

floating-point number.

from
s32

void fl_from_s32(const void *arg1, float_type *arg2);

Converts a signed 32-bit number (range ±2,147,483,647) to a floating-
point number. The first argument is the address of a four-byte array.

Conversion of Floating-Point to ASCII
String

Table 26 on page 66 lists the conversion functions for floating-point numbers to

ASCII strings.

Advertising