6.17. kink/NUM_DIV

6.17.1. type num_div

`num_div` is a tuple (Dividend, Divisor), where where Dividend is a `num`, and Divisor is a non-zero `num`. A `num_div` value represents a division of `Dividend` by `Divisor`.

`num_div` values are usually made by Num.op_div or Num.round methods.

Example

6.17.1.1. Num_div.dividend

`dividend` returns `Dividend` attribute.

Example

6.17.1.2. Num_div.divisor

`divisor` returns `Divisor` attribute.

Example

6.17.1.3. Num_div.ceil(Scale)

`ceil` rounds the result of the division toward plus infinity.

The result is the smallest `num` with the given `Scale` not less than the real number of the division.

Precondition

`Scale` must be an integer `num`.

Example

6.17.1.4. Num_div.floor(Scale)

`floor` rounds the result of the division toward minus infinity.

The result is the biggest `num` with the given `Scale` not more than the real number of the division.

Precondition

`Scale` must be an integer `num`.

Example

6.17.1.5. Num_div.half_ceil(Scale)

`half_ceil` rounds the result of the division toward the nearest `num` with the given `Scale` with tie-breaking toward plus infinity.

The result is the `num` with the given `Scale` nearest to the real number of the division. If there are two such `num` values, the bigger one is returned.

Precondition

`Scale` must be an integer `num`.

Example

6.17.1.6. Num_div.half_floor(Scale)

`half_floor` rounds the result of the division toward the nearest `num` with the given `Scale` with tie-breaking toward minus infinity.

The result is the `num` with the given `Scale` nearest to the real number of the division. If there are two such `num` values, the smaller one is returned.

Precondition

`Scale` must be an integer `num`.

Example

6.17.1.7. Num_div.half_even(Scale)

`half_even` performs bankers’ rounding to the result of the division.

The result is the `num` value with the given `Scale` nearest to the real number of the division. If there are two such `num` values, the value with an even `Mantissa` is returned.

Precondition

`Scale` must be an integer `num`.

Example

6.17.2. NUM_DIV.new(Dividend Divisor)

`new` returns a `num_div` value with (Dividend, Divisor).

Preconditions

`Dividend` must be a `num`.

`Divisor` must be a `num`.

`Divisor` must not be equal to 0.

Example

6.17.3. NUM_DIV.is?(Val)

`is?` returns whether `Val` is a `num_div` value.