MATLAB Function Reference |

**Syntax**

**Description**

```
factorial(n)
```

is the product of all the integers from `1`

to `n`

, i.e. `prod(1:n)`

. Since double pricision numbers only have about 15 digits, the answer is only accurate for `n <= 21`

. For larger `n`

, the answer will have the right magnitute, and is accurate for the first 15 digits.

**See Also**

factor | false |