REGVAR2D

Concept Link IconSee also

Control the use of register variables as type DOUBLE in a program.

WebVue support - Yes.

Syntax

REGVAR2D([Flag]);

There is no return type.

Argument

Meaning

Flag

A flag to control register variable value conversions.

0 - Value of register variables are processed as type SINGLE in a program.

1 - Value of register variables are processed as type DOUBLE in a program. (default)

Execution

Change the way value of register variables is processed. It is recommended to use type DOUBLE to avoid truncation of numeric values.

The option to process these values as SINGLE is only offered to ensure compatibility of projects requiring it.

Example 1

'Variables

'@REGISTER01: Register type

'@REGISTER02: Register type

 

SUB Main()

REGVAR2D(1);

'The register variable is now type Double

'so this assignment works correctly:

@REGISTER01 = COS(45);

 

REGVAR2D(0);

'Automatic conversion to Double is disabled.

'The next line causes a runtime error

'because the Register variable is now Single:

@REGISTER02 = COS(45);

END SUB

Example 2

Allow to display a number with 8 digits and more: DVAL, TOD...

REGVAR2D(1);

@reg_double = DVAL("12345678901");

'Go back to single number: SVAL, TOS...

REGVAR2D(0);

@reg_single = SVAL("1234567");