Division Operator (/) (FPScript)

23.08.2021

Divides two expressions.

Syntax

Dividend / Divisor

The syntax of the / operator consists of the following elements:

Element

Description

Dividend

Any expression. All data types except Boolean values are permitted.

Divisor

Same as Dividend. However, it cannot be 0. See "Remarks".

Remarks

The operator can process scalar values or entire data series and data matrices. If at least one argument is a data series or a data matrix, division takes place on a per-element basis and the result is once again a data series or a data matrix. If at least one of the two arguments is a data matrix, then both arguments must have the same number of rows. For a different number of columns in data matrices or for a different number of rows in data series, extra columns or values are removed.

If signals, signal series or space curves are divided, only their Y components are examined. The result then preferably contains the X component and possibly the Z component of Dividend. Otherwise, it contains those of Divisor. If one of the expressions returns a list, then the operation is executed for each item in the list and the result is also a list.

You can apply the operator to real and complex data types as well as to time spans and strings. For complex arguments, complex division takes place and the result is also complex. The result is always of the same data type as the expressions. If the expressions have different data types, then these are adapted to each other in such a way that there is no loss of resolution in the result, i.e. lower resolutions are converted into higher resolutions, integers are converted into floating point values and real numbers converted into complex numbers.

Complex division is defined as (a, b) / (c, d) = (a * c + b * d, b * c - a * d) / ( c ^ 2 * d ^ 2).

If one argument is numeric and the other is a string, the string is changed to numeric type before the operation. Both arguments cannot be strings.

You can divide time span values by numeric values or time span values. Both operands are then interpreted as seconds and the result is a time span value corresponding to the quotient.

If integer values are divided, then the result is also an integer. Any occurring fractional digits are truncated.

Dividing by zero with floating point data types results in a void value. An error is output when integral data types are used.

If at least one of the two operands is a quantity, then this also applies to the result, and its unit is formed by dividing the units of the operands. If an operand has the unit % or ppm (parts per million), then this is transformed to the unit 1 before the division.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

Signal / 1000

Divides all Y values in Signal by 1000. The unit remains unchanged.

Signal(Signal.y, Signal.x / 10.)

Compresses a signal by a factor of 10 in the X direction.

(1., 2.) / (3., 4.)

Returns the complex 64-bit floating point value (0.44, 0.08).

"3,23" / 2n

Returns the 32-bit integer 1, since the string is changed into the data type of the numeric result. Note that the country-specific decimal symbol set in Windows must be used in the string.

'12:00:00' / 1.5

Returns the time span value '08:00:00'.

{ 1., 2.} / {2., 0.}

Returns the data series with the 64-bit floating point value { 0.5, ? }.

1 m / 5 s

Returns 0.2 m/s.

/ 5 s

Returns 0.2 Hz.

1 V / 5 V

Returns 0.2 with the unit 1.

1 mV / 5 V

Returns 0.2 mV/V.

1 m^3 / 5 m

Returns 0.2 m^2.

20 m / 10 %

Returns 20 m / (10/100) = 200 m.

 

See Also

Division Remainder Operator (%)

Share article or send as email:

You might be interested in these articles