Floating-point support functions, Table 20 on pag, 58 lists times in milliseconds for – Echelon Neuron C User Manual

Page 78

Advertising
background image

58

Functions

Table 20. Signed 32-Bit Function Performance

Function

Maximum

Average

Add/subtract 0.10

0.08

Multiply 2.07

1.34

Divide 3.17

2.76

Remainder 3.15

2.75

Maximum/minimum 0.33

0.26

Absolute value

0.25

0.12

Negation 0.20

0.20

Arithmetic Comparison

0.33

0.26

Conversion to ASCII

26.95

16.31

Conversion from ASCII

7.55

4.28

Conversion to 16-bit integer

0.12

0.10

Conversion from 16-bit integer

0.10

0.10

Random number generation

0.12

0.11

Sign of number

0.15

0.11

Increment 0.07

0.04

Decrement 0.10

0.04

Multiply by two

0.10

0.10

Divide by two

0.30

0.16

Floating-Point Support Functions

The Neuron C compiler does not directly support the use of the ANSI C
arithmetic and comparison operators with floating-point values. However, there

is a complete library of functions for floating-point math. These functions are
listed in

Floating-Point Math

on page 46. For example, in standard ANSI C, to

evaluate X = A + B * C in floating-point, the '+' and '*' infix operators can be used

as follows:

float X, A, B, C;
X = A + B * C;

With Neuron C, this can be expressed as follows:

Advertising