Multiplication (*) and division (/) operators

Multiplication (*) operator returns the scalar product of its operands.

Division (/) operator returns the result of dividing the left operand by the right operand.

 

Numeric values are multiplied according to basic rules of mathematics.

When you divide numeric values, you must remember these rules:

  1. Dividing by zero is forbidden by mathematical rules and an invalid operation in programming.

    With Lycia, you dividing by zero is still invalid but will not produce compilation errors or runtime crashes (was implemented for the development needs).

    If the right operand is zero, you will get a warning at compilation:

    At runtime, the result of dividing by zero is NULL.

  2. If both dividend and divisor are of the INT or SMALLINT data type, 4GL discards the fractional portion of the result.
  3. If the results of division are assigned to a fixed-point DECIMAL variable and the fractional part of the result contains more decimal places than the declared scale of the receiving variable, these results are rounded.

 

DATE and DATETIME values have no true zero point that is why division and multiplication are logically undefined for these data types and their returned values are meaningless in most applications.

However, you can multiply or divide INTERVAL values only by numeric expressions. In this case, result is an INTERVAL value of the same precision as the INTERVAL factor/dividend.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.