Programs
General

Comments
Constants
Exceptions
Execution Environments
Identifiers
Relaxations
Spacing
T-Tables
Text
Variables

Lines
Expressions
Types
Operators
Binary Arithmetic Operators
Boolean Operators
Conversion Operators
Relational Operators
Structural Operators
Unary Arithmetic Operators

Literals
Comments
Constants
Exceptions
Execution Environments
Identifiers
Relaxations
Spacing
T-Tables
Text
Variables

Lines
Expressions
Types
Operators
Binary Arithmetic Operators
Boolean Operators
Conversion Operators
Relational Operators
Structural Operators
Unary Arithmetic Operators

Literals
The following is the documentation for unary arithmetic operators. The unary arithmetic operators are of the form: `x = <operator> a`

or `x = <operator name>(a)`

.

The documentation includes references to exceptions and relaxations.

For more information on exceptions, see exceptions.

For more information on relaxations, see relaxations.

All operations result in a decimal number type with 15 digits. The mathematics of this is covered in the section on the Decimal Number Type.

Syntax: `x = -a`

Description: Sets x to the negation of a.

Syntax: `x = +a`

Description: Sets x to the positive of a.

Alltough most languages have a round function, it is implemented differently. The two main problems are 1) rounding with negative numbers and 2) rounding of exactly half-way numbers.

Round is defined properly as `floor(x + 0.5)`

.

Syntax: `x = ceil(a)`

Description: Sets x to the integer closest to a upwards.

Syntax: `x = floor(a)`

Description: Sets x to the integer closes to a downwards.

Syntax: `x = truncate(a)`

Description: Sets x to the integer closest to a towards zero. In other words, the part after the decimal point is cut off.

Syntax: `x = |a|`

or `x = abs(a)`

.

Description: Sets x to the absolute value of a, which means if a is negative, a is negated.

Syntax: `x = log(a)`

Description: Sets x to the logarithm base 10 of a.

Exceptions:

- Invalid operand, if a is 0 or less.

Relaxations:

- Binary
- Exception

Syntax: `x = ln(x)`

Description: Sets x to the logarithm base e of a, also known as the natural logarithm.

Exceptions:

- Invalid operand, if a is 0 or less.

Relaxations:

- Binary
- Exception

Syntax: `x = sin(a)`

Description: Sets x to the sine of a. This is the radians version of sine.

Relaxations:

- Binary

Syntax: `x = cos(x)`

Description: Sets x to the cosine of a. This is the radians version of cosine.

Relaxations:

- Binary

Syntax: `x = tan(a)`

Description: Sets x to the tangent of a. This is the radians version of tangent. Tangent cannot be performed on `pi/2 + n*pi`

for any integer n. Values of a approaching these values will cause an overflow exception.

Exceptions:

- Overflow

Relaxations:

- Binary

Syntax: `x = asin(a)`

Description: Sets x to the arcsine of a. The result is in radians.

Exceptions:

- Invalid operands
- if a is less than -1.
- if a is more than 1.

Relaxations:

- binary
- exception

Syntax: `x = acos(a)`

Description: Sets x to the arccosine of a. The result is in radians.

Exceptions:

- Invalid operands
- if a is less than -1.
- if a is more than 1.

Relaxations:

- binary
- exception

Syntax: `x = atan(a)`

Description: Sets x to the arctangent of a. The result is in radians.

Relaxations:

- binary

Syntax: `x = sqrt(a)`

Description: Sets x to the square root of a.

Exceptions:

- Invalid operand, if a is less than zero.

Relaxations:

- binary
- exception

Syntax: `x = exp(a)`

Description: Sets x to e to the power of x, `e^x`

, where `e`

is the constant e.

Exceptions:

- Overflow

Relaxations:

- Exception
- Binary

We would be more than happy to help you. Our opening hours are 9–15 (CET).

📞 (+47) 93 68 22 77

Nils Bays vei 50, 0876 Oslo, Norway

Copyright © 2018-24 progsbase.com by Inductive AS.