# floorDiv

## 语法

``y = floorDiv(x,d)``
``y = floorDiv(x,d,m)``

## 说明

``y = floorDiv(x,d)` 返回 `x/d` 向负无穷方向舍入到最接近的整数值的结果。`

``y = floorDiv(x,d,m)` 返回 `x/d` 向负无穷方向舍入到 `m` 的最接近倍数的结果。计算 `y` 的数据类型，使得在给定数据类型 `x` 以及 `d` 和 `m` 值的情况下，字长和小数长度的大小足以包含最大和最小可能解。`

## 示例

`floorDiv(int16(201),10)`
```ans = 20 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 13 FractionLength: 0 ```

`floorDiv(int16(201),10,7)`
```ans = 14 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 13 FractionLength: 0 ```

```function y = floorDiv_example(x,d) y = floorDiv(x,d); end ```

```x = fi(pi); d = fi(2); y = floorDiv_example(x,d)```
```y = 1 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 2 FractionLength: 0 ```

`codegen floorDiv_example -args {x, coder.Constant(d)}`
```Code generation successful. ```

```function y = floorDiv10(x) y = floorDiv(x,10); end ```
```x = fi(5*pi); y = floorDiv10(x)```
```y = 1 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 2 FractionLength: 0 ```
`codegen floorDiv10 -args {x}`
```Code generation successful. ```