VAL - VIEWPORT

VAL

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

VAL converts an ASCII string expression into a numeric value.

Example Statements

Day=VAL(Date$)
IF VAL(Response$)0 THEN Negative

Syntax

Item Description Range
string argument string expression numerals, decimal point, sign and exponent notation

Semantics

The first non-blank character in the string must be a digit, a plus or minus sign, or a decimal point. The remaining characters may be digits, a decimal point, or an E, and must form a valid numeric constant. If an E is present, characters to the left of it must form a valid mantissa, and characters to the right must form a valid exponent. The string expression is evaluated when a non-numeric character is encountered or the characters are exhausted.

Two-Byte Language Specifics

Certain localized versions of HP BASIC, such as Japanese localized HP BASIC, support two-byte characters. The VAL function does not support two-byte characters. The string digits to be converted must be one-byte ASCII characters. For more information about two-byte characters, refer to the globalization chapters of the HP BASIC Porting and Globalization manual.

VAL$

Supported On UX WS DOS IN
Option Required None
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

VAL$ converts a numeric expression to an ASCII string. The returned string is in the default print format, except that the first character is not a blank for positive numbers. No trailing blanks are generated.

Example Statements

PRINT Esc$;VAL$(Cursor-1)
Special$=Text$&VAL$(Number) 

Syntax

Item Description Range
numeric argument numeric expression --

VIEWPORT

Supported On UX WS DOS
Option Required GRAPH
Keyboard Executable Yes
Programmable Yes
In an IF ... THEN ... Yes

VIEWPORT defines an area (in GDUs) onto which WINDOW and SHOW statements are mapped. It also sets the soft clip limits to the boundaries it defines.

Example Statements

VIEWPORT 0,35,50,80
VIEWPORT Left,Right,Bottom,Top

Syntax

Item Description Range
left edge numeric expression --
right edge numeric expression >left edge
bottom edge numeric expression --
top edge numeric expression >bottom edge

Semantics

The parameters for VIEWPORT are in Graphic Display Units (GDUs). Graphic Display Units are 1/100 of the shorter axis of a plotting device. GDUs are isotropic (the same length in X and Y). The soft clip limits are set to the area specified, and the units defined by the last WINDOW or SHOW are mapped into the area.

For the plotter specifier "INTERNAL" (the CRT), the shorter axis is Y. The longer axis is X, which is (100*RATIO) GDUs long. For the plotter specifier "HPGL" (which deals with devices other than the CRT), the RATIO function may be used to determine the ratio of the length of the X axis to the length of the Y axis. If RATIO is greater than one, the Y axis is 100 GDUs long, and the length of the X axis is (100*RATIO). If the ratio is less than one, then the length of the X axis is 100 GDUs and the length of the Y axis is (100*RATIO).

A value of less than zero for the left edge or bottom is treated as zero. A value greater than the hard clip limit is treated as the hard clip limit for the right edge and the top. The left edge must be less than the right edge, and the bottom must be less than the top, or error 704 results.