# accumneg

Subtract two `fi` objects or values

## Syntax

``c = accumneg(a,b)``
``c = accumneg(a,b,RoundingMethod)``
``c = accumneg(a,b,RoundingMethod,OverflowAction)``

## Description

example

````c = accumneg(a,b)` subtracts `b` from `a` using the data type of `a`. `b` is cast into the data type of `a`. If `a` is a fi object, the default `'Floor'` rounding method and default `'Wrap'` overflow action are used. The `fimath` properties of `a` and `b` are ignored. ```

example

````c = accumneg(a,b,RoundingMethod)` subtracts `b` from `a` using the rounding method specified by `RoundingMethod` if `a` is a `fi` object.```

example

````c = accumneg(a,b,RoundingMethod,OverflowAction)` subtracts `b` from `a` using the rounding method specified by `RoundingMethod` and the overflow action specified by `OverflowAction` if `a` is a `fi` object.```

## Examples

collapse all

This example shows how to subtract two `fi `numbers using `accumneg`.

Subtract two `fi` numbers

Subtract `b` from `a`, where `a` and `b` are both `fi` numbers, using the default rounding method of `'Floor'` and overflow action of `'Wrap'`.

```a = fi(pi,1,16,13); b = fi(1.5,1,16,14); subtr_default = accumneg(a,b)```
```subtr_default = 1.6416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13 ```

Subtract two `fi` numbers using specified rounding and overflow action

Subtract `b` from `a`, where `a` and `b` are both `fi` numbers, using specified rounding method of `'Nearest'` and overflow action of `'Saturate'`.

```a = fi(pi,1,16,13); b = fi(1.5,1,16,14); subtr_custom = accumneg(a,b,'Nearest','Saturate')```
```subtr_custom = 1.6416 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 16 FractionLength: 13 ```

## Input Arguments

collapse all

Number from which to subtract. The data type of `a` is used to compute the output data type.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `logical` | `fi`

Number to subtract.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `logical` | `fi`

Rounding method to use if `a` is a `fi` object.

Example: `c = accumneg(a,b,'Ceiling')`

Data Types: `string`

Overflow action to take if `a` is a `fi` object.

Example: `c = accumneg(a,b,'Ceiling','Saturate')`

Data Types: `string`

## Output Arguments

collapse all

Result of subtracting input `b` from input `a`.

## Extended Capabilities

### GPU Code GenerationGenerate CUDA® code for NVIDIA® GPUs using GPU Coder™. 