DiGrande.it

Blind, Braille and Embossing Technologies

This site uses cookies to personalize content and ads, provide social media features and analyze links. By closing this banner or continuing to browse, you consent to their use.
Read the DiGrande.it Cookie Policy

The numbers

The language has several numeric types, including integers, decimals and fractionals. Integers or decimals are direct values that can be used as an assignment to a variable or as a parameter to a routine that requires them. For example:

- x = 50

- Dot(50,75)

In the case of decimal values, the fractional part is separated from the integer part by the symbol ".". For example:

- x = 50.4

Generally, the interpreter uses integer and decimal number types transparently. In the case of decimal numbers, the "Int" and "Frac" functions are used to derive the integer or fractional part of the number, respectively. For example:

- x = Int(50.4)

- y = Frac(50.4)

The variable x will contain the value 50, while the variable y will contain the value 0.4.

A number can also be written in hexadecimal. For example:

- x = #2a

A hexadecimal number is always prefixed with the "#" symbol. The variable x will be instantiated with the decimal value 42, that is, with the hexadecimal number 2a.

A number can be of fractional type. In this case, fraction means a percentage portion of drawing area. Fractional number types are as follows:

- 0x: The number is followed by the character x. The actual value corresponds to the expressed percentage of the width of the graph.

- 0y: the number is followed by the y character. The actual value corresponds to the expressed percentage of the height of the graph.

- 0min: the number is followed by the letters min. The actual value corresponds to the expressed percentage of the min value of the width or height of the graph.

- 0mid: the number is followed by the letters mid. The actual value corresponds to the percentage expressed of the middle value between the width and height of the graph.

- 0max: the number is followed by the letters max. The actual value corresponds to the percentage expressed of the largest value of width or height of the graph.

For example, in case you have a graph of size 120 points wide and 180 points high.

- x = 60x - x will contain the value 72, or 60% of the width.

- y = 60y - y will contain the value 108, i.e. 60% of the height.

- v = 60min - v will contain the value 72, that is, the smallest percentage value between width and height.

- v = 60max - v will contain the value 108, that is, the largest percentage value between width and height.

- v = 60mid - v will contain the value 90, that is, the average percentage value between width and height.

it is important to understand that fractional numeric types are exclusively usable directly. It is not possible to perform arithmetic operations with them and keep the type. For example:

- v = 50x+50y

The variable v will contain the value 150, that is, the sum of 60 plus 90, the 50% portions of width and height. Therefore v will never contain the fractional type value 100.

To derive the fractional values of the graphic area in an indirect or structured way, the functions FrX, FrY, Min, Mid and Max are available.

Fractional types are useful numbers in constructing graphs that can be adapted to any graph size, being able to use them as percentage values in drawing instructions. For example:

- Circle(50,50,40)

- Circle(50x,50y,40min)

In the first case the circle is always drawn of the same size and in the same position, even in the event that the size of the graph was larger or smaller than it.

In the second case, the circle is always drawn in the center of the graph and its radius is 40 percent of the smallest value between the width and height, allowing for a circle that fits and never exceeds the size of the graph.