Calculator

Calculator is used to perform arithmetic operations with variables. Except of standard operations like "Addition" and "Subtraction", it is possible to use logarithmic and trigonometrical functions. Also, this component can be used to transform numeric data to text data in different formats.

Calculator

Function

The edit box where you are entering text of the function. Template usage is possible.

Result Variable

The variable's name is setting here, and the value returned by the function is placed here.

Result Format

Created results are setting here. The results can be presented in one of the formats:

%[ flags ] [ width ] [ . precision ] type-char

flags is a sequences of any of those:

Flag

Meaning

Format

Example

-

left alignment

%-10d

100

=

centered alignment

%=10d

100

+

show sign even for positive numbers

%+d

+100

#

show numerical base, and decimal point

%#x

0x64

0

pad with 0's (inserted after sign or base indicator)

%05d

00100

 

if the string does not begin with + or -, insert a space before the converted string

% 7d

100

width specifies a minimal width of the string resulting after the conversion. If necessary, the string will be padded with alignment and fill characters either set on the stream via manipulators, or specified by the format-string (e.g. flags '0', '-', ..)

precision (preceded by a point), sets the precision

When the result a floating type number, it sets the maximum number of digits

after decimal point when in fixed or scientific mode

in total when in default mode ('general mode', like %g)

When used with type-char s or S it takes another meaning : the conversion string is truncated to the precision first chars. (Note that the eventual padding to width is done after truncation.)

type-char:

Flag

Meaning

Format

Example

p or x

hexadecimal output

%x

0x64

o

octal output

%o

144

e

scientific float format

%e

3.333333e-001

f

fixed float format

%f

0.333333

g

general -default- float format

%g

0.333333

X, E or G

same effect as their lowercase counterparts, but using uppercase letters for number outputs. (exponents, hex digits, ..)

%X

0X64

d, i or u

decimal type output

%d

100

s or S

string output

%s

100

c or C

1-character output

%c

1

%

print the character %

%%

%

Examples:

Format

Result

Total %d numbers

Total 25 numbers

Found at 0x%08x

Found at 0x00000200

Result is %e

Result is 3.333333e-001

See also

Processors